mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 08:33:49 +00:00
langchain: sync -> async methods in OpenAI assistants (#21378)
This commit is contained in:
parent
ad3fd44a7f
commit
080af0ec53
@ -434,7 +434,7 @@ class OpenAIAssistantRunnable(RunnableSerializable[Dict, OutputType]):
|
||||
],
|
||||
"metadata": input.get("thread_metadata"),
|
||||
}
|
||||
run = await self._create_thread_and_run(input, thread)
|
||||
run = await self._acreate_thread_and_run(input, thread)
|
||||
# Starting a new run in an existing thread.
|
||||
elif "run_id" not in input:
|
||||
_ = await self.async_client.beta.threads.messages.create(
|
||||
@ -444,14 +444,14 @@ class OpenAIAssistantRunnable(RunnableSerializable[Dict, OutputType]):
|
||||
file_ids=input.get("file_ids", []),
|
||||
metadata=input.get("message_metadata"),
|
||||
)
|
||||
run = await self._create_run(input)
|
||||
run = await self._acreate_run(input)
|
||||
# Submitting tool outputs to an existing run, outside the AgentExecutor
|
||||
# framework.
|
||||
else:
|
||||
run = await self.async_client.beta.threads.runs.submit_tool_outputs(
|
||||
**input
|
||||
)
|
||||
run = await self._wait_for_run(run.id, run.thread_id)
|
||||
run = await self._await_for_run(run.id, run.thread_id)
|
||||
except BaseException as e:
|
||||
run_manager.on_chain_error(e)
|
||||
raise e
|
||||
|
Loading…
Reference in New Issue
Block a user