You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/langgraph/prompts.py
+42-20
Original file line number
Diff line number
Diff line change
@@ -4,42 +4,64 @@
4
4
"PREVIOUS TASKS:\n{task_log}\n\n"
5
5
"SUMMARY:\n")
6
6
7
-
DETERMINATION_PROMPT="""Based on the given context and available actions, generate a complex task that you desire to perform. Only respond with the task, and do not include any other text in your response. Your task can involve multiple chained actions. You do not need to provide any reasoning for the task. If you are given context, you may choose whether or not to use it. If you do not have context, you must still choose a task to perform.\n\n"
8
-
"CONTEXT SUMMARY:\n{context_summary}"
9
-
"\n\nAVAILABLE ACTIONS FOR EACH CONNECTION:\n\n"
10
-
"{connection_action_list}"
11
-
"Example Outputs:\n
12
-
1. Create a funny tweet and post it on Twitter
13
-
2. Search for tweets about a specific topic and reply to them"""
14
-
7
+
DETERMINATION_PROMPT="""Based on the provided user query and the actions available to you, clearly state the task you need to perform. Only respond with the task, and do not include any other text in your response. Your task can involve multiple chained actions, and you can use actions to acquire information (Perplexity can be used to search for information, or if the user is asking about information pertaining to crypto, you may be able to use the associated crypto connection to retrieve the information). You do not need to provide any reasoning for the task. Your task should be clear and specific.\n\n"
8
+
IF THE USER'S REQUEST IS A QUESTION AND NOT A TASK OR REQUEST THEN THE TASK IS: 'Answer the user's question: {user_query}'
9
+
\n\nUSER QUERY:\n{user_query}
10
+
\n\nAVAILABLE ACTIONS FOR EACH CONNECTION:\n\n
11
+
{connection_action_list}
12
+
"""
15
13
16
14
DIVISION_PROMPT="""Based on the given task and available actions, generate an action plan for the agent. Only respond with the list of steps needed (with the corresponding actions mentioned), and put each step on a new line. Only include actions that involve making requests—do not include actions like editing dialog boxes, clicking buttons, or other UI interactions.
17
15
18
-
TASK:
19
-
{current_task}
16
+
RULES:
17
+
- Do not combine multiple actions into one step
18
+
- Do not escape to a new line for a single step, until the step is complete
19
+
- Each step should represent a single action
20
+
- Be explicit about which parameters are required for each action
20
21
21
22
AVAILABLE ACTIONS FOR EACH CONNECTION:
22
23
{connection_action_list}
23
24
24
-
Example :
25
-
TASK: Create a funny tweet and post it on Twitter
25
+
LLM Configuration: {preferred_llm_config}
26
+
Choose the appropriate LLM connection based on the configuration provided above if the task involves generating text.
27
+
28
+
EXAMPLES:
29
+
Example Task #1: Create a funny tweet and post it on Twitter
26
30
27
31
Output:
28
-
1. Generate text using openai `generate-text` with the prompt "Create a funny tweet" and the specified system prompt
29
-
2. Post the generated text using `post-tweet` with the output from step 1 as the 'message' parameter
32
+
1. Generate text using openai `generate-text` with parameters {{"prompt": "Create a funny tweet", "system_prompt": "You are a witty comedian"}}
33
+
2. Post the generated text using `post-tweet` with parameters {{"message": "<output from step 1>"}}
34
+
35
+
Example Task #2: swap 0.2 sol for zerebro
30
36
31
-
Rules:
32
-
- Do not combine multiple actions into one step
33
-
- Do not escape to a new line for a single step, until the step is complete
34
-
- Each step should represent a single action
35
-
- Be explicit about which parameters are required for each action"""
37
+
Output:
38
+
1. Find the mint address of zerebro using the `get-token-by-ticker` action with parameters {{"ticker": "zerebro"}}
39
+
2. Swap 0.2 sol for zerebro using the `trade` action with parameters {{"input_token": "SOL", "output_token": "<mint address from step 1>", "amount": "0.2"}}
40
+
41
+
Example Task #3: Find the current price of Solana
42
+
43
+
Output:
44
+
1. Get the mint address of Solana using the `get-token-by-ticker` action with parameters {{"ticker": "SOL"}}
45
+
2. Get the price of Solana using the `get-price` action with parameters {{"mint_address": "<mint address from step 1>"}}
46
+
47
+
Notice how you should break down the task into smaller steps and you can use previous actions and their outputs to complete the task. Make sure to include all the necessary parameters for each action.
48
+
TASK:
49
+
{current_task}
50
+
"""
36
51
37
52
EXECUTION_PROMPT= ("Before executing the following action, consider the previous action log:\n\n"
38
53
"ACTION LOG:\n{action_log}\n\n"
39
54
"Here is your preferred configurations for LLM related actions:\n\n"
40
55
"LLM Configuration:\n{preferred_llm_config}\n\n"
41
-
"Make sure to use the exact configuration provided above for the `generate-text` action. Copy the entire configuration, including the complete system prompt.When used to create a text for a tweet, always specify it under 280 characters in the prompt\n\n"
56
+
"For the 'generate-text' action, extract only the system_prompt and model from the configuration above, ignoring the provider. When generating a tweet, ensure the output remains under 280 characters."
- Every parameter must be enclosed in quotes and provided as a key-value pair
60
+
- Each tool requires specific parameters as defined in its function signature
61
+
- Always include all required parameters for the tool being called
62
+
- Parameter names in the dictionary must exactly match the function parameter names"""
42
63
"Refer to the 'final_response' field in the tool action log to quickly see the final response from the agent\n\n"
64
+
"Important: Only execute the specified action—do not perform any additional actions beyond what is provided. For instance, if the action does not mention Twitter, do not invoke a Twitter-related tool. Follow the instructions precisely, step by step."
43
65
"Now, execute this action based on the prior results: {action}")
44
66
45
67
EVALUATION_PROMPT= ("Based on the action log, provide a summary of what the agent did based on the main task given. Only include the most important actions and the results of those actions. Do not include any actions that are irrelevant to the task or that did not produce a meaningful result.\n\n"
0 commit comments