create_assistant() — langchain Function Reference
Architecture documentation for the create_assistant() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD af42a972_7172_4f29_9cce_86e64185183e["create_assistant()"] 40171661_732e_8178_c8ae_92254ace13fe["OpenAIAssistantRunnable"] af42a972_7172_4f29_9cce_86e64185183e -->|defined in| 40171661_732e_8178_c8ae_92254ace13fe e4a3aa34_e568_bd19_bdcd_79e13a2db9b7["_get_openai_client()"] af42a972_7172_4f29_9cce_86e64185183e -->|calls| e4a3aa34_e568_bd19_bdcd_79e13a2db9b7 93771dce_30ea_10bf_1734_fb75d2bb48ee["_get_assistants_tool()"] af42a972_7172_4f29_9cce_86e64185183e -->|calls| 93771dce_30ea_10bf_1734_fb75d2bb48ee style af42a972_7172_4f29_9cce_86e64185183e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/agents/openai_assistant/base.py lines 254–285
def create_assistant(
cls,
name: str,
instructions: str,
tools: Sequence[BaseTool | dict],
model: str,
*,
client: openai.OpenAI | openai.AzureOpenAI | None = None,
**kwargs: Any,
) -> OpenAIAssistantRunnable:
"""Create an OpenAI Assistant and instantiate the Runnable.
Args:
name: Assistant name.
instructions: Assistant instructions.
tools: Assistant tools. Can be passed in OpenAI format or as BaseTools.
model: Assistant model to use.
client: OpenAI or AzureOpenAI client.
Will create a default OpenAI client if not specified.
kwargs: Additional arguments.
Returns:
OpenAIAssistantRunnable configured to run using the created assistant.
"""
client = client or _get_openai_client()
assistant = client.beta.assistants.create(
name=name,
instructions=instructions,
tools=[_get_assistants_tool(tool) for tool in tools],
model=model,
)
return cls(assistant_id=assistant.id, client=client, **kwargs)
Domain
Subdomains
Source
Frequently Asked Questions
What does create_assistant() do?
create_assistant() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/openai_assistant/base.py.
Where is create_assistant() defined?
create_assistant() is defined in libs/langchain/langchain_classic/agents/openai_assistant/base.py at line 254.
What does create_assistant() call?
create_assistant() calls 2 function(s): _get_assistants_tool, _get_openai_client.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free