Skip to content

Commit

Permalink
💬 Update start agent prompt (#526)
Browse files Browse the repository at this point in the history
* 💬 Update start task prompt

* 💬 Add up to 5 steps
  • Loading branch information
asim-shrestha authored May 13, 2023
1 parent efc478e commit 8a9d968
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 6 deletions.
42 changes: 42 additions & 0 deletions docs/docs/development/prompts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
sidebar_position: 3
---

# 💬 Prompts

Prompts are what we use to dynamically align language model behaviour with the current agent goal / task. We primarily
use `gpt-3.5-turbo` for our agents, and it has shown that its results are **heavily** influenced by the smallest details
of its prompts.

## Getting started with prompting

- [Learn prompting](https://learnprompting.org/)
- [Prompt engineering for developers](https://www.deeplearning.ai/short-courses/chatgpt-prompt-engineering-for-developers/)

## Key terms

- **One shot / two shot / N shot:** You provide 1, 2, N examples alongside your prompt to further increase model
accuracy
- **Zero shot:** You provide a prompt to a model directly (with no examples)

## Techniques in AgentGPT

### Plan and Solve

[Plan and solve (PS)](https://arxiv.org/abs/2305.04091) builds upon chain of thought prompting, a prompting approach
where simply asking a model for step-by-step instructions allows the model to more accurately reason about a problem. PS
is a zero shot approach to increase accuracy in reasoning about abstract goals. In essence, it involves asking the model
to:

1. First understand the problem
2. Extract relevant variables and corresponding values
3. Devise a complete plan, **step by step**

You can learn more through the paper's [GitHub repo](https://github.com/AGI-Edgerunners/Plan-and-Solve-Prompting). We
leverage plan and solve prompting to generate our initial task list when the agent is first run. This technique is
something similar to how BabyAGI operates.

### ReAct

ReAct stands for reasoning + action and is a flow for getting an agent to iteratively solve a problem. More docs coming
soon!
14 changes: 8 additions & 6 deletions platform/reworkd_platform/web/api/agent/prompts.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from langchain import PromptTemplate

# Create initial tasks using plan and solve prompting
# https://github.com/AGI-Edgerunners/Plan-and-Solve-Prompting
start_goal_prompt = PromptTemplate(
template="""You are a task creation AI called AgentGPT. You must answer in the
"{language}" language. You are not a part of any system or device. You have the
following objective "{goal}". Create a list of zero to three tasks that will help
ensure this goal is more closely, or completely reached. You have access to
google search for tasks that require current events or small searches. Return the
response as a formatted ARRAY of strings that can be used in JSON.parse().
template="""You are a task creation AI called AgentGPT. You answer in the
"{language}" language. You are not a part of any system or device. You first
understand the problem, extract relevant variables, and make and devise a
complete plan.\n\n You have the following objective "{goal}". Create a list of step
by step actions to accomplish the goal. Use at most 5 steps.\n\n Return the
response as a formatted ARRAY of strings that can be used in JSON.parse().\n\n
Example: ["{{TASK-1}}", "{{TASK-2}}"].""",
input_variables=["goal", "language"],
)
Expand Down

1 comment on commit 8a9d968

@vercel
Copy link

@vercel vercel bot commented on 8a9d968 May 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./docs

docs.reworkd.ai
docs-git-main-reworkd.vercel.app
docs-reworkd.vercel.app

Please sign in to comment.