Fixed yaml formatting issues, save context for action = answer
1. yaml formatting issue fixed. 2. store context if action = answer.
This commit is contained in:
parent
4ab2bb6459
commit
6e94481c29
|
|
@ -18,7 +18,7 @@ class DecideAction(Node):
|
|||
|
||||
print(f"🤔 Agent deciding what to do next...")
|
||||
|
||||
# Create a prompt to help the LLM decide what to do next
|
||||
# Create a prompt to help the LLM decide what to do next with proper yaml formatting
|
||||
prompt = f"""
|
||||
### CONTEXT
|
||||
You are a research assistant that can search the web.
|
||||
|
|
@ -45,8 +45,14 @@ thinking: |
|
|||
<your step-by-step reasoning process>
|
||||
action: search OR answer
|
||||
reason: <why you chose this action>
|
||||
answer: <if action is answer>
|
||||
search_query: <specific search query if action is search>
|
||||
```"""
|
||||
```
|
||||
IMPORTANT: Make sure to:
|
||||
1. Use proper indentation (4 spaces) for all multi-line fields
|
||||
2. Use the | character for multi-line text fields
|
||||
3. Keep single-line fields without the | character
|
||||
"""
|
||||
|
||||
# Call the LLM to make a decision
|
||||
response = call_llm(prompt)
|
||||
|
|
@ -64,6 +70,7 @@ search_query: <specific search query if action is search>
|
|||
shared["search_query"] = exec_res["search_query"]
|
||||
print(f"🔍 Agent decided to search for: {exec_res['search_query']}")
|
||||
else:
|
||||
shared["context"] = exec_res["answer"] #save the context if LLM gives the answer without searching.
|
||||
print(f"💡 Agent decided to answer the question")
|
||||
|
||||
# Return the action to determine the next node in the flow
|
||||
|
|
|
|||
Loading…
Reference in New Issue