Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llm metadata fix #1836

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions kairon/shared/llm/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def fetch_llm_metadata(bot: str):
"""
metadata = Utility.llm_metadata
llm_types = metadata.keys()

final_metadata = {}
for llm_type in llm_types:
secret = LLMSecret.objects(bot=bot, llm_type=llm_type).first()
if not secret:
Expand All @@ -428,9 +428,11 @@ def fetch_llm_metadata(bot: str):
else:
models = []

metadata[llm_type]['properties']['model']['enum'] = models
if models:
metadata[llm_type]['properties']['model']['enum'] = models
final_metadata[llm_type] = metadata[llm_type]

return metadata
return final_metadata

@staticmethod
def modify_user_message_for_perplexity(user_msg: str, llm_type: str, hyperparameters: Dict) -> str:
Expand Down
6 changes: 3 additions & 3 deletions tests/integration_test/services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,9 +1593,9 @@ def test_get_llm_metadata():
assert "model" in actual["data"]["openai"]["properties"]
assert actual["data"]["openai"]["properties"]["model"]["enum"] == ["common_openai_model1", "common_openai_model2"]

assert "anthropic" in actual["data"]
assert "model" in actual["data"]["anthropic"]["properties"]
assert actual["data"]["anthropic"]["properties"]["model"]["enum"] == []
assert "anthropic" not in actual["data"]
#assert "model" in actual["data"]["anthropic"]["properties"]
#assert actual["data"]["anthropic"]["properties"]["model"]["enum"] == []
LLMSecret.objects.delete()


Expand Down
Loading