diff --git a/src/backend/base/langflow/components/astra_assistants/get_assistant.py b/src/backend/base/langflow/components/astra_assistants/get_assistant.py index 8c0412fe49eb..cae81515de56 100644 --- a/src/backend/base/langflow/components/astra_assistants/get_assistant.py +++ b/src/backend/base/langflow/components/astra_assistants/get_assistant.py @@ -8,7 +8,6 @@ class AssistantsGetAssistantName(Component): - client = patch(OpenAI()) display_name = "Get Assistant name" description = "Assistant by id" @@ -30,6 +29,7 @@ class AssistantsGetAssistantName(Component): ] def process_inputs(self) -> Message: + patch(OpenAI()) assistant = self.client.beta.assistants.retrieve( assistant_id=self.assistant_id, ) diff --git a/src/backend/base/langflow/components/astra_assistants/list_assistants.py b/src/backend/base/langflow/components/astra_assistants/list_assistants.py index c9e57a9e0297..e70417c5b7c9 100644 --- a/src/backend/base/langflow/components/astra_assistants/list_assistants.py +++ b/src/backend/base/langflow/components/astra_assistants/list_assistants.py @@ -1,12 +1,12 @@ from astra_assistants import patch # type: ignore -from langflow.template.field.base import Output -from langflow.custom import Component from openai import OpenAI + +from langflow.custom import Component from langflow.schema.message import Message +from langflow.template.field.base import Output class AssistantsListAssistants(Component): - client = patch(OpenAI()) display_name = "List Assistants" description = "Returns a list of assistant id's" @@ -15,6 +15,7 @@ class AssistantsListAssistants(Component): ] def process_inputs(self) -> Message: + patch(OpenAI()) assistants = self.client.beta.assistants.list() id_list = [assistant.id for assistant in assistants] message = Message( diff --git a/src/backend/base/langflow/components/astra_assistants/run.py b/src/backend/base/langflow/components/astra_assistants/run.py index 079dc179ca82..dfde8464e36c 100644 --- a/src/backend/base/langflow/components/astra_assistants/run.py +++ b/src/backend/base/langflow/components/astra_assistants/run.py @@ -11,8 +11,6 @@ class AssistantsRun(Component): - client = patch(OpenAI()) - display_name = "Run Assistant" description = "Executes an Assistant Run against a thread" @@ -59,6 +57,7 @@ def update_build_config( outputs = [Output(display_name="Assistant Response", name="assistant_response", method="process_inputs")] def process_inputs(self) -> Message: + patch(OpenAI()) try: text = ""