Skip to content

Commit

Permalink
Added additional parameters passed down to OpenAI
Browse files Browse the repository at this point in the history
  • Loading branch information
pm390 committed Jan 14, 2025
1 parent d9b856a commit 3f8b36b
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions libs/langchain/langchain/agents/openai_assistant/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ def invoke(
instructions: Additional run instructions.
model: Override Assistant model for this run.
tools: Override Assistant tools for this run.
parallel_tool_calls: Allow Assistant to perform parallel_tool_calls.
top_p: Override Assistant top_p for this run.
temperature: Override Assistant temperature for this run.
max_completion_tokens: Allow setting max_completion_tokens for this run.
max_prompt_tokens: Allow setting max_prompt_tokens for this run.
run_metadata: Metadata to associate with new run.
config: Runnable config. Defaults to None.
Expand Down Expand Up @@ -412,6 +417,11 @@ async def ainvoke(
additional_instructions: Appends additional instructions.
model: Override Assistant model for this run.
tools: Override Assistant tools for this run.
parallel_tool_calls: Allow Assistant to perform parallel_tool_calls.
top_p: Override Assistant top_p for this run.
temperature: Override Assistant temperature for this run.
max_completion_tokens: Allow setting max_completion_tokens for this run.
max_prompt_tokens: Allow setting max_prompt_tokens for this run.
run_metadata: Metadata to associate with new run.
config: Runnable config. Defaults to None.
kwargs: Additional arguments.
Expand Down Expand Up @@ -514,6 +524,11 @@ def _create_run(self, input: dict) -> Any:
"model",
"tools",
"additional_instructions",
"parallel_tool_calls",
"top_p",
"temperature",
"max_completion_tokens",
"max_prompt_tokens",
"run_metadata",
)
}
Expand All @@ -527,7 +542,18 @@ def _create_thread_and_run(self, input: dict, thread: 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",
"parallel_tool_calls",
"top_p",
"temperature",
"max_completion_tokens",
"max_prompt_tokens",
"run_metadata",
)
}
run = self.client.beta.threads.create_and_run(
assistant_id=self.assistant_id,
Expand Down Expand Up @@ -651,6 +677,11 @@ async def _acreate_run(self, input: dict) -> Any:
"model",
"tools",
"additional_instructions",
"parallel_tool_calls",
"top_p",
"temperature",
"max_completion_tokens",
"max_prompt_tokens",
"run_metadata",
)
}
Expand All @@ -664,7 +695,18 @@ async def _acreate_thread_and_run(self, input: dict, thread: 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",
"parallel_tool_calls",
"top_p",
"temperature",
"max_completion_tokens",
"max_prompt_tokens",
"run_metadata",
)
}
run = await self.async_client.beta.threads.create_and_run(
assistant_id=self.assistant_id,
Expand Down

0 comments on commit 3f8b36b

Please sign in to comment.