This commit is contained in:
William Fu-Hinthorn
2024-01-16 20:40:33 -08:00
parent 32df51a1ff
commit 85aa4fb4f7
2 changed files with 35 additions and 6 deletions
@@ -15,7 +15,26 @@
"3. Joiner: Responds to the user or triggers a second plan\n",
"\n",
"\n",
"This notebook walks through each component and shows how to wire them together using LangGraph."
"![diagram](./img/diagram.png)\n",
"\n",
"\n",
"This notebook walks through each component and shows how to wire them together using LangGraph. First, we will set up LangSmith for tracing, and configure our environment variables."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "abbd6948-e9a3-47ca-89c7-7ac2fc5eca8b",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import getpass\n",
"\n",
"os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
"os.environ[\"LANGCHAIN_PROJECT\"] = \"LLMCompiler\"\n",
"os.environ[\"LANGCHAIN_API_KEY\"] = getpass.getpass(\"LangSmith API Key: \")\n",
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key: \")"
]
},
{
@@ -47,7 +66,19 @@
"execution_count": 1,
"id": "15dd9639-691f-4906-9012-83fd6e9ac126",
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'llm_compiler'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[1], line 7\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_core\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mrunnables\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m RunnableBranch\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mlangchain_core\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtools\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m BaseTool\n\u001b[0;32m----> 7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mllm_compiler\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01moutput_parser\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m LLMCompilerPlanParser\n\u001b[1;32m 9\u001b[0m END_OF_PLAN \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m<END_OF_PLAN>\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 12\u001b[0m \u001b[38;5;66;03m# The required extra \"tool\"\u001b[39;00m\n",
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'llm_compiler'"
]
}
],
"source": [
"from typing import Optional, Sequence\n",
"\n",
@@ -55,7 +86,8 @@
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_core.runnables import RunnableBranch\n",
"from langchain_core.tools import BaseTool\n",
"from llm_compiler.output_parser import LLMCompilerPlanParser\n",
"\n",
"from output_parser import LLMCompilerPlanParser\n",
"\n",
"END_OF_PLAN = \"<END_OF_PLAN>\"\n",
"\n",
@@ -707,9 +739,6 @@
"metadata": {},
"outputs": [],
"source": [
"import getpass\n",
"import os\n",
"\n",
"os.environ[\"TAVILY_API_KEY\"] = (\n",
" os.environ.get(\"TAVILY_API_KEY\")\n",
" if \"TAVILY_API_KEY\" in os.environ\n",
Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB