mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-14 15:16:21 +00:00
community: add new parameters to pass to OpenAIAssistantV2Runnable (#27372)
Thank you for contributing to LangChain! **Description:** Added the model parameters to be passed in the OpenAI Assistant. Enabled it at the `OpenAIAssistantV2Runnable` class. **Issue:** NA **Dependencies:** None **Twitter handle:** luizf0992
This commit is contained in:
parent
0b97135da1
commit
7a29ca6200
@ -227,8 +227,10 @@ class OpenAIAssistantV2Runnable(OpenAIAssistantRunnable):
|
|||||||
tools: Sequence[Union[BaseTool, dict]],
|
tools: Sequence[Union[BaseTool, dict]],
|
||||||
model: str,
|
model: str,
|
||||||
*,
|
*,
|
||||||
|
model_kwargs: dict[str, float] = {},
|
||||||
client: Optional[Union[openai.OpenAI, openai.AzureOpenAI]] = None,
|
client: Optional[Union[openai.OpenAI, openai.AzureOpenAI]] = None,
|
||||||
tool_resources: Optional[Union[AssistantToolResources, dict, NotGiven]] = None,
|
tool_resources: Optional[Union[AssistantToolResources, dict, NotGiven]] = None,
|
||||||
|
extra_body: Optional[object] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> OpenAIAssistantRunnable:
|
) -> OpenAIAssistantRunnable:
|
||||||
"""Create an OpenAI Assistant and instantiate the Runnable.
|
"""Create an OpenAI Assistant and instantiate the Runnable.
|
||||||
@ -241,6 +243,9 @@ class OpenAIAssistantV2Runnable(OpenAIAssistantRunnable):
|
|||||||
model: Assistant model to use.
|
model: Assistant model to use.
|
||||||
client: OpenAI or AzureOpenAI client.
|
client: OpenAI or AzureOpenAI client.
|
||||||
Will create default OpenAI client (Assistant v2) if not specified.
|
Will create default OpenAI client (Assistant v2) if not specified.
|
||||||
|
model_kwargs: Additional model arguments. Only available for temperature
|
||||||
|
and top_p parameters.
|
||||||
|
extra_body: Additional body parameters to be passed to the assistant.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
OpenAIAssistantRunnable configured to run using the created assistant.
|
OpenAIAssistantRunnable configured to run using the created assistant.
|
||||||
@ -257,6 +262,8 @@ class OpenAIAssistantV2Runnable(OpenAIAssistantRunnable):
|
|||||||
tools=[_get_assistants_tool(tool) for tool in tools], # type: ignore
|
tools=[_get_assistants_tool(tool) for tool in tools], # type: ignore
|
||||||
tool_resources=tool_resources, # type: ignore[arg-type]
|
tool_resources=tool_resources, # type: ignore[arg-type]
|
||||||
model=model,
|
model=model,
|
||||||
|
extra_body=extra_body,
|
||||||
|
**model_kwargs,
|
||||||
)
|
)
|
||||||
return cls(assistant_id=assistant.id, client=client, **kwargs)
|
return cls(assistant_id=assistant.id, client=client, **kwargs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user