Add missing imports to ai_providers.py
This commit is contained in:
+4
-2
@@ -1,8 +1,10 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
import anthropic
|
import anthropic
|
||||||
from openai import OpenAI
|
from openai import OpenAI
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
from functions import functions
|
||||||
|
|
||||||
class AIProvider(ABC):
|
class AIProvider(ABC):
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
@@ -56,7 +58,7 @@ class AnthropicProvider(AIProvider):
|
|||||||
"description": function['description'],
|
"description": function['description'],
|
||||||
"input_schema": function['parameters'] if function['parameters'] not in [None, {}] else {"type": "object", "properties": {"param1": {"type": "string", "description": "Unnecessary"}}, "required": []}
|
"input_schema": function['parameters'] if function['parameters'] not in [None, {}] else {"type": "object", "properties": {"param1": {"type": "string", "description": "Unnecessary"}}, "required": []}
|
||||||
}
|
}
|
||||||
for function in functions # This assumes 'functions' is globally accessible
|
for function in functions
|
||||||
]
|
]
|
||||||
|
|
||||||
class OpenAIProvider(AIProvider):
|
class OpenAIProvider(AIProvider):
|
||||||
@@ -72,7 +74,7 @@ class OpenAIProvider(AIProvider):
|
|||||||
response = self.client.chat.completions.create(
|
response = self.client.chat.completions.create(
|
||||||
model=self.model,
|
model=self.model,
|
||||||
messages=self.format_messages(messages),
|
messages=self.format_messages(messages),
|
||||||
functions=functions, # This assumes 'functions' is globally accessible
|
functions=functions,
|
||||||
function_call="auto",
|
function_call="auto",
|
||||||
max_tokens=self.get_max_tokens()
|
max_tokens=self.get_max_tokens()
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user