autogpt
Module Contents
Classes
A wrapper of AutoGPT prompt which manages the response from LLM and |
|
An implementation of AutoGPT (https://github.com/Significant- |
Attributes
- lagent.agents.autogpt.DEFAULT_TRIGGERING_PROMPT = 'Determine exactly one command to use based on the given goals and the progress you have made so...'
- lagent.agents.autogpt.DEFAULT_PREFIX = Multiline-String
Show Value
"""You are {ai_name}, {role_description}. Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications. The OS you are running on is: {os_info} ## Constraints You operate within the following constraints: 1. ~4000 word limit for short term memory. Your short term memory is short, so immediately save important information to files. 2. 'If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember. 3. No user assistance 4. Exclusively use the commands listed below e.g. command_name ## Commands You have access to the following commands: {tool_description} ## Resources You can leverage access to the following resources: 1. Internet access for searches and information gathering. 2. Long Term memory management.', 'File output.', 'Command execution ## Best practices 1. Continuously review and analyze your actions to ensure you are performing to the best of your abilities. 2. Constructively self-criticize your big-picture behavior constantly. 3. Reflect on past decisions and strategies to refine your approach. 4. Every command has a cost, so be smart and efficient. Aim to complete tasks in the least number of steps. ## Goals For your task, you must fulfill the following goals: {ai_goals} """
- lagent.agents.autogpt.DEFAULT_CALL_PROTOCOL = Multiline-String
Show Value
"""Respond strictly with JSON. The JSON should be compatible with the TypeScript type `Response` from the following: ```ts interface Response { thoughts: { // Thoughts text: string; reasoning: string; // Short markdown-style bullet list that conveys the long-term plan plan: string; // Constructive self-criticism criticism: string; // Summary of thoughts to say to the user speak: string; }; command: { name: string; args: Record<string, any>; }; } ``` """
- lagent.agents.autogpt.DEFAULT_SCHEMA
- class lagent.agents.autogpt.AutoGPTProtocol(ai_name='AutoGPT', role_description='', prefix=DEFAULT_PREFIX, call_protocol=DEFAULT_CALL_PROTOCOL, valid_schema=DEFAULT_SCHEMA, triggering_prompt=DEFAULT_TRIGGERING_PROMPT)
A wrapper of AutoGPT prompt which manages the response from LLM and generate desired prompts in a AutoGPT format.
- Parameters:
ai_name (str) – the name of the agent, default to ‘AutoGPT’
role_description (str) – description of the role, e.g., System, User
prefix (str) – the prefix prompt for AutoGPT
call_protocol (str) – the request prompt which defines the protocol of return format from LLM.
valid_schema (dict) – defines the schema of the return format.
triggering_prompt (str) – the predefined trigger prompt.
- parse(response, action_executor)
Parse the action returns in a AutoGPT format.
- Parameters:
response (str) – The response from LLM with AutoGPT format.
action_executor (ActionExecutor) – Action executor to provide no_action/finish_action name.
- Returns:
- the return value is a tuple contains:
action (str): the extracted action name.
action_input (str): the corresponding action input.
- Return type:
tuple
- format(goal, inner_history, action_executor)
Generate the AutoGPT format prompt.
- Parameters:
goal (str) – The user request.
inner_history (List[Dict]) – The log in the current run.
action_executor (ActionExecutor) – the action manager to execute actions.
- Returns:
AutoGPT format prompt.
- Return type:
List[Dict]
- format_response(action_return)
format the final response at current step.
- Parameters:
action_return (ActionReturn) – return value of the current action.
- Returns:
the final response at current step.
- Return type:
dict
- class lagent.agents.autogpt.AutoGPT(llm, action_executor, protocol=AutoGPTProtocol(), max_turn=2)
Bases:
lagent.agents.base_agent.BaseAgentAn implementation of AutoGPT (https://github.com/Significant- Gravitas/Auto-GPT)
- Parameters:
llm (BaseModel or BaseAPIModel) – a LLM service which can chat and act as backend.
action_executor (ActionExecutor) – an action executor to manage all actions and their response.
protocol (ReActProtocol) – a wrapper to generate prompt and parse the response from LLM / actions.
max_turn (int) – the maximum number of trails for LLM to generate plans that can be successfully parsed by ReWOO protocol.
- chat(goal, **kwargs)
- Parameters:
goal (str) –
- Return type: