Repository navigation
Conversation
There was a problem hiding this comment.
Let's use this thread for a more general discussion on this example.
My main question is: How do we want to deal with having to rely on some sort of mocks as we should definitely NOT have any code that might just execute LLM queries in our examples while still having a nice way of showing actual results? The results that I show here now are pre-computed, but having them requires some ugly code at the end of the example which we probably don't want.
One alternative would be to move this into the user guide, where we could then also explain a bit more about the pros and cons of the LLM Recommender and the different meta recommenders. What are your thoughts? Note that for this reason, the SVGs are also not yet optimized and compressed as I first want us to come to a decision how to deal with those at all (will then also get rid of them by force pushing)
There was a problem hiding this comment.
you could use some of the already inclued csv datasets or basically anything form the benchmark suite to create a mock and reudce the code needed for that in the example
i see no problem in that as long as its clearly stated in the example that the recommendations here are mocked and the example is just there to demonstrate how to set up the LLMRecommender
There was a problem hiding this comment.
🟡 Changes recommended
The example misses the two-phase transition and can terminate simulations early by sampling excluded configurations.
3 open findings
What changed in this PR
Adds documentation and an example for using BayBE’s LLM recommenders alongside Bayesian optimization.
Changes:
- Documents provider setup, prompt construction, metadata, and limitations.
- Adds a mocked chemical optimization comparison.
- Includes light- and dark-theme comparison plots.
| File | Description |
|---|---|
| examples/LLM/llm_recommender.py | Demonstrates LLM and hybrid recommendation strategies. |
| examples/LLM/llm_recommender_sonnet_5_light.svg | Adds the light-theme Sonnet 5 comparison plot. |
| examples/LLM/llm_recommender_sonnet_5_dark.svg | Adds the dark-theme Sonnet 5 comparison plot. |
| examples/LLM/LLM_Header.md | Introduces the LLM examples category. |
| docs/components/recommenders.md | Explains LLM recommender configuration and behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| # ## Settings | ||
|
|
||
| N_DOE_ITERATIONS = 3 |
|
|
||
| def _mock_query_model(self, prompt): | ||
| """Return a JSON string with randomly sampled candidates.""" | ||
| batch = searchspace.discrete.exp_rep.sample(BATCH_SIZE) |
| # In practice, replace ``"test/model"`` with a real LiteLLM model identifier such as | ||
| # ``"anthropic/claude-sonnet-4-6"`` and ensure the corresponding API key is set. |
| BayBE makes a single automatic recovery attempt by re-sending the full context | ||
| along with a description of what went wrong. | ||
|
|
||
| ### Enriching recommendations with natural language |
There was a problem hiding this comment.
please use telegraph style for all headings
| solvent = SubstanceParameter( | ||
| "Solvent", | ||
| data={"DMAc": "CC(N(C)C)=O", "p-Xylene": "CC1=CC=C(C)C=C1"}, | ||
| encoding="MORDRED", |
There was a problem hiding this comment.
| encoding="MORDRED", |
(isnt needed for this example, save space, reduce complexity)
|
|
||
| ### Limitations | ||
|
|
||
| {class}`~baybe.recommenders.pure.llm.llm.LLMRecommender` does not support |
There was a problem hiding this comment.
needs to be reworded so be more robust to changes int he future. For instance Doesnt support [insert property that describes whats not supported], for instance CustomTransformation...
| ) | ||
| ~~~ | ||
|
|
||
| ### Limitations |
There was a problem hiding this comment.
use admonition, like eg here https://avhopp.github.io/baybe_dev/latest/components/constraints.html#discretebatchconstraint
| @@ -0,0 +1,3 @@ | |||
| # Large Language Models | |||
There was a problem hiding this comment.
im not evens ure this example is reuqired? what additional thing does it teach compared to the instructions in the user guide? (also consisering the difficulties in executing this and the need for mocking etc)


This PR adds an example for the LLMRecommender as well as some explanation in the recommender user guide.
The exact design of the example, and in particular how to deal with the fact that we cannot load a real LLM but would probably like to display real results is something we probably still need to discussed.
Compiled version of documentation:
Stack created with GitHub Stacks CLI • Give Feedback 💬