|
@@ -5,7 +5,7 @@
|
|
|
"id": "de56ee05-3b71-43c9-8cbf-6ad9b3233f38",
|
|
|
"metadata": {},
|
|
|
"source": [
|
|
|
- "<a href=\"https://colab.research.google.com/github/meta-llama/llama-recipes/blob/main/recipes/quickstart/agents/dlai/AI_Agents_in_LangGraph_L1_Build_an_Agent_from_Scratch.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
|
|
+ "<a href=\"https://colab.research.google.com/github/meta-llama/llama-recipes/blob/main/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/AI_Agents_in_LangGraph_L1_Build_an_Agent_from_Scratch.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
|
|
]
|
|
|
},
|
|
|
{
|
|
@@ -35,7 +35,7 @@
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
- "import os \n",
|
|
|
+ "import os\n",
|
|
|
"from groq import Groq\n",
|
|
|
"\n",
|
|
|
"os.environ['GROQ_API_KEY'] = 'your_groq_api_key' # get a free key at https://console.groq.com/keys"
|
|
@@ -48,7 +48,7 @@
|
|
|
"metadata": {},
|
|
|
"outputs": [],
|
|
|
"source": [
|
|
|
- "# a quick sanity test of calling Llama 3 70b on Groq \n",
|
|
|
+ "# a quick sanity test of calling Llama 3 70b on Groq\n",
|
|
|
"# see https://console.groq.com/docs/text-chat for more info\n",
|
|
|
"client = Groq()\n",
|
|
|
"chat_completion = client.chat.completions.create(\n",
|
|
@@ -75,7 +75,7 @@
|
|
|
"source": [
|
|
|
"client = Groq()\n",
|
|
|
"model = \"llama3-8b-8192\" # this model works with the prompt below only for the first simpler example; you'll see how to modify the prompt to make it work for a more complicated question\n",
|
|
|
- "#model = \"llama3-70b-8192\" # this model works with the prompt below for both example questions \n",
|
|
|
+ "#model = \"llama3-70b-8192\" # this model works with the prompt below for both example questions\n",
|
|
|
"\n",
|
|
|
"class Agent:\n",
|
|
|
" def __init__(self, system=\"\"):\n",
|
|
@@ -95,8 +95,7 @@
|
|
|
" model=model,\n",
|
|
|
" temperature=0,\n",
|
|
|
" messages=self.messages)\n",
|
|
|
- " return completion.choices[0].message.content\n",
|
|
|
- " "
|
|
|
+ " return completion.choices[0].message.content\n"
|
|
|
]
|
|
|
},
|
|
|
{
|
|
@@ -151,7 +150,7 @@
|
|
|
" return eval(what)\n",
|
|
|
"\n",
|
|
|
"def average_dog_weight(name):\n",
|
|
|
- " if name in \"Scottish Terrier\": \n",
|
|
|
+ " if name in \"Scottish Terrier\":\n",
|
|
|
" return(\"Scottish Terriers average 20 lbs\")\n",
|
|
|
" elif name in \"Border Collie\":\n",
|
|
|
" return(\"a Border Collies average weight is 37 lbs\")\n",
|
|
@@ -423,7 +422,7 @@
|
|
|
"\n",
|
|
|
" # key to make the agent process fully automated:\n",
|
|
|
" # programtically call the external func with arguments, with the info returned by LLM\n",
|
|
|
- " observation = known_actions[action](action_input) \n",
|
|
|
+ " observation = known_actions[action](action_input)\n",
|
|
|
"\n",
|
|
|
" print(\"Observation:\", observation)\n",
|
|
|
" next_prompt = \"Observation: {}\".format(observation)\n",
|