From 5d17aaa29523d3c51f117876fedc2535598ce586 Mon Sep 17 00:00:00 2001 From: winsent Date: Mon, 13 Jan 2025 00:35:58 +0300 Subject: [PATCH] Add additional_instructions on openai assistan runs create. --- .../langchain/agents/openai_assistant/base.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/libs/langchain/langchain/agents/openai_assistant/base.py b/libs/langchain/langchain/agents/openai_assistant/base.py index dc85fb03037ae..63457b63de2c7 100644 --- a/libs/langchain/langchain/agents/openai_assistant/base.py +++ b/libs/langchain/langchain/agents/openai_assistant/base.py @@ -408,7 +408,8 @@ async def ainvoke( message_metadata: Metadata to associate with a new message. thread_metadata: Metadata to associate with new thread. Only relevant when a new thread is created. - instructions: Additional run instructions. + instructions: Overrides the instructions of the assistant. + additional_instructions: Appends additional instructions. model: Override Assistant model for this run. tools: Override Assistant tools for this run. run_metadata: Metadata to associate with new run. @@ -507,7 +508,14 @@ def _create_run(self, input: dict) -> Any: params = { k: v for k, v in input.items() - if k in ("instructions", "model", "tools", "run_metadata") + if k + in ( + "instructions", + "model", + "tools", + "additional_instructions", + "run_metadata", + ) } return self.client.beta.threads.runs.create( input["thread_id"], @@ -637,7 +645,14 @@ async def _acreate_run(self, input: dict) -> Any: params = { k: v for k, v in input.items() - if k in ("instructions", "model", "tools", "run_metadata") + if k + in ( + "instructions", + "model", + "tools", + "additional_instructions", + "run_metadata", + ) } return await self.async_client.beta.threads.runs.create( input["thread_id"],