mantisdk 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mantisdk might be problematic. Click here for more details.

Files changed (190) hide show
  1. mantisdk/__init__.py +22 -0
  2. mantisdk/adapter/__init__.py +15 -0
  3. mantisdk/adapter/base.py +94 -0
  4. mantisdk/adapter/messages.py +270 -0
  5. mantisdk/adapter/triplet.py +1028 -0
  6. mantisdk/algorithm/__init__.py +39 -0
  7. mantisdk/algorithm/apo/__init__.py +5 -0
  8. mantisdk/algorithm/apo/apo.py +889 -0
  9. mantisdk/algorithm/apo/prompts/apply_edit_variant01.poml +22 -0
  10. mantisdk/algorithm/apo/prompts/apply_edit_variant02.poml +18 -0
  11. mantisdk/algorithm/apo/prompts/text_gradient_variant01.poml +18 -0
  12. mantisdk/algorithm/apo/prompts/text_gradient_variant02.poml +16 -0
  13. mantisdk/algorithm/apo/prompts/text_gradient_variant03.poml +107 -0
  14. mantisdk/algorithm/base.py +162 -0
  15. mantisdk/algorithm/decorator.py +264 -0
  16. mantisdk/algorithm/fast.py +250 -0
  17. mantisdk/algorithm/gepa/__init__.py +59 -0
  18. mantisdk/algorithm/gepa/adapter.py +459 -0
  19. mantisdk/algorithm/gepa/gepa.py +364 -0
  20. mantisdk/algorithm/gepa/lib/__init__.py +18 -0
  21. mantisdk/algorithm/gepa/lib/adapters/README.md +12 -0
  22. mantisdk/algorithm/gepa/lib/adapters/__init__.py +0 -0
  23. mantisdk/algorithm/gepa/lib/adapters/anymaths_adapter/README.md +341 -0
  24. mantisdk/algorithm/gepa/lib/adapters/anymaths_adapter/__init__.py +1 -0
  25. mantisdk/algorithm/gepa/lib/adapters/anymaths_adapter/anymaths_adapter.py +174 -0
  26. mantisdk/algorithm/gepa/lib/adapters/anymaths_adapter/requirements.txt +1 -0
  27. mantisdk/algorithm/gepa/lib/adapters/default_adapter/README.md +0 -0
  28. mantisdk/algorithm/gepa/lib/adapters/default_adapter/__init__.py +0 -0
  29. mantisdk/algorithm/gepa/lib/adapters/default_adapter/default_adapter.py +209 -0
  30. mantisdk/algorithm/gepa/lib/adapters/dspy_adapter/README.md +7 -0
  31. mantisdk/algorithm/gepa/lib/adapters/dspy_adapter/__init__.py +0 -0
  32. mantisdk/algorithm/gepa/lib/adapters/dspy_adapter/dspy_adapter.py +307 -0
  33. mantisdk/algorithm/gepa/lib/adapters/dspy_full_program_adapter/README.md +99 -0
  34. mantisdk/algorithm/gepa/lib/adapters/dspy_full_program_adapter/dspy_program_proposal_signature.py +137 -0
  35. mantisdk/algorithm/gepa/lib/adapters/dspy_full_program_adapter/full_program_adapter.py +266 -0
  36. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/GEPA_RAG.md +621 -0
  37. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/__init__.py +56 -0
  38. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/evaluation_metrics.py +226 -0
  39. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/generic_rag_adapter.py +496 -0
  40. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/rag_pipeline.py +238 -0
  41. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_store_interface.py +212 -0
  42. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/__init__.py +2 -0
  43. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/chroma_store.py +196 -0
  44. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/lancedb_store.py +422 -0
  45. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/milvus_store.py +409 -0
  46. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/qdrant_store.py +368 -0
  47. mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/weaviate_store.py +418 -0
  48. mantisdk/algorithm/gepa/lib/adapters/mcp_adapter/README.md +552 -0
  49. mantisdk/algorithm/gepa/lib/adapters/mcp_adapter/__init__.py +37 -0
  50. mantisdk/algorithm/gepa/lib/adapters/mcp_adapter/mcp_adapter.py +705 -0
  51. mantisdk/algorithm/gepa/lib/adapters/mcp_adapter/mcp_client.py +364 -0
  52. mantisdk/algorithm/gepa/lib/adapters/terminal_bench_adapter/README.md +9 -0
  53. mantisdk/algorithm/gepa/lib/adapters/terminal_bench_adapter/__init__.py +0 -0
  54. mantisdk/algorithm/gepa/lib/adapters/terminal_bench_adapter/terminal_bench_adapter.py +217 -0
  55. mantisdk/algorithm/gepa/lib/api.py +375 -0
  56. mantisdk/algorithm/gepa/lib/core/__init__.py +0 -0
  57. mantisdk/algorithm/gepa/lib/core/adapter.py +180 -0
  58. mantisdk/algorithm/gepa/lib/core/data_loader.py +74 -0
  59. mantisdk/algorithm/gepa/lib/core/engine.py +356 -0
  60. mantisdk/algorithm/gepa/lib/core/result.py +233 -0
  61. mantisdk/algorithm/gepa/lib/core/state.py +636 -0
  62. mantisdk/algorithm/gepa/lib/examples/__init__.py +0 -0
  63. mantisdk/algorithm/gepa/lib/examples/aime.py +24 -0
  64. mantisdk/algorithm/gepa/lib/examples/anymaths-bench/eval_default.py +111 -0
  65. mantisdk/algorithm/gepa/lib/examples/anymaths-bench/prompt-templates/instruction_prompt.txt +9 -0
  66. mantisdk/algorithm/gepa/lib/examples/anymaths-bench/prompt-templates/optimal_prompt.txt +24 -0
  67. mantisdk/algorithm/gepa/lib/examples/anymaths-bench/train_anymaths.py +177 -0
  68. mantisdk/algorithm/gepa/lib/examples/dspy_full_program_evolution/arc_agi.ipynb +25705 -0
  69. mantisdk/algorithm/gepa/lib/examples/dspy_full_program_evolution/example.ipynb +348 -0
  70. mantisdk/algorithm/gepa/lib/examples/mcp_adapter/__init__.py +4 -0
  71. mantisdk/algorithm/gepa/lib/examples/mcp_adapter/mcp_optimization_example.py +455 -0
  72. mantisdk/algorithm/gepa/lib/examples/rag_adapter/RAG_GUIDE.md +613 -0
  73. mantisdk/algorithm/gepa/lib/examples/rag_adapter/__init__.py +9 -0
  74. mantisdk/algorithm/gepa/lib/examples/rag_adapter/rag_optimization.py +824 -0
  75. mantisdk/algorithm/gepa/lib/examples/rag_adapter/requirements-rag.txt +29 -0
  76. mantisdk/algorithm/gepa/lib/examples/terminal-bench/prompt-templates/instruction_prompt.txt +16 -0
  77. mantisdk/algorithm/gepa/lib/examples/terminal-bench/prompt-templates/terminus.txt +9 -0
  78. mantisdk/algorithm/gepa/lib/examples/terminal-bench/train_terminus.py +161 -0
  79. mantisdk/algorithm/gepa/lib/gepa_utils.py +117 -0
  80. mantisdk/algorithm/gepa/lib/logging/__init__.py +0 -0
  81. mantisdk/algorithm/gepa/lib/logging/experiment_tracker.py +187 -0
  82. mantisdk/algorithm/gepa/lib/logging/logger.py +75 -0
  83. mantisdk/algorithm/gepa/lib/logging/utils.py +103 -0
  84. mantisdk/algorithm/gepa/lib/proposer/__init__.py +0 -0
  85. mantisdk/algorithm/gepa/lib/proposer/base.py +31 -0
  86. mantisdk/algorithm/gepa/lib/proposer/merge.py +357 -0
  87. mantisdk/algorithm/gepa/lib/proposer/reflective_mutation/__init__.py +0 -0
  88. mantisdk/algorithm/gepa/lib/proposer/reflective_mutation/base.py +49 -0
  89. mantisdk/algorithm/gepa/lib/proposer/reflective_mutation/reflective_mutation.py +176 -0
  90. mantisdk/algorithm/gepa/lib/py.typed +0 -0
  91. mantisdk/algorithm/gepa/lib/strategies/__init__.py +0 -0
  92. mantisdk/algorithm/gepa/lib/strategies/batch_sampler.py +77 -0
  93. mantisdk/algorithm/gepa/lib/strategies/candidate_selector.py +50 -0
  94. mantisdk/algorithm/gepa/lib/strategies/component_selector.py +36 -0
  95. mantisdk/algorithm/gepa/lib/strategies/eval_policy.py +64 -0
  96. mantisdk/algorithm/gepa/lib/strategies/instruction_proposal.py +127 -0
  97. mantisdk/algorithm/gepa/lib/utils/__init__.py +10 -0
  98. mantisdk/algorithm/gepa/lib/utils/stop_condition.py +196 -0
  99. mantisdk/algorithm/gepa/tracing.py +105 -0
  100. mantisdk/algorithm/utils.py +177 -0
  101. mantisdk/algorithm/verl/__init__.py +5 -0
  102. mantisdk/algorithm/verl/interface.py +202 -0
  103. mantisdk/cli/__init__.py +56 -0
  104. mantisdk/cli/prometheus.py +115 -0
  105. mantisdk/cli/store.py +131 -0
  106. mantisdk/cli/vllm.py +29 -0
  107. mantisdk/client.py +408 -0
  108. mantisdk/config.py +348 -0
  109. mantisdk/emitter/__init__.py +43 -0
  110. mantisdk/emitter/annotation.py +370 -0
  111. mantisdk/emitter/exception.py +54 -0
  112. mantisdk/emitter/message.py +61 -0
  113. mantisdk/emitter/object.py +117 -0
  114. mantisdk/emitter/reward.py +320 -0
  115. mantisdk/env_var.py +156 -0
  116. mantisdk/execution/__init__.py +15 -0
  117. mantisdk/execution/base.py +64 -0
  118. mantisdk/execution/client_server.py +443 -0
  119. mantisdk/execution/events.py +69 -0
  120. mantisdk/execution/inter_process.py +16 -0
  121. mantisdk/execution/shared_memory.py +282 -0
  122. mantisdk/instrumentation/__init__.py +119 -0
  123. mantisdk/instrumentation/agentops.py +314 -0
  124. mantisdk/instrumentation/agentops_langchain.py +45 -0
  125. mantisdk/instrumentation/litellm.py +83 -0
  126. mantisdk/instrumentation/vllm.py +81 -0
  127. mantisdk/instrumentation/weave.py +500 -0
  128. mantisdk/litagent/__init__.py +11 -0
  129. mantisdk/litagent/decorator.py +536 -0
  130. mantisdk/litagent/litagent.py +252 -0
  131. mantisdk/llm_proxy.py +1890 -0
  132. mantisdk/logging.py +370 -0
  133. mantisdk/reward.py +7 -0
  134. mantisdk/runner/__init__.py +11 -0
  135. mantisdk/runner/agent.py +845 -0
  136. mantisdk/runner/base.py +182 -0
  137. mantisdk/runner/legacy.py +309 -0
  138. mantisdk/semconv.py +170 -0
  139. mantisdk/server.py +401 -0
  140. mantisdk/store/__init__.py +23 -0
  141. mantisdk/store/base.py +897 -0
  142. mantisdk/store/client_server.py +2092 -0
  143. mantisdk/store/collection/__init__.py +30 -0
  144. mantisdk/store/collection/base.py +587 -0
  145. mantisdk/store/collection/memory.py +970 -0
  146. mantisdk/store/collection/mongo.py +1412 -0
  147. mantisdk/store/collection_based.py +1823 -0
  148. mantisdk/store/insight.py +648 -0
  149. mantisdk/store/listener.py +58 -0
  150. mantisdk/store/memory.py +396 -0
  151. mantisdk/store/mongo.py +165 -0
  152. mantisdk/store/sqlite.py +3 -0
  153. mantisdk/store/threading.py +357 -0
  154. mantisdk/store/utils.py +142 -0
  155. mantisdk/tracer/__init__.py +16 -0
  156. mantisdk/tracer/agentops.py +242 -0
  157. mantisdk/tracer/base.py +287 -0
  158. mantisdk/tracer/dummy.py +106 -0
  159. mantisdk/tracer/otel.py +555 -0
  160. mantisdk/tracer/weave.py +677 -0
  161. mantisdk/trainer/__init__.py +6 -0
  162. mantisdk/trainer/init_utils.py +263 -0
  163. mantisdk/trainer/legacy.py +367 -0
  164. mantisdk/trainer/registry.py +12 -0
  165. mantisdk/trainer/trainer.py +618 -0
  166. mantisdk/types/__init__.py +6 -0
  167. mantisdk/types/core.py +553 -0
  168. mantisdk/types/resources.py +204 -0
  169. mantisdk/types/tracer.py +515 -0
  170. mantisdk/types/tracing.py +218 -0
  171. mantisdk/utils/__init__.py +1 -0
  172. mantisdk/utils/id.py +18 -0
  173. mantisdk/utils/metrics.py +1025 -0
  174. mantisdk/utils/otel.py +578 -0
  175. mantisdk/utils/otlp.py +536 -0
  176. mantisdk/utils/server_launcher.py +1045 -0
  177. mantisdk/utils/system_snapshot.py +81 -0
  178. mantisdk/verl/__init__.py +8 -0
  179. mantisdk/verl/__main__.py +6 -0
  180. mantisdk/verl/async_server.py +46 -0
  181. mantisdk/verl/config.yaml +27 -0
  182. mantisdk/verl/daemon.py +1154 -0
  183. mantisdk/verl/dataset.py +44 -0
  184. mantisdk/verl/entrypoint.py +248 -0
  185. mantisdk/verl/trainer.py +549 -0
  186. mantisdk-0.1.0.dist-info/METADATA +119 -0
  187. mantisdk-0.1.0.dist-info/RECORD +190 -0
  188. mantisdk-0.1.0.dist-info/WHEEL +4 -0
  189. mantisdk-0.1.0.dist-info/entry_points.txt +2 -0
  190. mantisdk-0.1.0.dist-info/licenses/LICENSE +19 -0
@@ -0,0 +1,341 @@
1
+ # ⭐ AnyMaths: GEPA Adapter for Solving Math Word Problems ⭐
2
+ **AnyMaths Adapter** is a GEPA Adapter for any dataset that contains math word problems of varying complexity and structure. It is designed to handle a wide range of mathematical tasks, including arithmetic, algebra, reasoning, and more.
3
+
4
+ ---
5
+
6
+ ### 📢 Auxiliary requirements
7
+ Some auxiliary requirements for using the AnyMaths Adapter are found in `src/gepa/adapters/anymaths_adapter/requirements.txt`. Simply install the required packages listed in that file via:
8
+ * If using `uv`:
9
+ ```bash
10
+ uv pip install -r src/gepa/adapters/anymaths_adapter/requirements.txt
11
+ ```
12
+ * If using `pip`:
13
+ ```bash
14
+ pip install -r src/gepa/adapters/anymaths_adapter/requirements.txt
15
+ ```
16
+
17
+ ### ✍️ Preparing the dataset
18
+ In `src/gepa/examples/anymaths-bench/train_anymaths.py`, a sample function to prepare a dataset is provided via `init_dataset`. This function demonstrates how to load and preprocess the dataset for training and evaluation. Notably, it includes steps for data augmentation and splitting the dataset into training, validation, and test sets. We recommend to find and download datasets from [Hugging Face dataset hub](https://huggingface.co/datasets).
19
+
20
+ #### Best format for a custom dataset
21
+ If you have a custom dataset, it is best to follow the following schema:
22
+ ```
23
+ {
24
+ "question": ...,
25
+ "solution": ...,
26
+ "answer": ...
27
+ }
28
+ ```
29
+ Remarks:
30
+ - `question` must be a string/text.
31
+ - `solution` must be a string/text.
32
+ - `answer` must be a purely numerical, no other text or units associated.
33
+
34
+ We recommend you to upload your custom dataset to the Hugging Face dataset hub to fully utilize `datasets.load_dataset`.
35
+
36
+ ---
37
+
38
+ ### 🧰 Adapter Design
39
+ The AnyMaths Adapter can work for any LiteLLM supported providers (e.g., OpenAI, Google Vertex, HuggingFace, Groq, vLLM, Ollama, etc.). For this instance, we opt to choose Ollama to show that **this adapter can work for local use if one has no access to expensive GPUs or paid APIs.** But, you may freely choose this adapter with any other LiteLLM-supported provider.
40
+
41
+ ---
42
+
43
+ ### ✍️ Preparing the seed prompt
44
+ The seed prompt is the initial instruction you provide to the base (target) model. It sets the context for the task at hand and this prompt evolves or changes over time toward maximizing the model's performance. The default failure score (i.e., score if the model outputs are incorrect or does not satisfy a set metric) is zero.
45
+
46
+ Set the seed prompt in a separate directory under `src/gepa/examples/anymaths-bench/prompt-templates`. Inside this directory is a file `instruction_prompt.txt` which contains the seed prompt.
47
+
48
+ ---
49
+
50
+ ### 🪞 Specifying the reflection LM
51
+ The reflection LM is a language model used to generate feedback based on the output by the base model. You can specify the reflection LM by setting the `reflection_lm` argument when calling the `gepa.optimize` function.
52
+
53
+ A sample `reflection_lm` function call can be found in `src/gepa/examples/anymaths-bench/train_anymaths.py`.
54
+
55
+ ---
56
+
57
+ ### 🏃‍♂️ Running a full AnyMaths Adapter training
58
+ To run a full training session using the AnyMaths Adapter, you can use the following command:
59
+ ```bash
60
+ python src/gepa/examples/anymaths-bench/train_anymaths.py --anymaths_dset_name ... --train_size ... --val_size ... --test_size ... --base_lm ... --use_api_base --api_base_url ... --reflection_lm ... --use_api_reflection --api_reflection_url ... --reflection_minibatch_size ... --budget ... --max_litellm_workers ... --seed ...
61
+ ```
62
+ - `--anymaths_dset_name`: The Hugging Face `Dataset` name to use for training (e.g., `"openai/gsm8k"`, `"MathArena/aime_2025"`).
63
+ - `--train_size`: The size of the training set to use.
64
+ - `--val_size`: The size of the validation set to use.
65
+ - `--test_size`: The size of the test set to use.
66
+ - `--base_lm`: The base language model to use for GEPA training (e.g. `"ollama/qwen3:4b"`).
67
+ - `--use_api_base`: Enable this flag if you want to use the Ollama API for the base model. Otherwise, do not include this in your arguments if you are using provider APIs (e.g., OpenAI, Google Vertex, etc.).
68
+ - `--api_base_url`: (Base model) The URL to get completions for the base model. Example: Ollama uses the default `http://localhost:11434`. There is no need to set this up if you are using provider APIs. **Note: API keys and provider credentials must be set beforehand.**
69
+ - `--reflection_lm`: The reflection language model to generate feedback from base model outputs (e.g., `"ollama/qwen3:8b"`).
70
+ - `--use_api_reflection`: Similar with `--use_api_base`. Enable this flag if you want to use a specific endpoint to get completions from the reflection model.
71
+ - `--reflection_minibatch_size`: The minibatch size for the reflection LM to reflect against (default is 8).
72
+ - `--max_litellm_workers`: The maximum number of LiteLLM workers to use.
73
+ - `--budget`: The budget for the GEPA training (default is 500).
74
+ - `--seed`: The seed for the random number generator for reproducibility (default is 0).
75
+
76
+ #### 📓 Training command examples
77
+
78
+ 1. (Purely) **Using Ollama**:
79
+ ```bash
80
+ python src/gepa/examples/anymaths-bench/train_anymaths.py --anymaths_dset_name "openai/gsm8k" --train_size 50 --val_size 50 --test_size 50 --base_lm "ollama/qwen3:4b" --use_api_base --api_base_url "http://localhost:11434" --reflection_lm "ollama/qwen3:8b" --use_api_reflection --api_reflection_url "http://localhost:11434" --reflection_minibatch_size 8 --budget 500 --max_litellm_workers 4 --seed 0
81
+ ```
82
+ 2. (Purely) **Using Google Vertex** for Gemini users:
83
+ ```bash
84
+ python src/gepa/examples/anymaths-bench/train_anymaths.py --anymaths_dset_name "openai/gsm8k" --train_size 50 --val_size 50 --test_size 50 --base_lm "vertex_ai/gemini-2.5-flash-lite" --reflection_lm "vertex_ai/gemini-2.5-flash" --reflection_minibatch_size 8 --budget 500 --max_litellm_workers 4 --seed 0
85
+ ```
86
+ 3. **Using Google Vertex as base (target) LM, Ollama as reflection LM**:
87
+ ```bash
88
+ python src/gepa/examples/anymaths-bench/train_anymaths.py --anymaths_dset_name "openai/gsm8k" --train_size 50 --val_size 50 --test_size 50 --base_lm "vertex_ai/gemini-2.5-flash-lite" --reflection_lm "ollama/qwen3:8b" --use_api_reflection --api_reflection_url "http://localhost:11434" --reflection_minibatch_size 8 --budget 500 --max_litellm_workers 4 --seed 0
89
+ ```
90
+ 4. **Using Ollama as base (target) LM, Google Vertex as reflection LM**:
91
+ ```bash
92
+ python src/gepa/examples/anymaths-bench/train_anymaths.py --anymaths_dset_name "openai/gsm8k" --train_size 50 --val_size 50 --test_size 50 --base_lm "ollama/qwen3:4b" --use_api_base --api_base_url "http://localhost:11434" --reflection_lm "vertex_ai/gemini-2.5-flash" --reflection_minibatch_size 8 --budget 500 --max_litellm_workers 4 --seed 0
93
+ ```
94
+
95
+ Once the training has completed, you may replace the optimal prompt found in `src/gepa/examples/anymaths-bench/prompt-templates/optimal_prompt.txt`.
96
+
97
+ ---
98
+
99
+ ### 🔬 Model evaluation after GEPA training
100
+ `src/gepa/examples/anymaths-bench/eval_default.py` is used to perform model evaluation on the test split. Feel free to modify this script to fit your custom evaluation scheme. Example: `"openai/gsm8k"` - `test` is the dataset split used for benchmarking. The evaluation scores will be displayed in the terminal once the evaluation has been completed.
101
+
102
+ How to run the evaluation script:
103
+ 1. **Using Ollama**:
104
+ ```bash
105
+ python src/gepa/examples/anymaths-bench/eval_default.py --anymaths_dset_name "openai/gsm8k" --model "ollama/qwen3:4b" --use_api_url --api_url "http://localhost:11434" --batch_size 8 --max_litellm_workers 4 --which_prompt "seed"
106
+ ```
107
+ 2. **Use Google Vertex** for Gemini users:
108
+ ```bash
109
+ python src/gepa/examples/anymaths-bench/eval_default.py --anymaths_dset_name "openai/gsm8k" --model "vertex_ai/gemini-2.5-flash-lite" --batch_size 8 --max_litellm_workers 4 --which_prompt "seed"
110
+ ```
111
+ - `--anymaths_dset_name`: The name of the AnyMaths dataset to use for evaluation (default is `"openai/gsm8k"`).
112
+ - `--model`: The model to evaluate (default is `"ollama/qwen3:4b"`).
113
+ - `--use_api_url`: Whether to use the API URL (default is `False`).
114
+ - `--api_url`: The API URL to use (default is `"http://localhost:11434"`).
115
+ - `--batch_size`: The batch size for evaluation (default is `8`).
116
+ - `--max_litellm_workers`: The maximum number of LiteLLM workers to use (default is `4`).
117
+ - `--which_prompt`: The prompt to use for evaluation (default is `"seed"`, choices are `"seed"` and `"optimized"`).
118
+
119
+ **Note: The model that was used in GEPA training must also be the same model in performing model evaluation.**
120
+
121
+ ---
122
+
123
+ ### 🧪 Experiments
124
+ | Dataset | Base LM | Reflection LM | Accuracy, % (Before GEPA) $\uparrow$ | Accuracy, % (After GEPA) $\uparrow$ | GEPA Budget | Train-Val-Test Split Samples Used in GEPA Optimization |
125
+ | ------- | ------- | ------------- | ---------------------- | --------------------- | ------------ | ------ |
126
+ | `"openai/gsm8k"` | `"ollama/qwen3:4b"` | `"ollama/qwen3:8b"` | 18 | 23 (**+5**) | 500 | 50-50-50 |
127
+ | `"openai/gsm8k"` | `"vertex_ai/gemini-2.5-flash-lite"` | `"vertex_ai/gemini-2.5-flash"` | 31 | 33 (**+2**) | 500 | 50-50-50 |
128
+ | `"openai/gsm8k"` | `"ollama/qwen3:0.6b"` | `"ollama/qwen3:8b"` | 7 | 5 (**-2**) | 500 | 50-50-50 |
129
+ | `"openai/gsm8k"` | `"ollama/gemma3:1b"` | `"ollama/gemma3:4b"` | 9 | 38 (**+29**) | 500 | 50-50-50 |
130
+
131
+ **Notice of WIP**: More tests will be done soon on other models (preferrably, small language models first).
132
+
133
+ ---
134
+
135
+ ### 🏦 Prompt bank of optimal prompts
136
+
137
+ * Model: `"ollama/qwen3:4b"`, Dataset: `"openai/gsm8k"`, Budget: `500`:
138
+ ```
139
+ ### Task Instruction: Solve Multi-Step Mathematical Problems with Precision and Contextual Understanding
140
+
141
+ You are tasked with solving problems that require careful parsing of contextual information, breaking down multi-step calculations, and ensuring accuracy in arithmetic and logical reasoning. Follow these steps to address diverse problem types (e.g., percentages, cost calculations, score determination, and distance computations):
142
+
143
+ ---
144
+
145
+ #### **1. Parse the Problem**
146
+ - **Identify Key Values**: Extract numbers, percentages, fractions, and relationships (e.g., "40% of 60 students," "6 more than half of Ella\'s score").
147
+ - **Understand Relationships**: Determine if values are additive, multiplicative, or comparative (e.g., "round trips" imply doubling one-way distances, "cost per item" requires multiplication).
148
+ - **Clarify Ambiguities**: Resolve unclear phrasing (e.g., "half the score" refers to half the total items, not half the incorrect answers).
149
+
150
+ ---
151
+
152
+ #### **2. Break Down the Problem**
153
+ - **Segment into Steps**: Divide the problem into smaller, manageable parts (e.g., calculate individual components before summing).
154
+ - **Apply Formulas**: Use appropriate mathematical operations (e.g., percentage = part/whole × 100, total cost = (item count × price)).
155
+ - **Account for Context**: Adjust calculations based on problem specifics (e.g., "round trip" requires doubling one-way distance, "score" may involve subtracting incorrect answers from total items).
156
+
157
+ ---
158
+
159
+ #### **3. Perform Calculations**
160
+ - **Use Precise Arithmetic**:
161
+ - For percentages: $ \\text{Percentage} \\times \\text{Total} $.
162
+ - For fractions: $ \\frac{\\text{Numerator}}{\\text{Denominator}} \\times \\text{Value} $.
163
+ - For multi-step operations: Follow order of operations (PEMDAS) and verify intermediate results.
164
+ - **Avoid Common Errors**:
165
+ - Misinterpreting phrases like "half the score" (e.g., half of total items, not half of incorrect answers).
166
+ - Confusing "round trips" (up + down) with single trips.
167
+ - Incorrectly applying percentages to the wrong base (e.g., 40% of students vs. 40% of total score).
168
+
169
+ ---
170
+
171
+ #### **4. Validate the Answer**
172
+ - **Check Logical Consistency**: Ensure results align with problem constraints (e.g., total students = sum of groups, total cost = sum of individual costs).
173
+ - **Verify Units and Formatting**: Confirm answers match required formats (e.g., boxed numbers, currency symbols, or percentage notation).
174
+ - **Cross-Validate with Examples**: Compare calculations against similar problems (e.g., "If 40% of 60 students = 24, then 60 - 24 = 36").
175
+
176
+ ---
177
+
178
+ #### **5. Finalize the Response**
179
+ - **Present the Answer Clearly**: Use the exact format requested (e.g., `\boxed{36}` for numerical answers, `$77.00` for currency).
180
+ - **Include Step-by-Step Reasoning**: Explicitly show calculations (e.g., `18 * $2.50 = $45.00`, `8 * $4.00 = $32.00`).
181
+ - **Highlight Key Decisions**: Note critical choices (e.g., "Half of Ella's score = 36 items / 2 = 18 items").
182
+
183
+ ---
184
+
185
+ ### **Examples of Problem Types**
186
+ 1. **Percentage Problems**:
187
+ - *Input*: "40% of 60 students got below B."
188
+ - *Solution*: $ 0.40 \\times 60 = 24 $, $ 60 - 24 = 36 $.
189
+ 2. **Cost Calculations**:
190
+ - *Input*: "18 knobs at $2.50 each and 8 pulls at $4.00 each."
191
+ - *Solution*: $ 18 \\times 2.50 + 8 \\times 4.00 = 45 + 32 = 77 $.
192
+ 3. **Score Determination**:
193
+ - *Input*: "Ella got 4 incorrect answers; Marion got 6 more than half of Ella's score."
194
+ - *Solution*: Total items = 40, Ella's correct = 36, half = 18, Marion = 18 + 6 = 24.
195
+
196
+ ---
197
+
198
+ ### **Key Niche Information**
199
+ - **Percentages**: Always apply to the total (e.g., 40% of 60 students = 24 students, not 40% of 40 items).
200
+ - **Round Trips**: Double one-way distances (e.g., 30,000 feet up + 30,000 feet down = 60,000 per trip).
201
+ - **Score Calculations**: Subtract incorrect answers from total items (e.g., 40 items - 4 incorrect = 36 correct).
202
+ - **Currency Formatting**: Use decimal points and symbols (e.g., `$77.00`, not `77`).
203
+
204
+ ---
205
+
206
+ ### **Final Output Format**
207
+ Always conclude with:
208
+ `Final Answer: \boxed{<result>}`
209
+ For non-numeric answers, use:
210
+ `Final Answer: <result>`
211
+
212
+ Ensure calculations are explicitly shown and errors are corrected based on problem context.
213
+ ```
214
+ * Model: `"vertex_ai/gemini-2.5-flash-lite"`, Dataset: `"openai/gsm8k"`, Budget: `500`:
215
+ ```
216
+ You are an AI assistant that solves mathematical word problems. You will be given a question and you need to provide a step-by-step solution to the problem. Finally, you will provide the answer to the question.
217
+
218
+ When outputting the final answer, make sure there are no other text or explanations included, just the answer itself.
219
+
220
+ The following fields are what you need to include in your response:
221
+ - final_answer: The final answer to the question.
222
+ - solution_pad: The step-by-step solution to the problem.
223
+
224
+ Here are specific guidelines for generating your response:
225
+
226
+ 1. **Understand the Problem Thoroughly:** Carefully read and analyze the word problem to ensure a complete understanding of all given information, constraints, and the specific question being asked. Pay close attention to units and how different quantities relate to each other.
227
+
228
+ 2. **Formulate the Step-by-Step Solution (solution_pad):**
229
+ * Develop a clear, logical, and sequential step-by-step solution. Each step should be a distinct operation or deduction required to move closer to the final answer.
230
+ * Clearly state what is being calculated or determined in each step.
231
+ * Perform all necessary calculations with high precision and accuracy. Double-check all numerical operations (addition, subtraction, multiplication, division, etc.) to prevent errors.
232
+ * If the problem involves converting between different forms of a quantity (e.g., converting a monetary value into a count of items, or time units), explicitly show this conversion as a step.
233
+ * **Domain-Specific Interpretation Example:** If Barry has "$10.00 worth of dimes", first convert this value to the number of dimes (since a dime is $0.10, Barry has $10.00 / $0.10 = 100 dimes). If the problem then states Dan has "half that amount" and asks for the number of dimes Dan has, interpret "half that amount" as half the *number* of dimes Barry has (100 dimes / 2 = 50 dimes), rather than half the monetary value. Always aim for the most logical interpretation that leads to the requested unit in the final answer.
234
+ * The `solution_pad` field must *only* contain the clean, direct step-by-step solution. Do not include any internal monologues, self-corrections, re-evaluations, alternative thought processes, or debugging notes within this field.
235
+
236
+ 3. **Calculate and Output the Final Answer:**
237
+ * Based on your thoroughly computed step-by-step solution, determine the exact numerical answer to the question.
238
+ * The `final_answer` field must contain *only* the numerical value. Do not include any currency symbols (e.g., "$"), units (e.g., "dimes", "hours"), or any other descriptive text or explanation in this field. For example, if the answer is 4625 dollars, output `4625`. If the answer is 52 dimes, output `52`.
239
+ * Ensure the final answer numerically matches the result of your `solution_pad` calculations.'
240
+ ```
241
+ * Model: `"ollama/qwen3:0.6b"`, Dataset: `"openai/gsm8k"`, Budget: `500`:
242
+ ```
243
+ ### Instruction for Solving Math Word Problems
244
+
245
+ **Task Description:**
246
+ Solve multi-step math word problems by carefully analyzing the relationships between quantities, translating them into mathematical expressions, and performing accurate calculations. Ensure all components of the problem are addressed, and verify that percentages, fractions, and arithmetic operations are applied correctly.
247
+
248
+ **Key Requirements:**
249
+ 1. **Parse Relationships:**
250
+ - Identify explicit and implicit relationships (e.g., "20 fewer than," "1/10 less," "10 more than").
251
+ - Define variables clearly (e.g., let Arts = x, then Maths = x - 20).
252
+
253
+ 2. **Translate to Equations:**
254
+ - Convert word-based relationships into algebraic expressions or equations.
255
+ - For percentage changes, apply the correct formula (e.g., "1/10 less" means 90% of the original value).
256
+
257
+ 3. **Account for All Components:**
258
+ - Ensure all subjects, quantities, or data points mentioned in the problem are included in the final calculation.
259
+ - Aggregate totals by summing individual values (e.g., total marks = sum of all subject scores).
260
+
261
+ 4. **Verify Arithmetic and Logic:**
262
+ - Check for arithmetic errors (e.g., 1/10 of 70 = 7, not 70 - 7 = 63).
263
+ - Validate that the solution aligns with the problem’s constraints (e.g., no negative scores unless explicitly allowed).
264
+
265
+ 5. **Document Step-by-Step Reasoning:**
266
+ - Break down the problem into logical steps, explicitly showing calculations (e.g., total birds = sum of daily totals).
267
+ - Use parentheses and order of operations to avoid errors (e.g., 5 sites × 7 birds/site = 35 birds).
268
+
269
+ 6. **Final Answer Validation:**
270
+ - Ensure the final answer matches the problem’s question (e.g., total marks, average per site, or time difference).
271
+ - Recheck all steps to confirm consistency with the problem’s context.
272
+
273
+ **Example Application:**
274
+ For a problem like:
275
+ *"Amaya scored 20 fewer in Maths than Arts. She scored 10 more in Social Studies than Music. If she scored 70 in Music and 1/10 less in Maths, what is the total marks?"*
276
+ - Define variables: Arts = x, Maths = x - 20, Social Studies = 70 + 10 = 80.
277
+ - Calculate Maths: 1/10 less than Arts → Maths = x - 20 = 0.9x.
278
+ - Solve for x: x - 20 = 0.9x → x = 200 (Arts), Maths = 180.
279
+ - Total marks = 70 (Music) + 180 (Maths) + 200 (Arts) + 80 (Social Studies) = **296**.
280
+
281
+ **Error Prevention:**
282
+ - Avoid misinterpreting "1/10 less" as 1/10 of the value (instead, it means 90% of the original).
283
+ - Ensure all subjects are included (e.g., Music, Maths, Arts, Social Studies in the example).
284
+ - Double-check totals by summing individual components.
285
+ ```
286
+ * Mode: `"ollama/gemma3:1b"`, Dataset: `"openai/gsm8k"`, Budget: `500`:
287
+ ```
288
+ You are a specialized assistant designed to solve complex, realistic word problems, prioritizing accuracy and detailed reasoning. Your primary goal is to meticulously determine the numerical answer while demonstrating a thorough understanding of the problem's context, constraints, and relevant domain knowledge. You will be provided with problem descriptions that often include specific units, quantities, and contextual details, aiming for scenarios mirroring real-world applications like logistics, resource management, and engineering calculations.
289
+
290
+ **Here's your process:**
291
+
292
+ 1. **Deconstruction & Contextual Understanding:** Carefully read the entire problem description. Identify *all* numerical values, units (e.g., kg, mph, minutes, dollars, meters, seconds), and relevant contextual details. Pay close attention to *all* constraints or limitations mentioned (e.g., “cannot exceed,” “up to,” “at most,” “within a tolerance of”). Crucially, identify the *assumptions* embedded within the problem – what is being taken for granted? For instance, is the problem implicitly stating that surfaces are flat, or that materials behave ideally?
293
+
294
+ 2. **Unit Analysis and Conversion:** Recognize that the problem fundamentally involves numerical calculations. However, rigorous unit conversion is paramount. Ensure
295
+ all calculations are performed with appropriate units. If units are mixed, perform conversions *accurately*. Specifically, you must be able to handle conversions between common units: kilograms (kg), miles per hour (mph), minutes, dollars, meters, seconds, Newtons (N), cubic meters (m³), and other quantities. **Important:** Weight and mass are frequently confused. Remember that weight is a force (typically measured in Newtons – N), while mass is a measure of matter (typically measured in kilograms – kg). Always consider the context when given a weight value – it *usually* implies the force due to gravity.
296
+
297
+ 3. **Strategic Approach Selection:** For most problems, a straightforward algebraic approach will be effective. Setting up equations based on the given information is usually the most efficient method. However, consider scenarios where a simpler calculation (e.g., direct multiplication or division) is sufficient. Furthermore, recognize that some problems may benefit from applying principles of physics (e.g., Newton’s Laws of Motion, conservation of energy) to derive equations.
298
+
299
+ 4. **Step-by-Step Calculation with Intermediate Results:** Clearly articulate *each* step of your calculation, showing all intermediate results. This is absolutely crucial for verification, debugging, and demonstrating your thought process. Include units with every calculation.
300
+
301
+ 5. **Final Answer with Units and Precision:** Provide the final numerical answer, *always* including the correct units. Pay attention to the level of precision required by the problem – often, rounding will be necessary.
302
+
303
+ 6. **Critical Considerations – Domain-Specific Knowledge is Key:**
304
+
305
+ * **Weight & Mass:** *Master* the distinction between weight and mass. Weight is force (N), mass is matter (kg).
306
+ * **Velocity & Distance:** Remember the relationship: distance = velocity * time. Be mindful of velocity as a vector (magnitude and direction).
307
+ * **Area & Volume:** Be proficient with basic geometric formulas (rectangles, cubes, cylinders, spheres – relevant formulas will be provided in the problem).
308
+ * **Cargo Loading:** Problems frequently involve loading crates, where the maximum weight capacity of a crate (typically 20 kg) is a critical constraint. Consider the impact of sub-optimal loading arrangements.
309
+ * **Fluid Mechanics (where applicable):** Some problems may involve fluid flow, requiring knowledge of concepts like pressure, viscosity, and flow rate.
310
+ * **Energy & Work:** Be familiar with the concepts of work, potential energy, kinetic energy, and their relationships.
311
+ * **Linear Motion:** Understand concepts such as acceleration, displacement, and average speed.
312
+ * **Rotational Motion:** When problems involve rotating objects, understanding angular velocity, angular acceleration, torque, and moment of inertia are essential.
313
+
314
+ 7. **Verification and Validation:** After arriving at a solution, briefly outline *how* you verified your answer. Did you check your units? Did you perform a sanity check (e.g., is the answer physically plausible)?
315
+
316
+ 8. **Error Handling:** If a problem is ambiguous or contains conflicting information, state your assumptions and explain how they affect your solution.
317
+ ```
318
+
319
+ ---
320
+
321
+ ### 🔍 Observations on the structure of the derived optimal prompt
322
+ - For small language models:
323
+ * Goal-oriented: The prompt starts by clearly stating the overall task, which is to solve multi-step math problems with precision.
324
+ * Chain-of-Thought: It breaks down the problem-solving process into a detailed, numbered sequence of five steps: **Parse**, **Break Down**, **Calculate**, **Validate**, and **Finalize**.
325
+ * Instruction Detail: Each step includes specific instructions on how to perform the task, such as identifying key values, applying formulas, and avoiding common errors.
326
+ * Few-shot Learning: The prompt provides concrete **examples** of different problem types (percentage, costs, scores) to show the model how to apply the instructions.
327
+ * Knowledge Base: It includes *key niche information* section that acts as a mini-rulebook, highlighting specific details and common pitfalls like "round trips" and currency formatting.
328
+ * Structured Output: The prompt ends by defining a strict **final output format** to ensure the model's answer is consistent and easy to read.
329
+ * Contextual Awareness: The prompt encourages the model to consider the broader context of the problem, including any implicit assumptions or constraints that may not be explicitly stated. Filed under *emergent* behavior.
330
+
331
+ - For provider models:
332
+ * Fewer tokens: The prompt is more concise, using fewer tokens to convey the same information, which can lead to faster processing and lower costs.
333
+ * Straightforward: Main instruction and output format are placed at the first parts of the prompt. Detailed guidelines are provided in a structured manner to facilitate understanding after the main instruction and output format.
334
+
335
+ ### ❓ Weird results and observations
336
+ - In the case of `"ollama/qwen3:0.6b"`, the score did not improve as expected with additional context. Moreover, in the optimal prompt, the specific instruction to generate the expected JSON object was removed. In a similar fashion, we can also observe this omission in the optimal prompt for `"ollama/qwen3:4b"`.
337
+
338
+ ---
339
+
340
+ ### 👨‍🔬 Contributor
341
+ This adapter was contributed by **Emmanuel G. Maminta**. [[LinkedIn]](https://linkedin.com/in/egmaminta) [[GitHub]](https://github.com/egmaminta)
@@ -0,0 +1 @@
1
+ from .anymaths_adapter import AnyMathsAdapter
@@ -0,0 +1,174 @@
1
+ from typing import Any, TypedDict
2
+
3
+ import litellm
4
+ from pydantic import BaseModel, Field
5
+
6
+ from mantisdk.algorithm.gepa.lib.core.adapter import EvaluationBatch, GEPAAdapter
7
+
8
+
9
+ class AnyMathsDataInst(TypedDict):
10
+ input: str
11
+ additional_context: dict[str, str]
12
+ answer: str
13
+
14
+
15
+ class AnyMathsTrajectory(TypedDict):
16
+ data: AnyMathsDataInst
17
+ full_assistant_response: str
18
+
19
+
20
+ class AnyMathsRolloutOutput(TypedDict):
21
+ full_assistant_response: str
22
+
23
+
24
+ class AnyMathsStructuredOutput(BaseModel):
25
+ final_answer: str = Field(
26
+ ..., description="The final answer to the mathematical problem (i.e., no units, no other text)"
27
+ )
28
+ solution_pad: str = Field(..., description="The solution pad containing the step-by-step solution to the problem.")
29
+
30
+
31
+ class AnyMathsAdapter(GEPAAdapter[AnyMathsDataInst, AnyMathsTrajectory, AnyMathsRolloutOutput]):
32
+ """AnyMaths Adapter is a GEPAAdapter for any dataset that contains mathematical word problems
33
+ of varying complexity and structure. It is designed to handle a wide range of mathematical
34
+ tasks, including arithmetic, algebra, and more.
35
+
36
+ Note: Ollama must be installed and configured to use this adapter.
37
+ """
38
+
39
+ def __init__(
40
+ self,
41
+ model: str,
42
+ failure_score: float = 0.0,
43
+ api_base: str | None = "http://localhost:11434",
44
+ max_litellm_workers: int = 10,
45
+ ) -> None:
46
+ import litellm
47
+
48
+ self.model = model
49
+ self.failure_score = failure_score
50
+ self.litellm = litellm
51
+ self.max_litellm_workers = max_litellm_workers
52
+ self.api_base = api_base
53
+
54
+ if self.model.startswith("ollama"):
55
+ assert self.api_base is not None, "API base URL must be provided when using Ollama."
56
+
57
+ if self.api_base is None or self.api_base == "":
58
+ self.api_base = None
59
+
60
+ def evaluate(
61
+ self,
62
+ batch: list[AnyMathsDataInst],
63
+ candidate: dict[str, str],
64
+ capture_traces: bool = False,
65
+ ) -> EvaluationBatch[AnyMathsTrajectory, AnyMathsRolloutOutput]:
66
+ import ast
67
+
68
+ outputs: list[AnyMathsRolloutOutput] = []
69
+ scores: list[float] = []
70
+ trajectories: list[AnyMathsTrajectory] | None = [] if capture_traces else None
71
+
72
+ if not candidate:
73
+ raise ValueError("Candidate must contain at least one component text.")
74
+
75
+ system_content = next(iter(candidate.values()))
76
+
77
+ litellm_requests = []
78
+
79
+ for data in batch:
80
+ user_content = f"{data['input']}"
81
+
82
+ messages = [
83
+ {"role": "system", "content": system_content},
84
+ {"role": "user", "content": user_content},
85
+ ]
86
+
87
+ litellm_requests.append(messages)
88
+
89
+ try:
90
+ responses = self.litellm.batch_completion(
91
+ model=self.model,
92
+ messages=litellm_requests,
93
+ api_base=self.api_base,
94
+ max_workers=self.max_litellm_workers,
95
+ format=AnyMathsStructuredOutput.model_json_schema(),
96
+ response_format={
97
+ "type": "json_object",
98
+ "response_schema": AnyMathsStructuredOutput.model_json_schema(),
99
+ "enforce_validation": True,
100
+ },
101
+ )
102
+ except litellm.exceptions.JSONSchemaValidationError as e:
103
+ raise e
104
+
105
+ for data, response in zip(batch, responses, strict=False):
106
+ correct_output_format = True
107
+ try:
108
+ assistant_response = ast.literal_eval(response.choices[0].message.content.strip())
109
+ except Exception:
110
+ assistant_response = "Assistant failed to respond with the correct answer or format."
111
+ correct_output_format = False
112
+
113
+ if correct_output_format:
114
+ structured_assistant_response = f"Assistant's Solution: {assistant_response['solution_pad']}\n"
115
+ structured_assistant_response += f"Final Answer: {assistant_response['final_answer']}"
116
+ output = {"full_assistant_response": structured_assistant_response}
117
+ score = 1.0 if data["answer"] in assistant_response["final_answer"] else self.failure_score
118
+ else:
119
+ output = {"full_assistant_response": assistant_response}
120
+ score = self.failure_score
121
+
122
+ outputs.append(output)
123
+ scores.append(score)
124
+
125
+ if capture_traces:
126
+ trajectories.append({"data": data, "full_assistant_response": output["full_assistant_response"]})
127
+ # Return results for the entire batch (not just the first item)
128
+ return EvaluationBatch(outputs=outputs, scores=scores, trajectories=trajectories)
129
+
130
+ def make_reflective_dataset(
131
+ self,
132
+ candidate: dict[str, str],
133
+ eval_batch: EvaluationBatch[AnyMathsTrajectory, AnyMathsRolloutOutput],
134
+ components_to_update: list[str],
135
+ ) -> dict[str, list[dict[str, Any]]]:
136
+ ret_d: dict[str, list[dict[str, Any]]] = {}
137
+
138
+ assert len(components_to_update) == 1
139
+ comp = components_to_update[0]
140
+
141
+ items: list[dict[str, Any]] = []
142
+ trace_instances = list(zip(eval_batch.trajectories, eval_batch.scores, eval_batch.outputs, strict=False))
143
+
144
+ for trace_instance in trace_instances:
145
+ traj, score, _ = trace_instance
146
+ data = traj["data"]
147
+ generated_outputs = traj["full_assistant_response"]
148
+
149
+ if score > 0.0:
150
+ feedback = f"The generated response is correct. The final answer is: {data['answer']}."
151
+ else:
152
+ additional_context_str = "\n".join(f"{k}: {v}" for k, v in data["additional_context"].items())
153
+ if additional_context_str:
154
+ feedback = (
155
+ f"The generated response is incorrect. The correct answer is: {data['answer']}. "
156
+ "Ensure that the correct answer is included in the response exactly as it is. "
157
+ f"Here is some additional context that might be helpful:\n{additional_context_str}"
158
+ )
159
+ else:
160
+ feedback = (
161
+ f"The generated response is incorrect. The correct answer is: {data['answer']}. "
162
+ "Ensure that the correct answer is included in the response exactly as it is."
163
+ )
164
+
165
+ d = {"Inputs": data["input"], "Generated Outputs": generated_outputs, "Feedback": feedback}
166
+
167
+ items.append(d)
168
+
169
+ ret_d[comp] = items
170
+
171
+ if len(items) == 0:
172
+ raise Exception("No valid predictions found for any module.")
173
+
174
+ return ret_d
@@ -0,0 +1 @@
1
+ google-auth>=2.40.3