Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 60 additions & 9 deletions 1_foundations/1_lab1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
"source": [
"# Create a list of messages in the familiar OpenAI format\n",
"\n",
"messages = [{\"role\": \"user\", \"content\": \"Tell me a fun fact\"}]"
"messages = [{\"role\": \"user\", \"content\": \"tell me how llm works?\"}]"
Comment on lines 187 to +189
]
},
{
Expand Down Expand Up @@ -343,19 +343,70 @@
"metadata": {},
"outputs": [],
"source": [
"# First create the messages:\n",
"# First create the messages\n",
"\n",
"messages = [\n",
" {\n",
" \"role\": \"user\",\n",
Comment on lines +346 to +350
" \"content\": \"\"\"\n",
"Hey!! I'm working on a project of my own.\n",
"I'm building a startup, like a web platform, called Pahadi Orchard.com\n",
"where orchardists can manage their spray schedule, yield production,\n",
"and other orchard-related activities.\n",
"\n",
"Can you tell me how I can integrate an LLM into my project?\n",
"\"\"\"\n",
" }\n",
"]\n",
"\n",
"# First API call\n",
"\n",
"response = openai.chat.completions.create(\n",
" model=\"gpt-5.4-nano\",\n",
" messages=messages\n",
")\n",
"\n",
"# Extract the actual AI response\n",
"\n",
"business_analysis = response.choices[0].message.content\n",
"\n",
"print(\"FIRST AI RESPONSE:\")\n",
"print(business_analysis)\n",
"\n",
"messages = [{\"role\": \"user\", \"content\": \"Something here\"}]\n",
"\n",
"# Then make the first call:\n",
"# Create a new message using the first AI's analysis\n",
"\n",
"messages = [\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": f\"\"\"\n",
"Here is an analysis of my startup idea given by another AI:\n",
"\n",
"{business_analysis}\n",
"\n",
"Now analyze this idea further.\n",
"\n",
"Make the idea better.\n",
"Suggest the areas I should focus on.\n",
"Highlight the areas that need improvement.\n",
"Suggest important features that I may be missing.\n",
"\"\"\"\n",
" }\n",
"]\n",
"\n",
"# Second API call\n",
"\n",
"response =\n",
"response = openai.chat.completions.create(\n",
" model=\"gpt-5.4-nano\",\n",
" messages=messages\n",
")\n",
"\n",
"# Then read the business idea:\n",
"# Extract the second AI response\n",
"\n",
"business_area = response.\n",
"business_area = response.choices[0].message.content\n",
"\n",
"# And repeat! In the next message, include the business area within the message"
"print(\"\\nSECOND AI RESPONSE:\")\n",
"print(business_area)"
]
},
{
Expand All @@ -366,7 +417,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "agents (3.12.12)",
"language": "python",
"name": "python3"
},
Expand Down