Skip to content

Commit a116b09

Browse files
emerzonZhipengHe
authored andcommitted
Use LiteLLM DB for determining model tool capability (onyx-dot-app#4698)
* Bump LiteLLM * Use LiteLLM DB for determining model tool capability instead of using hardcoded list * Make function defaults explicit
1 parent 1c12060 commit a116b09

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

backend/onyx/tools/utils.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@
66
from onyx.db.connector import check_connectors_exist
77
from onyx.db.document import check_docs_exist
88
from onyx.db.models import LLMProvider
9+
from onyx.llm.utils import get_model_map, _find_model_obj
910
from onyx.natural_language_processing.utils import BaseTokenizer
1011
from onyx.tools.tool import Tool
1112

1213

13-
OPEN_AI_TOOL_CALLING_MODELS = {
14-
"gpt-3.5-turbo",
15-
"gpt-4-turbo",
16-
"gpt-4",
17-
"gpt-4o",
18-
"gpt-4o-mini",
19-
}
20-
21-
2214
def explicit_tool_calling_supported(model_provider: str, model_name: str) -> bool:
23-
return model_provider == "openai" and model_name in OPEN_AI_TOOL_CALLING_MODELS
15+
model_map = get_model_map()
16+
model_obj = _find_model_obj(
17+
model_map=model_map,
18+
provider=model_provider,
19+
model_name=model_name,
20+
)
21+
22+
return model_obj.get("supports_function_calling", False) if model_obj else False
2423

2524

2625
def compute_tool_tokens(tool: Tool, llm_tokenizer: BaseTokenizer) -> int:

backend/requirements/default.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ langchainhub==0.1.21
3939
langgraph==0.2.72
4040
langgraph-checkpoint==2.0.13
4141
langgraph-sdk==0.1.44
42-
litellm==1.66.3
42+
litellm==1.69.0
4343
lxml==5.3.0
4444
lxml_html_clean==0.2.2
4545
llama-index==0.12.28

backend/requirements/model_server.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ torch==2.6.0
1414
transformers==4.49.0
1515
uvicorn==0.21.1
1616
voyageai==0.2.3
17-
litellm==1.66.3
17+
litellm==1.69.0
1818
sentry-sdk[fastapi,celery,starlette]==2.14.0
1919
aioboto3==14.0.0
2020
prometheus_fastapi_instrumentator==7.1.0

0 commit comments

Comments
 (0)