Significant-Gravitas / Auto-GPT-Plugin-Template

A starting point for developing your own plug-in for Auto-GPT
MIT License
786 stars 208 forks source link

improve documentation #15

Open nalbion opened 1 year ago

nalbion commented 1 year ago

Could somebody please improve the documentation?

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

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:

on_response

Parameters:

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

Returns

Optional string - what/why?

post_planning

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

Parameters:

Returns

pre_instruction

This method is called before the instruction chat is done

Parameters

...can we get have an example?

Returns

the same messages?

on_instruction

This method is called when the instruction chat is done.

Parameters

...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

returns the user input as a string

report

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

Catley94 commented 1 year ago

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 :-)