Skip to content

Commit

Permalink
Removed instructor patch
Browse files Browse the repository at this point in the history
  • Loading branch information
VRSEN committed Aug 15, 2024
1 parent 0e65ae1 commit a29cf33
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions agency_swarm/util/oai.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import openai
import threading
import os
import instructor

from dotenv import load_dotenv

Expand All @@ -20,18 +19,17 @@ def get_openai_client():
api_key = openai.api_key or os.getenv('OPENAI_API_KEY')
if api_key is None:
raise ValueError("OpenAI API key is not set. Please set it using set_openai_key.")
client = instructor.patch(openai.OpenAI(api_key=api_key,
timeout=httpx.Timeout(60.0, read=30, connect=5.0),
max_retries=5,
default_headers={"OpenAI-Beta": "assistants=v2"})
)
client = openai.OpenAI(api_key=api_key,
timeout=httpx.Timeout(60.0, read=30, connect=5.0),
max_retries=5,
default_headers={"OpenAI-Beta": "assistants=v2"})
return client


def set_openai_client(new_client):
global client
with client_lock:
client = instructor.patch(new_client)
client = new_client


def set_openai_key(key):
Expand Down

0 comments on commit a29cf33

Please sign in to comment.