-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction_planning_agent.py
More file actions
53 lines (42 loc) · 1.69 KB
/
action_planning_agent.py
File metadata and controls
53 lines (42 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# TODO: 1 - Import all required libraries, including the ActionPlanningAgent
from workflow_agents.base_agents import ActionPlanningAgent
import os
from dotenv import load_dotenv
# TODO: 2 - Load environment variables and define the openai_api_key variable with your OpenAI API key
load_dotenv()
# Define the parameters for the agent
openai_api_key = os.getenv("OPENAI_API_KEY")
knowledge = """
# Fried Egg
1. Heat pan with oil or butter
2. Crack egg into pan
3. Cook until white is set (2-3 minutes)
4. Season with salt and pepper
5. Serve
# Scrambled Eggs
1. Crack eggs into a bowl
2. Beat eggs with a fork until mixed
3. Heat pan with butter or oil over medium heat
4. Pour egg mixture into pan
5. Stir gently as eggs cook
6. Remove from heat when eggs are just set but still moist
7. Season with salt and pepper
8. Serve immediately
# Boiled Eggs
1. Place eggs in a pot
2. Cover with cold water (about 1 inch above eggs)
3. Bring water to a boil
4. Remove from heat and cover pot
5. Let sit: 4-6 minutes for soft-boiled or 10-12 minutes for hard-boiled
6. Transfer eggs to ice water to stop cooking
7. Peel and serve
"""
# TODO: 3 - Instantiate the ActionPlanningAgent, passing the openai_api_key and the knowledge variable
action_plan_agent= ActionPlanningAgent(openai_api_key, knowledge)
# TODO: 4 - Print the agent's response to the following prompt: "One morning I wanted to have scrambled eggs"
prompt = "One morning I wanted to have scrambled eggs"
action_agent_response = action_plan_agent.extract_steps_from_prompt(prompt)
print(action_agent_response)
print(f"ActionPromptAgent requests information from the LLM "
"by passing the question as a prompt "
"and included additional knowledge")