From b579bd04a80cdf289e2c722508a15644162076bf Mon Sep 17 00:00:00 2001 From: Jeff Tang Date: Fri, 15 Nov 2024 09:40:32 -0800 Subject: [PATCH] colab links fix --- ...Gen_L4_Tool_Use_and_Conversational_Chess.ipynb | 10 +++++----- ...LangGraph_L1_Build_an_Agent_from_Scratch.ipynb | 15 +++++++-------- ...tic_RAG_with_Llamaindex_L1_Router_Engine.ipynb | 2 +- ...gents_with_LangChain_L1_Function_Calling.ipynb | 8 ++++---- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/AI_Agentic_Design_Patterns_with_AutoGen_L4_Tool_Use_and_Conversational_Chess.ipynb b/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/AI_Agentic_Design_Patterns_with_AutoGen_L4_Tool_Use_and_Conversational_Chess.ipynb index 7dbff8676..d692ef744 100644 --- a/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/AI_Agentic_Design_Patterns_with_AutoGen_L4_Tool_Use_and_Conversational_Chess.ipynb +++ b/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/AI_Agentic_Design_Patterns_with_AutoGen_L4_Tool_Use_and_Conversational_Chess.ipynb @@ -5,7 +5,7 @@ "id": "7a4b75bb-d60a-41e3-abca-1ca0f0bf1201", "metadata": {}, "source": [ - "\"Open" + "\"Open" ] }, { @@ -63,7 +63,7 @@ "outputs": [], "source": [ "def get_legal_moves(\n", - " \n", + "\n", ") -> Annotated[str, \"A list of legal moves in UCI format\"]:\n", " return \"Possible moves are: \" + \",\".join(\n", " [str(move) for move in board.legal_moves]\n", @@ -86,7 +86,7 @@ " board.push_uci(str(move))\n", " global made_move\n", " made_move = True\n", - " \n", + "\n", " svg_str = chess.svg.board(\n", " board,\n", " arrows=[(move.from_square, move.to_square)],\n", @@ -96,7 +96,7 @@ " display(\n", " SVG(data=svg_str)\n", " )\n", - " \n", + "\n", " # Get the piece name.\n", " piece = board.piece_at(move.to_square)\n", " piece_symbol = piece.unicode_symbol()\n", @@ -223,7 +223,7 @@ " name=\"get_legal_moves\",\n", " description=\"Call this tool to get all legal moves in UCI format.\",\n", " )\n", - " \n", + "\n", " register_function(\n", " make_move,\n", " caller=caller,\n", diff --git a/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/AI_Agents_in_LangGraph_L1_Build_an_Agent_from_Scratch.ipynb b/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/AI_Agents_in_LangGraph_L1_Build_an_Agent_from_Scratch.ipynb index 7c691300a..7e7c834fd 100644 --- a/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/AI_Agents_in_LangGraph_L1_Build_an_Agent_from_Scratch.ipynb +++ b/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/AI_Agents_in_LangGraph_L1_Build_an_Agent_from_Scratch.ipynb @@ -5,7 +5,7 @@ "id": "de56ee05-3b71-43c9-8cbf-6ad9b3233f38", "metadata": {}, "source": [ - "\"Open" + "\"Open" ] }, { @@ -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", diff --git a/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/Building_Agentic_RAG_with_Llamaindex_L1_Router_Engine.ipynb b/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/Building_Agentic_RAG_with_Llamaindex_L1_Router_Engine.ipynb index 67eda87f7..2e0ae2a9b 100644 --- a/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/Building_Agentic_RAG_with_Llamaindex_L1_Router_Engine.ipynb +++ b/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/Building_Agentic_RAG_with_Llamaindex_L1_Router_Engine.ipynb @@ -45,7 +45,7 @@ }, "outputs": [], "source": [ - "import os \n", + "import os\n", "os.environ['GROQ_API_KEY'] = 'your_groq_api_key' # get a free key at https://console.groq.com/keys" ] }, diff --git a/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/Functions_Tools_and_Agents_with_LangChain_L1_Function_Calling.ipynb b/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/Functions_Tools_and_Agents_with_LangChain_L1_Function_Calling.ipynb index c54785e57..a8d521bfa 100644 --- a/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/Functions_Tools_and_Agents_with_LangChain_L1_Function_Calling.ipynb +++ b/recipes/quickstart/agents/DeepLearningai_Course_Notebooks/Functions_Tools_and_Agents_with_LangChain_L1_Function_Calling.ipynb @@ -5,7 +5,7 @@ "id": "2ba1b4ef-3b96-4e7e-b5d0-155b839db73c", "metadata": {}, "source": [ - "\"Open" + "\"Open" ] }, { @@ -62,7 +62,7 @@ "outputs": [], "source": [ "# https://console.groq.com/docs/tool-use#models\n", - "# Groq API endpoints support tool use for programmatic execution of specified operations through requests with explicitly defined \n", + "# Groq API endpoints support tool use for programmatic execution of specified operations through requests with explicitly defined\n", "# operations. With tool use, Groq API model endpoints deliver structured JSON output that can be used to directly invoke functions.\n", "\n", "from groq import Groq\n", @@ -145,8 +145,8 @@ " model=\"llama3-70b-8192\",\n", " messages=messages,\n", " functions=functions,\n", - " #tools=tools, # you can also replace functions with tools, as specified in https://console.groq.com/docs/tool-use \n", - " max_tokens=4096, \n", + " #tools=tools, # you can also replace functions with tools, as specified in https://console.groq.com/docs/tool-use\n", + " max_tokens=4096,\n", " temperature=0\n", ")" ]