Skip to content
Snippets Groups Projects
Unverified Commit f9e33e24 authored by Siraj R Aizlewood's avatar Siraj R Aizlewood
Browse files

Using OpenAI type NotGiven, instead of None for tools.

parent 61ffed70
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ import os
from typing import List, Optional, Any
import openai
from openai._types import NotGiven
from semantic_router.llms import BaseLLM
from semantic_router.schema import Message
......@@ -64,14 +65,14 @@ class OpenAILLM(BaseLLM):
if function_schemas:
tools = function_schemas
else:
tools = None
tools = NotGiven
completion = self.client.chat.completions.create(
model=self.name,
messages=[m.to_openai() for m in messages],
temperature=self.temperature,
max_tokens=self.max_tokens,
tools=tools, # type: ignore # MyPy expecting Iterable[ChatCompletionToolParam] | NotGiven, but dict is accepted by OpenAI.
tools=tools,
)
if function_schemas:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment