Skip to content

Commit

Permalink
added default llm 4o mini and optional limit if pass from payload in …
Browse files Browse the repository at this point in the history
…db action (#1373)

* 1. added gpt-4o-mini as default
2. optional limit parameter in qdrant if provided by pauload

* 1. added gpt-4o-mini as default
2. optional limit parameter in qdrant if provided by pauload

* 1. added gpt-4o-mini as default
2. optional limit parameter in qdrant if provided by pauload
  • Loading branch information
sfahad1414 authored Jul 25, 2024
1 parent 7659149 commit 2006317
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 63 deletions.
4 changes: 3 additions & 1 deletion kairon/shared/vector_embeddings/db/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ async def perform_operation(self, data: Dict, user: str, **kwargs):
request.update(**payload)

if request:
request.update(**{'with_payload': True, 'limit': 10})
request.update(**{'with_payload': True})
if 'limit' not in request:
request['limit'] = 10
result = ActionUtility.execute_http_request(http_url=url,
request_method='POST',
request_body=request)
Expand Down
2 changes: 1 addition & 1 deletion metadata/integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ llm:
description: "The max_tokens hyperparameter limits the length of generated responses in chat completion using ChatGPT."
model:
type: string
default: "gpt-3.5-turbo"
default: "gpt-4o-mini"
enum: ["gpt-3.5-turbo", "gpt-3.5-turbo-instruct", "gpt-4o-mini"]
description: "The model hyperparameter is the ID of the model to use such as gpt-2, gpt-3, or a custom model that you have trained or fine-tuned."
top_p:
Expand Down
2 changes: 1 addition & 1 deletion template/use-cases/Hi-Hello-GPT/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ prompt_action:
frequency_penalty: 0
logit_bias: {}
max_tokens: 300
model: gpt-3.5-turbo
model: gpt-4o-mini
n: 1
presence_penalty: 0
stop: null
Expand Down
36 changes: 18 additions & 18 deletions tests/integration_test/action_service_test.py

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions tests/integration_test/services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4840,7 +4840,7 @@ def test_get_prompt_action():
{'name': 'test_update_prompt_action', 'num_bot_responses': 5, 'failure_message': 'updated_failure_message',
'user_question': {'type': 'from_slot', 'value': 'prompt_question'},
'llm_type': 'openai',
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-3.5-turbo', 'top_p': 0.0, 'n': 1,
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-4o-mini', 'top_p': 0.0, 'n': 1,
'stop': None, 'presence_penalty': 0.0, 'frequency_penalty': 0.0,
'logit_bias': {}}, 'llm_prompts': [
{'name': 'System Prompt', 'data': 'You are a personal assistant.', 'type': 'system', 'source': 'static',
Expand Down Expand Up @@ -4935,7 +4935,7 @@ def _mock_get_bot_settings(*args, **kwargs):
'failure_message': "I'm sorry, I didn't quite understand that. Could you rephrase?",
'user_question': {'type': 'from_user_message'},
'llm_type': 'openai',
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-3.5-turbo', 'top_p': 0.0, 'n': 1,
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-4o-mini', 'top_p': 0.0, 'n': 1,
'stop': None, 'presence_penalty': 0.0, 'frequency_penalty': 0.0,
'logit_bias': {}},
'llm_prompts': [{'name': 'System Prompt', 'data': 'You are a personal assistant.', 'type': 'system',
Expand Down Expand Up @@ -5027,7 +5027,7 @@ def _mock_get_bot_settings(*args, **kwargs):
'failure_message': "I'm sorry, I didn't quite understand that. Could you rephrase?",
'user_question': {'type': 'from_user_message'},
'llm_type': 'openai',
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-3.5-turbo', 'top_p': 0.0, 'n': 1,
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-4o-mini', 'top_p': 0.0, 'n': 1,
'stop': None, 'presence_penalty': 0.0,
'frequency_penalty': 0.0, 'logit_bias': {}},
'llm_prompts': [{'name': 'System Prompt', 'data': 'You are a personal assistant.', 'type': 'system',
Expand Down Expand Up @@ -5122,7 +5122,7 @@ def _mock_get_bot_settings(*args, **kwargs):
'failure_message': "I'm sorry, I didn't quite understand that. Could you rephrase?",
'user_question': {'type': 'from_user_message'},
'llm_type': 'openai',
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-3.5-turbo', 'top_p': 0.0, 'n': 1,
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-4o-mini', 'top_p': 0.0, 'n': 1,
'stop': None, 'presence_penalty': 0.0, 'frequency_penalty': 0.0,
'logit_bias': {}},
'llm_prompts': [{'name': 'System Prompt', 'data': 'You are a personal assistant.', 'type': 'system',
Expand Down Expand Up @@ -24975,7 +24975,7 @@ def test_get_llm_logs():
expected = "Hi, How may i help you?"

result = loop.run_until_complete(litellm.acompletion(messages=messages,
model="gpt-3.5-turbo",
model="gpt-4o-mini",
mock_response=expected,
metadata={'user': user, 'bot': pytest.bot}))
assert result['choices'][0]['message']['content'] == expected
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_test/action/action_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2662,7 +2662,7 @@ def test_get_prompt_action_config(self):
assert actual_config == {'name': 'kairon_faq_action', 'num_bot_responses': 5,
'failure_message': "I'm sorry, I didn't quite understand that. Could you rephrase?",
'user_question': {'type': 'from_user_message'}, 'bot': 'test_action_server',
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-3.5-turbo',
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-4o-mini',
'top_p': 0.0, 'n': 1, 'stop': None,
'presence_penalty': 0.0, 'frequency_penalty': 0.0,
'logit_bias': {}},
Expand Down Expand Up @@ -3956,7 +3956,7 @@ def test_get_prompt_action_config_2(self):
'user_question': {'type': 'from_user_message'},
'failure_message': "I'm sorry, I didn't quite understand that. Could you rephrase?",
'bot': 'test_bot_action_test', 'user': 'test_user_action_test',
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-3.5-turbo',
'hyperparameters': {'temperature': 0.0, 'max_tokens': 300, 'model': 'gpt-4o-mini',
'top_p': 0.0, 'n': 1, 'stop': None,
'presence_penalty': 0.0, 'frequency_penalty': 0.0,
'logit_bias': {}}, 'dispatch_response': True, 'set_slots': [],
Expand Down
Loading

0 comments on commit 2006317

Please sign in to comment.