Skip to content

Commit

Permalink
community: add new parameters to pass to OpenAIAssistantV2Runnable (l…
Browse files Browse the repository at this point in the history
…angchain-ai#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
  • Loading branch information
luiz0992 authored Oct 30, 2024
1 parent 0b97135 commit 7a29ca6
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ def create_assistant(
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.
Expand All @@ -241,6 +243,9 @@ def create_assistant(
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.
Expand All @@ -257,6 +262,8 @@ def create_assistant(
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)

Expand Down

0 comments on commit 7a29ca6

Please sign in to comment.