From f9e33e2474708fa539e25dd01152fe07dea11ef4 Mon Sep 17 00:00:00 2001
From: Siraj R Aizlewood <siraj@aurelio.ai>
Date: Fri, 3 May 2024 22:46:07 +0400
Subject: [PATCH] Using OpenAI type NotGiven, instead of None for tools.

---
 semantic_router/llms/openai.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/semantic_router/llms/openai.py b/semantic_router/llms/openai.py
index b8306740..7a887b8e 100644
--- a/semantic_router/llms/openai.py
+++ b/semantic_router/llms/openai.py
@@ -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:
-- 
GitLab