Skip to content

Commit

Permalink
make openai client override safer and more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
phact authored and ogabrielluiz committed Oct 16, 2024
1 parent dc4756e commit aef3355
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ dependencies = [
"yfinance>=0.2.40",
"langchain-google-community==1.0.7",
"wolframalpha>=5.1.3",
"astra-assistants>=2.1.4",
"astra-assistants>=2.2.2",
"composio-langchain==0.5.9",
"spider-client>=0.0.27",
"nltk>=3.9.1",
Expand Down
5 changes: 2 additions & 3 deletions src/backend/base/langflow/base/astra_assistants/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

import astra_assistants.tools as astra_assistants_tools
import requests
from astra_assistants import OpenAI as AstraOpenAI
from astra_assistants import patch
from astra_assistants import patch, OpenAIWithDefaultKey
from astra_assistants.tools.tool_interface import ToolInterface

client_lock = threading.Lock()
Expand All @@ -19,7 +18,7 @@ def get_patched_openai_client(shared_component_cache):
os.environ["ASTRA_ASSISTANTS_QUIET"] = "true"
client = shared_component_cache.get("client")
if client is None:
client = patch(AstraOpenAI())
client = patch(OpenAIWithDefaultKey())
shared_component_cache.set("client", client)
return client

Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aef3355

Please sign in to comment.