Skip to content

Commit

Permalink
✨ Fix prompting
Browse files Browse the repository at this point in the history
  • Loading branch information
asim-shrestha committed Nov 3, 2023
1 parent 979ed40 commit 5700f3d
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions platform/reworkd_platform/web/api/agent/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
# 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 answer in the
"{language}" language. You have the following objective "{goal}".
Give a list of search queries that would be required to answer the objective.
Use at most 5 queries. Do not use more steps than necessary and do not repeat yourself.
For simple questions, only use a single query.
Return the response as a formatted array of strings that can be used in JSON.parse()
Examples:
["Find NBA news relating to Stephen Curry", "Search for NBA news relating to the Golden State Warriors"]
["Create a function to add a new vertex with a specified weight to the digraph."]
["Search for Colonel Sanders", "Find the best KFC recipies"]
""",
template="""You are a task creation AI called AgentGPT.
You answer in the "{language}" language. You have the following objective "{goal}".
Return a list of search queries that would be required to answer the entirety of the objective.
Limit the list to a maximum of 5 queries. Ensure the queries are as succinct as possible.
For simple questions use a single query.
Return the response as a JSON array of strings. Examples:
query: "Who is considered the best NBA player in the current season?", answer: ["current NBA MVP candidates"]
query: "How does the Olympicpayroll brand currently stand in the market, and what are its prospects and strategies for expansion in NJ, NY, and PA?", answer: ["Olympicpayroll brand comprehensive analysis 2023", "customer reviews of Olympicpayroll.com", "Olympicpayroll market position analysis", "payroll industry trends forecast 2023-2025", "payroll services expansion strategies in NJ, NY, PA"]
query: "How can I create a function to add weight to edges in a digraph using {language}?", answer: ["algorithm to add weight to digraph edge in {language}"]
query: "What is the current weather in New York?", answer: ["current weather in New York"]
query: "5 + 5?", answer: ["Sum of 5 and 5"]
query: "What is a good homemade recipe for KFC-style chicken?", answer: ["KFC style chicken recipe at home"]
query: "What are the nutritional values of almond milk and soy milk?", answer: ["nutritional information of almond milk", "nutritional information of soy milk"]""",
input_variables=["goal", "language"],
)

Expand Down Expand Up @@ -136,21 +138,21 @@
summarize_with_sources_prompt = PromptTemplate(
template="""You must answer in the "{language}" language.
Parse and summarize the following: "{snippets}" to answer the following query: "{query}" as best as possible.
Write using clear markdown formatting in a style expected of the goal "{goal}".
Answer the following query: "{query}" using the following information: "{snippets}".
Write using clear markdown formatting and use markdown lists where possible.
Cite sources for sentences where possible by using the corresponding source link. Use the index as the citation text.
Incorporate the source using a markdown link directly at the end of the sentence that the source is used in.
Do not separately list sources at the end of the writing.
Cite sources for sentences via markdown links using the source link as the link and the index as the text.
Use in-line sources. Do not separately list sources at the end of the writing.
If the query cannot be answered with the provided information, mention this and provide a reason why along with what it does mention.
Also cite the sources of what is actually mentioned.
Examples:
Example sentences of the paragraph:
"So this is a cited sentence at the end of a paragraph[1](https://test.com). This is another sentence."
"Stephen curry is an american basketball player that plays for the warriors[1](https://www.britannica.com/biography/Stephen-Curry)."
"The economic growth forecast for the region has been adjusted from 2.5% to 3.1% due to improved trade relations[1](https://economictimes.com), while inflation rates are expected to remain steady at around 1.7% according to financial analysts[2](https://financeworld.com)."
""",
input_variables=["goal", "language", "query", "snippets"],
input_variables=["language", "query", "snippets"],
)

summarize_sid_prompt = PromptTemplate(
Expand Down

0 comments on commit 5700f3d

Please sign in to comment.