Skip to content

improve documentation #15

@nalbion

Description

@nalbion

Could somebody please improve the documentation?

From what I can gather, a plugin must extend AutoGPTPluginTemplate and set:

  • self._name
  • self._version
  • self._description

It should also implement can_handle_xxxx methods, returning True only if they do something other than pass in xxxx, the options of which are:

post_prompt

This method is called just after the generate_prompt is called, but actually before the prompt is generated.

...why?

This seems to be the only method that any of the existing plugins currently implement.

I can see that they register commands that they can support, presumably this is only called once. I'm not sure how the class registers it self though.

I can see that they define the args that are provided to the function being registered. "imap_search_command": "<imap_search_criteria_command>", seems to break a convention - any reason, or is the string content just arbitrary?

Parameters:

  • prompt: PromptGenerator - okay, this is actually fairly well documented. The prompt is sent to the LLM

on_response

Parameters:

  • response - I guess we're expecting it's as per below?
  • *args - is this {"arg name": "value"} ?
  • *kwargs ...I've got no idea

Return

A string - but what should it look like? Who/what reads it and when/why?
...Is this just a string, as you'd see in a response from ChatGPT?

This method is called when a response is received from the model

response format

        {
          "thoughts": {
                "text": "thought",
                "reasoning": "reasoning",
                "plan": "- short bulleted\n- list that conveys\n- long-term plan",
                "criticism": "constructive self-criticism",
                "speak": "thoughts summary to say to user",
            },
            "command": {"name": "command name", "args": {"arg name": "value"}},
        }

on_planning

This method is called before the planning chat completion is done

...Who is involved in this "planning chat"?
...What are the messages? Are they just {role: "", content: ""}? Can somebody please provide a realistic example?

Parameters

  • prompt: PromptGenerator
  • messages: List[Message]

Returns

Optional string - what/why?

post_planning

This method is called after the planning chat completion is done.

Parameters:

  • response: str

Returns

  • str - what should this be?

pre_instruction

This method is called before the instruction chat is done

Parameters

  • messages (List[Message]): The list of context messages.

...can we get have an example?

Returns

the same messages?

on_instruction

This method is called when the instruction chat is done.

Parameters

  • messages (List[Message]): The list of context messages.

...what do the context messages look like? Are they for humans or the system?

post_instruction

This method is called after the instruction chat is done

Args:
response (str): The response.

    Returns:
        str: The resulting response.

pre_command

This method is called before the command is executed

...some example use cases for some of these would be useful

Args:
command_name (str): The command name.
arguments (Dict[str, Any]): The arguments.

post_command

This method is called after the command is executed.

    Args:
        command_name (str): The command name.
        response (str): The response.

    Returns:
        str: The resulting response.

handle_chat_completion

This method is called when the chat completion is done.

...the whole session or one turn?

  Args:
        messages (List[Message]): The messages.
        model (str): The model name.
        temperature (float): The temperature.
        max_tokens (int): The max tokens.

user_input

This method is called to request user input to the user

  • user_input (str): The question or prompt to ask the user.

returns the user input as a string

report

Generates a report to the user
...what's in the message?

  • mesage: str

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions