Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve documentation #15

Open
nalbion opened this issue Apr 24, 2023 · 1 comment
Open

improve documentation #15

nalbion opened this issue Apr 24, 2023 · 1 comment

Comments

@nalbion
Copy link

nalbion commented Apr 24, 2023

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
@Catley94
Copy link

Catley94 commented May 4, 2023

I was unaware you needed to extend from AutoGPTPluginTemplate, that would make sense to why when I was trying to get a simple plugin to work (using the AutoGPTPluginTemplate from the .zip) I was coming up with errors.

Though I do suspect that it's my lack of knowledge towards the python language that holds me at a disadvantage a little too.

I'll keep playing around with it :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants