Skip to content

Commit 49834a9

Browse files
authored
Tool calls auto calling (#51)
1 parent c0bb78c commit 49834a9

35 files changed

+2104
-1093
lines changed

.github/workflows/run-unit-tests.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ jobs:
1919
echo OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} >> .env
2020
echo LAMOOM_API_URI=${{ secrets.LAMOOM_API_URI }} >> .env
2121
echo LAMOOM_API_TOKEN=${{ secrets.LAMOOM_API_TOKEN }} >> .env
22+
echo LAMOOM_CUSTOM_PROVIDERS=${{ secrets.LAMOOM_CUSTOM_PROVIDERS }} >> .env
2223
echo NEBIUS_API_KEY=${{ secrets.NEBIUS_API_KEY }} >> .env
2324
echo CUSTOM_API_KEY=${{ secrets.CUSTOM_API_KEY }} >> .env
25+
echo GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }} >> .env
26+
echo SEARCH_ENGINE_ID=${{ secrets.SEARCH_ENGINE_ID }} >> .env
2427
cat .env
2528
2629
- name: Install dependencies
@@ -30,15 +33,21 @@ jobs:
3033
- name: Install Poetry
3134
run: pip install poetry
3235

36+
- name: Cache Poetry Dependencies
37+
uses: actions/cache@v3
38+
with:
39+
path: ~/.cache/pypoetry
40+
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
41+
restore-keys: |
42+
${{ runner.os }}-poetry-
43+
3344
- name: Install Python
3445
uses: actions/setup-python@v3
3546
with:
3647
python-version: 3.11
37-
cache: poetry
3848

3949
- name: Install Python libraries
40-
run: poetry install
50+
run: poetry install --with dev
4151

4252
- name: Run tests with pytest
43-
run: |
44-
poetry run make test
53+
run: poetry run make test

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ dist
1010
.vscode
1111
.pytest_cache
1212
python
13-
.env.test
13+
.env.test
14+
*/logs/

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ lint:
2525
poetry run isort --settings-path pyproject.toml --check-only .
2626

2727
test:
28-
poetry run pytest --cache-clear -vv tests \
29-
--cov=${PROJECT_FOLDER} \
30-
--cov-config=.coveragerc \
31-
--cov-fail-under=81 \
32-
--cov-report term-missing
28+
poetry run pytest --cache-clear -vv tests
3329

3430
.PHONY: format
3531
format: make-black isort-check flake8 make-mypy

README.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Mix models easily, and districute the load across models. The system will automa
124124
- Gemini
125125
- OpenAI (w/ Azure OpenAI models)
126126
- Nebius with (Llama, DeepSeek, Mistral, Mixtral, dolphin, Qwen and others)
127+
- OpenRouter woth open source models
127128
- Custom providers
128129

129130
Model string format is the following for Claude, Gemini, OpenAI, Nebius:
@@ -132,16 +133,17 @@ For Azure models format is the following:
132133
`"azure/{realm}/{model_name}"`
133134

134135
```python
135-
response_llm = client.call(agent.id, context, model = "openai/gpt-4o")
136+
response_llm = client.call(agent.id, context, model = "openai/o4-mini")
136137
response_llm = client.call(agent.id, context, model = "azure/useast/gpt-4o")
137138
```
138139

139140
Custom model string format is the following:
140-
`"custom/{model_name}"`
141-
`provider_url` is required
141+
`"custom/{provider_name}/{model_name}"`
142+
where provider is provided in the env variable:
143+
LAMOOM_CUSTOM_PROVIDERS={"provider_name": {"base_url": "https://","key":"key"}}
142144

143145
```python
144-
response_llm = client.call(agent.id, context, model = "custom/gpt-4o", provider_url = "your_model_url")
146+
response_llm = client.call(agent.id, context, model = "custom/provider_name/model_name")
145147
```
146148

147149
### Lamoom Keys
@@ -169,14 +171,14 @@ prompt.add("You're {name}. Say Hello and ask what's their name.", role="system")
169171

170172
# Call AI model with Lamoom
171173
context = {"name": "John Doe"}
172-
response = client.call(prompt.id, context, "openai/gpt-4o")
174+
response = client.call(prompt.id, context, "openai/o4-mini")
173175
print(response.content)
174176
```
175177

176178
### Creating Tests While Using Prompts
177179
```python
178180
# Call with test_data to automatically generate tests
179-
response = client.call(prompt.id, context, "openai/gpt-4o", test_data={
181+
response = client.call(prompt.id, context, "openai/o4-mini", test_data={
180182
'ideal_answer': "Hello, I'm John Doe. What's your name?",
181183
'model_name': "gemini/gemini-1.5-flash"
182184
})
@@ -202,6 +204,14 @@ client.add_ideal_answer(
202204
)
203205
```
204206

207+
### To Add Search Credentials:
208+
- Add Search ENgine id from here:
209+
https://programmablesearchengine.google.com/controlpanel/create
210+
211+
- Get A google Search Key:
212+
https://developers.google.com/custom-search/v1/introduction/?apix=true
213+
214+
205215
### Monitoring and Management
206216
- **Test Dashboard**: Review created tests and scores at https://cloud.lamoom.com/tests
207217
- **Prompt Management**: Update prompts and rerun tests for published or saved versions
@@ -219,4 +229,5 @@ We welcome contributions! Please see our Contribution Guidelines for more inform
219229
This project is licensed under the Apache2.0 License - see the [LICENSE](LICENSE.txt) file for details.
220230

221231
## Contact
222-
For support or contributions, please contact us via GitHub Issues.
232+
For support or contributions, please contact us via GitHub Issues.
233+

claude.config

Whitespace-only changes.

docs/evaluate_prompts_quality/evaluate_prompt_quality.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,6 @@
99

1010
lamoom = Lamoom()
1111

12-
gpt4_behaviour = behaviour.AIModelsBehaviour(
13-
attempts=[
14-
AttemptToCall(
15-
ai_model=AzureAIModel(
16-
realm='useast',
17-
deployment_id="gpt-4o",
18-
max_tokens=C_128K,
19-
support_functions=True,
20-
),
21-
weight=100,
22-
),
23-
]
24-
)
25-
2612

2713
def main():
2814
for prompt in get_all_prompts():
@@ -41,7 +27,7 @@ def main():
4127
'prompt_data': prompt_chats,
4228
'prompt_id': prompt_id,
4329
}
44-
result = lamoom.call(prompt_to_evaluate_prompt.id, context, gpt4_behaviour)
30+
result = lamoom.call(prompt_to_evaluate_prompt.id, context, 'azure/useast/o4-mini')
4531
print(result.content)
4632

4733
if __name__ == '__main__':

0 commit comments

Comments
 (0)