gpt_assistant_agent
autogen.agentchat.contrib.gpt_assistant_agent.GPTAssistantAgent
GPTAssistantAgent
An experimental AutoGen agent class that leverages the OpenAI Assistant API for conversational capabilities. This agent is unique in its reliance on the OpenAI Assistant for state management, differing from other agents like ConversableAgent.
Parameters:Name | Description |
---|---|
name='GPT Assistant' | |
instructions | instructions for the OpenAI assistant configuration. When instructions is not None, the system message of the agent will be set to the provided instructions and used in the assistant run, irrespective of the overwrite_instructions flag. But when instructions is None, and the assistant does not exist, the system message will be set to AssistantAgent.DEFAULT_SYSTEM_MESSAGE. If the assistant exists, the system message will be set to the existing assistant instructions. Type: str | None Default: None |
llm_config | llm inference configuration. - model: Model to use for the assistant (gpt-4-1106-preview, gpt-3.5-turbo-1106). assistant_config - assistant_id: ID of the assistant to use. If None, a new assistant will be created. - check_every_ms: check thread run status interval - tools: Give Assistants access to OpenAI-hosted tools like Code Interpreter and Knowledge Retrieval, or build your own tools using Function calling. ref https://platform.openai.com/docs/assistants/tools - file_ids: (Deprecated) files used by retrieval in run. It is Deprecated, use tool_resources instead. https://platform.openai.com/docs/assistants/migration/what-has-changed. - tool_resources: A set of resources that are used by the assistant’s tools. The resources are specific to the type of tool. Type: dict | bool | None Default: None |
assistant_config | Type: dict | None Default: None |
overwrite_instructions | whether to overwrite the instructions of an existing assistant. This parameter is in effect only when assistant_id is specified in llm_config. Type: bool Default: False |
overwrite_tools | whether to overwrite the tools of an existing assistant. This parameter is in effect only when assistant_id is specified in llm_config. Type: bool Default: False |
**kwargs |
Class Attributes
DEFAULT_MODEL_NAME
Instance Attributes
assistant_id
Return the assistant id
oai_threads
Return the threads of the agent.
openai_assistant
openai_client
Instance Methods
clear_history
Clear the chat history of the agent.
Parameters:Name | Description |
---|---|
agent | the agent with whom the chat history to clear. If None, clear the chat history with all agents. Type: autogen.agentchat.agent.Agent | None Default: None |
delete_assistant
Delete the assistant from OAI assistant API
find_matching_assistant
Find the matching assistant from a list of candidate assistants. Filter out candidates with the same name but different instructions, and function names.
Parameters:Name | Description |
---|---|
candidate_assistants | |
instructions | |
tools |
get_assistant_instructions
Return the assistant instructions from OAI assistant API
pretty_print_thread
Pretty print the thread.
Parameters:Name | Description |
---|---|
thread |
reset
Resets the agent, clearing any existing conversation thread and unread message indices.