From 7e58d910dd4c57c761641dac993535b9e760e294 Mon Sep 17 00:00:00 2001 From: Emerson Gomes Date: Mon, 12 May 2025 19:12:16 -0500 Subject: [PATCH 1/3] Bump LiteLLM --- backend/requirements/default.txt | 2 +- backend/requirements/model_server.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/requirements/default.txt b/backend/requirements/default.txt index 61cd770ce3e..aa943bff8cc 100644 --- a/backend/requirements/default.txt +++ b/backend/requirements/default.txt @@ -39,7 +39,7 @@ langchainhub==0.1.21 langgraph==0.2.72 langgraph-checkpoint==2.0.13 langgraph-sdk==0.1.44 -litellm==1.66.3 +litellm==1.69.0 lxml==5.3.0 lxml_html_clean==0.2.2 llama-index==0.12.28 diff --git a/backend/requirements/model_server.txt b/backend/requirements/model_server.txt index 8bb9aa1e117..157f8bc1718 100644 --- a/backend/requirements/model_server.txt +++ b/backend/requirements/model_server.txt @@ -14,7 +14,7 @@ torch==2.6.0 transformers==4.49.0 uvicorn==0.21.1 voyageai==0.2.3 -litellm==1.66.3 +litellm==1.69.0 sentry-sdk[fastapi,celery,starlette]==2.14.0 aioboto3==14.0.0 prometheus_fastapi_instrumentator==7.1.0 From c508d7719ad92deba959246787a5eb3941e23d45 Mon Sep 17 00:00:00 2001 From: Emerson Gomes Date: Mon, 12 May 2025 19:12:50 -0500 Subject: [PATCH 2/3] Use LiteLLM DB for determining model tool capability instead of using hardcoded list --- backend/onyx/tools/utils.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/backend/onyx/tools/utils.py b/backend/onyx/tools/utils.py index 4c22ecda818..5e97170812c 100644 --- a/backend/onyx/tools/utils.py +++ b/backend/onyx/tools/utils.py @@ -6,21 +6,25 @@ from onyx.db.connector import check_connectors_exist from onyx.db.document import check_docs_exist from onyx.db.models import LLMProvider +from onyx.llm.utils import get_model_map, _find_model_obj from onyx.natural_language_processing.utils import BaseTokenizer from onyx.tools.tool import Tool -OPEN_AI_TOOL_CALLING_MODELS = { - "gpt-3.5-turbo", - "gpt-4-turbo", - "gpt-4", - "gpt-4o", - "gpt-4o-mini", -} - - def explicit_tool_calling_supported(model_provider: str, model_name: str) -> bool: - return model_provider == "openai" and model_name in OPEN_AI_TOOL_CALLING_MODELS + model_map = get_model_map() + model_obj = _find_model_obj( + model_map=model_map, + provider=model_provider, + model_name=model_name, + ) + + if model_obj: + # Check if the model_obj from litellm.model_cost indicates support for function calling + if model_obj.get("supports_function_calling"): + return True + + return False def compute_tool_tokens(tool: Tool, llm_tokenizer: BaseTokenizer) -> int: From 2bdd92d4d951393a452fd1efe252a09a77dbccc2 Mon Sep 17 00:00:00 2001 From: Emerson Gomes Date: Mon, 12 May 2025 19:24:09 -0500 Subject: [PATCH 3/3] Make function defaults explicit --- backend/onyx/tools/utils.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/backend/onyx/tools/utils.py b/backend/onyx/tools/utils.py index 5e97170812c..e5e56822d22 100644 --- a/backend/onyx/tools/utils.py +++ b/backend/onyx/tools/utils.py @@ -19,12 +19,7 @@ def explicit_tool_calling_supported(model_provider: str, model_name: str) -> boo model_name=model_name, ) - if model_obj: - # Check if the model_obj from litellm.model_cost indicates support for function calling - if model_obj.get("supports_function_calling"): - return True - - return False + return model_obj.get("supports_function_calling", False) if model_obj else False def compute_tool_tokens(tool: Tool, llm_tokenizer: BaseTokenizer) -> int: