mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-10 21:35:08 +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]],
|
||||
model: str,
|
||||
*,
|
||||
model_kwargs: dict[str, float] = {},
|
||||
client: Optional[Union[openai.OpenAI, openai.AzureOpenAI]] = None,
|
||||
tool_resources: Optional[Union[AssistantToolResources, dict, NotGiven]] = None,
|
||||
extra_body: Optional[object] = None,
|
||||
**kwargs: Any,
|
||||
) -> OpenAIAssistantRunnable:
|
||||
"""Create an OpenAI Assistant and instantiate the Runnable.
|
||||
@ -241,6 +243,9 @@ class OpenAIAssistantV2Runnable(OpenAIAssistantRunnable):
|
||||
model: Assistant model to use.
|
||||
client: OpenAI or AzureOpenAI client.
|
||||
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:
|
||||
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
|
||||
tool_resources=tool_resources, # type: ignore[arg-type]
|
||||
model=model,
|
||||
extra_body=extra_body,
|
||||
**model_kwargs,
|
||||
)
|
||||
return cls(assistant_id=assistant.id, client=client, **kwargs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user