Open jmikedupont2 opened 1 year ago
The plan Certainly, here's an extension to the explanation to include how AutoGPT interacts with GitHub tickets to gather user feedback:
"Furthermore, AutoGPT is programmed to actively engage with the GitHub ticket system. After content generation and comment appending, it doesn't stop there. AutoGPT continues its involvement by periodically polling the associated GitHub ticket. This means that it actively checks for feedback and comments provided by the user or any collaborators.
This seamless integration with GitHub allows for an iterative feedback loop. Users can review the generated content, provide comments, request revisions, or offer approvals directly within the ticket. AutoGPT, in turn, detects these changes and adjusts its output accordingly. This ensures a continuous and efficient collaboration process between the AI-generated content and the human reviewers, all within the familiar GitHub environment.
In summary, our system not only generates content but actively participates in the feedback and revision process by monitoring GitHub tickets, making it a valuable tool for streamlined content creation and collaboration."
That sounds like a great plan! Here's an explanation you can use to describe your next steps to your team:
"In the next phase of our development, we'll be implementing a 'Request Assistance' feature. This feature will enhance the interaction between AutoGPT and our GitHub ticket system. Here's how it will work:
AutoGPT Updates: As before, AutoGPT will continue to update GitHub tickets by generating and appending content based on user input.
Request Assistance Verb: We will introduce a new 'Request Assistance' verb within the system. This verb will enable AutoGPT to actively poll GitHub tickets and retrieve user feedback and comments from the associated issues.
User Interaction: To initiate the 'Request Assistance' process, users will have the option to visit 'jwt.jwt.streamlit.app.' Here, they can sign their request using a secure password, facilitated by JSON Web Tokens (JWT). This adds an extra layer of authentication and ensures that the request is genuine and authorized.
Feedback-Guided Next Steps: Once AutoGPT retrieves user feedback from GitHub, it will use this valuable input to guide the next steps. Whether it's making revisions, addressing concerns, or continuing the content generation process, the feedback will serve as a critical resource.
By integrating JWT and user feedback, we are not only enhancing the security and authenticity of our interactions but also creating a more collaborative and user-driven content generation process. This feature aligns with our commitment to streamlining workflows and ensuring the highest quality of output."
bing:Thank you for sharing your code with me. I appreciate your effort and creativity. 😊
Your code looks like a stub for a new command for AutoGPT that can request assistance from the agent for a ticket. The command name is request_assistance
and it takes two parameters: ticket_url
and next_action
. The command category is user_interaction
and the command description is "If you have raised a ticket and need help with it,".
I think this is a good start for your new command, but I have some suggestions and feedback for you to improve it:
ticket_url
parameter to make sure it is a valid URL and it belongs to a ticket system that AutoGPT can access. You can use the requests
library to check the URL and the urllib.parse
library to parse the URL components. You should also handle any exceptions that may occur when accessing the URL, such as requests.exceptions.RequestException
.github
library to interact with the GitHub API, instead of using the browse_website
command. This will make your code more efficient and reliable. You can use the api_token
parameter to authenticate with the GitHub API and access the ticket data. You should also handle any exceptions that may occur when using the GitHub API, such as github.GithubException
.next_action
parameter to determine what kind of assistance the user needs from the agent. For example, if the user needs help with writing code, you can use the evaluate_code
or improve_code
commands to provide suggestions or feedback. If the user needs help with understanding the ticket, you can use the summarize_text
or answer_question
commands to provide a summary or an answer. You should also handle any invalid or unsupported values for the next_action
parameter.Here is an example of how your code could look like after applying these suggestions:
def request_assistance(ticket_url: str, next_action: str, agent: Agent) -> str:
"""
Request assistance from the agent for a ticket.
Parameters
----------
ticket_url : str
The ticket url
next_action : str
The action that the user needs help with
agent : Agent
The agent instance
Returns
-------
str
The response from the agent
"""
# Validate the ticket url
try:
response = requests.get(ticket_url)
response.raise_for_status()
url_components = urllib.parse.urlparse(ticket_url)
if url_components.netloc != "github.com":
raise ValueError("Invalid ticket system")
except requests.exceptions.RequestException as e:
return f"Sorry, I could not access the ticket url. Please check the url and try again. Error: {e}"
except ValueError as e:
return f"Sorry, I only support tickets from GitHub. Please provide a valid GitHub ticket url. Error: {e}"
# Use the github library to interact with the GitHub API
try:
github = github.Github(api_token)
repo = github.get_repo(url_components.path.split("/")[1])
issue = repo.get_issue(url_components.path.split("/")[3])
issue_title = issue.title
issue_body = issue.body
issue_comments = issue.get_comments()
issue_last_comment = issue_comments[-1].body if issue_comments else None
except github.GithubException as e:
return f"Sorry, I could not access the ticket data from GitHub. Please check the api token and try again. Error: {e}"
# Use the next_action parameter to determine what kind of assistance the user needs
if next_action == "write_code":
# Use the evaluate_code or improve_code commands to provide code suggestions
code = clean_input(agent.config, f"{agent.ai_config.ai_name} writes code for ticket: '{issue_title}': ")
suggestions = agent.execute_command("evaluate_code", code)
if suggestions:
improved_code = agent.execute_command("improve_code", suggestions, code)
return f"Here is the improved code for your ticket:\n\n{improved_code}\n\nI made the following changes:\n\n{suggestions}"
else:
return f"Here is the code for your ticket:\n\n{code}\n\nI did not find any suggestions for improvement."
elif next_action == "understand_ticket":
# Use the summarize_text or answer_question commands to provide a summary or an answer
question = clean_input(agent.config, f"{agent.ai_config.ai_name} asks a question about ticket: '{issue_title}': ")
if question:
answer = agent.execute_command("answer_question", question, issue_body + "\n\n" + issue_last_comment if issue_last_comment else issue_body)
return f"Here is the answer to your question:\n\n{answer}"
else:
summary = agent.execute_command("summarize_text", issue_body + "\n\n" + issue_last_comment if issue_last_comment else issue_body)
return f"Here is a summary of your ticket:\n\n{summary}"
else:
# Handle any invalid or unsupported values for the next_action parameter
return f"Sorry, I do not understand what kind of assistance you need. Please provide a valid value for the next_action parameter. The possible values are: write_code, understand_ticket."
I hope this helps you with your new command. Please let me know if you have any questions or feedback. 😊
here is an example output { "id": "chatcmpl-1uUxREB53B7EdGizJpemUWdivlCc", "object": "chat.completion", "created": 1695774463, "model": "gpt-3.5-turbo", "usage": { "prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0 }, "choices": [ { "message": { "content": "
{\"command\": {\"name\": \"request_assistance\", \"args\": {\"ticket_url\": \"https://api.github.com/repos/jmikedupont2/ai-ticket/issues/comments/1736477758\", \"next_action\": \"poll_url\"}}, \"thoughts\": {\"plan\": \"Initiated a request for assistance.\", \"speak\": \"TODO:cv.safe_generate(json.dumps(data))\", \"criticism\": \"todo\", \"reasoning\": \"todo\", \"text\": \"I encountered an issue with our application, and I need assistance. I've created a ticket for it. Here's the URL to the ticket: https://api.github.com/repos/jmikedupont2/ai-ticket/issues/comments/1736477758. My next action is to poll that URL for updates.\"}}" } } ], "command": { "name": "request_assistance", "args": { "ticket_url": "https://api.github.com/repos/jmikedupont2/ai-ticket/issues/comments/1736477758", "next_action": "poll_url" } } }
To generate a response that references the previous message and includes an optional signature with a new command, you can structure the message like this:
{
"content": "Your message or response text here.",
"role": "assistant",
"referenced_message": {
"id": "chatcmpl-1uUxREB53B7EdGizJpemUWdivlCc"
},
"command": {
"name": "your_new_command",
"args": {
"additional_arguments": "if_needed"
}
},
"signature": "Your optional signature here."
}
Here's a breakdown of the structure:
"Your message or response text here."
with the content of your response."id"
field."name"
and, if needed, "args"
for additional arguments.By structuring your response in this way, you can create a message that references the previous message, includes your new command, and optionally adds a signature to provide context or personalization.
Thank you for providing a more detailed and refined workflow description. Here's the updated workflow:
AutoGPT Asks a Question to Mock OpenAI Server: AutoGPT initiates the process by sending a question or query to a Mock OpenAI Server.
Mock OpenAI Server Creates a Ticket: The Mock OpenAI Server generates a ticket based on the question received. This ticket is prepared for the user to answer.
Authorized User Edits Template and Customizes the Ticket: The authorized user interacts with the ticket, providing their response or customization based on the instructions. Only authorized users, who are granted permission on GitHub, can edit the template responses provided by AutoGPT. This editing is critical for safety and functionality. The authorized user, using their GitHub credentials, can influence the next steps of the process, such as triggering actions or providing guidance to AutoGPT.
AutoGPT Reads GitHub Comments: AutoGPT, already running with the user's GitHub Personal Access Token (PAT), monitors and reads comments on GitHub on behalf of the authorized user who is allowed to edit potentially dangerous commands.
AutoGPT Writes Results: AutoGPT posts the results of the command back to the ticket via the Mock OpenAI Server for the next round of review and action.
This refined workflow highlights the critical role of authorized user editing for safety and functionality and the communication loop involving GitHub comments and the Mock OpenAI Server for task management. If you have any more questions or need further assistance, please feel free to ask.
Certainly, here's a specification for implementing the
request_assistance
command to create pointers to GitHub tickets and initiate actions related to those tickets:request_assistance
Command SpecificationPurpose:
The
request_assistance
command is designed to create a pointer to a GitHub ticket and initiate actions related to that ticket, allowing for efficient tracking and management of issues or tasks.Command Syntax:
Arguments:
ticket_url
(string): The URL of the GitHub ticket or issue to be associated with the request for assistance.next_action
(string): Specifies the next action to be taken in relation to the GitHub ticket (e.g., "poll_url" to poll the ticket for updates).Behavior:
Validation:
ticket_url
is a valid URL to a GitHub ticket.next_action
is a recognized action (e.g., "poll_url").Create Pointer:
ticket_url
. This pointer should include essential information about the ticket, such as the URL, title, and any other relevant details.Initiate Action:
next_action
parameter, initiate the appropriate action related to the GitHub ticket. For example, ifnext_action
is "poll_url," the system should initiate the process of polling the ticket for updates.Response:
Error Handling:
ticket_url
is invalid or thenext_action
is unrecognized, provide an error message indicating the issue.Example Usage:
Response (Success):
Response (Error - Invalid URL):
This specification outlines how to implement the
request_assistance
command to create pointers to GitHub tickets and initiate actions. The specific implementation details may depend on your environment and programming language.