This commit is contained in:
Harrison Chase
2024-01-15 16:35:46 -08:00
parent 62c8689adf
commit 2dfe20d9c6
5 changed files with 304 additions and 0 deletions
+60
View File
@@ -10,6 +10,66 @@
"In this notebook we will go over how to build a basic agent executor from scratch."
]
},
{
"cell_type": "markdown",
"id": "c0860511-03c2-49bb-937b-035f84142b7e",
"metadata": {},
"source": [
"## Setup¶\n",
"First we need to install the packages required"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fdd4ce41-4152-423b-b3f7-be3b4d568cf4",
"metadata": {},
"outputs": [],
"source": [
"!pip install --quiet -U langchain langchain_openai tavily-python"
]
},
{
"cell_type": "markdown",
"id": "5f4179ce-48fa-4aaf-a5a1-027b5229be1a",
"metadata": {},
"source": [
"Next, we need to set API keys for OpenAI (the LLM we will use) and Tavily (the search tool we will use)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6398c4c1-da78-4595-8a5a-051ed2d1de72",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import getpass\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")\n",
"os.environ[\"TAVILY_API_KEY\"] = getpass.getpass(\"Tavily API Key:\")"
]
},
{
"cell_type": "markdown",
"id": "37943b1c-2b0a-4c09-bfbd-5dc24b839e3c",
"metadata": {},
"source": [
"Optionally, we can set API key for [LangSmith tracing](https://smith.langchain.com/), which will give us best-in-class observability."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "dcbf79ad-4de5-43b0-a3a1-25b33711e46c",
"metadata": {},
"outputs": [],
"source": [
"os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
"os.environ[\"LANGCHAIN_API_KEY\"] = getpass.getpass(\"LangSmith API Key:\")"
]
},
{
"cell_type": "markdown",
"id": "5dace4a9-7c9e-4da2-bf7b-e58d0d05581e",
@@ -14,6 +14,67 @@
"Any modifications of that example are called below with **MODIFICATION**, so if you are looking for the differences you can just search for that."
]
},
{
"cell_type": "markdown",
"id": "6821de30-6eeb-4f70-b0a7-e05d3187b14b",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"First we need to install the packages required"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "694cfc4c-22a7-495d-930d-56b21d850ff9",
"metadata": {},
"outputs": [],
"source": [
"!pip install --quiet -U langchain langchain_openai tavily-python"
]
},
{
"cell_type": "markdown",
"id": "dc039752-6d34-4ad4-aa31-9a10f4d4d597",
"metadata": {},
"source": [
"Next, we need to set API keys for OpenAI (the LLM we will use) and Tavily (the search tool we will use)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "30c06a84-291a-4f58-9d31-53d3b56a3def",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import getpass\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")\n",
"os.environ[\"TAVILY_API_KEY\"] = getpass.getpass(\"Tavily API Key:\")"
]
},
{
"cell_type": "markdown",
"id": "5e7f4767-54fb-4b6e-bd9a-3d433df924fb",
"metadata": {},
"source": [
"Optionally, we can set API key for [LangSmith tracing](https://smith.langchain.com/), which will give us best-in-class observability."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a8fb285a-7e6e-46fc-a273-43ab1a676189",
"metadata": {},
"outputs": [],
"source": [
"os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
"os.environ[\"LANGCHAIN_API_KEY\"] = getpass.getpass(\"LangSmith API Key:\")"
]
},
{
"cell_type": "markdown",
"id": "5dace4a9-7c9e-4da2-bf7b-e58d0d05581e",
+61
View File
@@ -12,6 +12,67 @@
"However, it is highly likely you will want to customize the logic - for information on that, check out the other examples in this folder."
]
},
{
"cell_type": "markdown",
"id": "e6dd032b-bfe9-458c-a8ef-a14c78e0ad3f",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"First we need to install the packages required"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1759bc06-8af3-4b73-abbf-0be3fa4c31fb",
"metadata": {},
"outputs": [],
"source": [
"!pip install --quiet -U langchain langchain_openai tavily-python"
]
},
{
"cell_type": "markdown",
"id": "fa08bd1a-efaa-46f5-adf8-47a84f738381",
"metadata": {},
"source": [
"Next, we need to set API keys for OpenAI (the LLM we will use) and Tavily (the search tool we will use)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "eb8e51dc-028b-4ea5-9847-f22fcbed6dac",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import getpass\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")\n",
"os.environ[\"TAVILY_API_KEY\"] = getpass.getpass(\"Tavily API Key:\")"
]
},
{
"cell_type": "markdown",
"id": "9242c0d7-b1da-41a0-9a3e-ed3afab3528e",
"metadata": {},
"source": [
"Optionally, we can set API key for [LangSmith tracing](https://smith.langchain.com/), which will give us best-in-class observability."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5db4438c-7802-4050-9dd9-14a6cac21a91",
"metadata": {},
"outputs": [],
"source": [
"os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
"os.environ[\"LANGCHAIN_API_KEY\"] = getpass.getpass(\"LangSmith API Key:\")"
]
},
{
"cell_type": "markdown",
"id": "6ae180d9-abd3-4a44-8fb1-a2c89434fbeb",
@@ -14,6 +14,67 @@
"Any modifications of that example are called below with **MODIFICATION**, so if you are looking for the differences you can just search for that."
]
},
{
"cell_type": "markdown",
"id": "f7714f98-eb0e-43dd-8ae7-4a32ef2e72de",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"First we need to install the packages required"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3fa9e224-2f00-49e2-bca3-e9cb8d9f3d41",
"metadata": {},
"outputs": [],
"source": [
"!pip install --quiet -U langchain langchain_openai tavily-python"
]
},
{
"cell_type": "markdown",
"id": "2dd8be50-2f92-478b-a918-6d9e4ad66dd6",
"metadata": {},
"source": [
"Next, we need to set API keys for OpenAI (the LLM we will use) and Tavily (the search tool we will use)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d180f0d0-385f-4ce3-994c-11e1d64595b5",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import getpass\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")\n",
"os.environ[\"TAVILY_API_KEY\"] = getpass.getpass(\"Tavily API Key:\")"
]
},
{
"cell_type": "markdown",
"id": "31d59506-f33f-42ad-b072-9a344c4af2e6",
"metadata": {},
"source": [
"Optionally, we can set API key for [LangSmith tracing](https://smith.langchain.com/), which will give us best-in-class observability."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "72ad0539-ecd8-4eb1-b2c1-2242e5fc556f",
"metadata": {},
"outputs": [],
"source": [
"os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
"os.environ[\"LANGCHAIN_API_KEY\"] = getpass.getpass(\"LangSmith API Key:\")"
]
},
{
"cell_type": "markdown",
"id": "5dace4a9-7c9e-4da2-bf7b-e58d0d05581e",
@@ -14,6 +14,67 @@
"Any modifications of that example are called below with **MODIFICATION**, so if you are looking for the differences you can just search for that."
]
},
{
"cell_type": "markdown",
"id": "bd763d4e-fd5e-4ce4-aa3a-54ab895d10a6",
"metadata": {},
"source": [
"## Setup\n",
"\n",
"First we need to install the packages required"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aa752131-27e3-4bd8-9f21-d6749a7e74f4",
"metadata": {},
"outputs": [],
"source": [
"!pip install --quiet -U langchain langchain_openai tavily-python"
]
},
{
"cell_type": "markdown",
"id": "dbbfe916-5c23-4bf4-a5fa-5048e676dae3",
"metadata": {},
"source": [
"Next, we need to set API keys for OpenAI (the LLM we will use) and Tavily (the search tool we will use)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5732e68f-4ae2-4db9-bf9c-454b4cc9ec01",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import getpass\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = getpass.getpass(\"OpenAI API Key:\")\n",
"os.environ[\"TAVILY_API_KEY\"] = getpass.getpass(\"Tavily API Key:\")"
]
},
{
"cell_type": "markdown",
"id": "4141f30e-4e5a-4b98-9fd8-b95e859d203a",
"metadata": {},
"source": [
"Optionally, we can set API key for [LangSmith tracing](https://smith.langchain.com/), which will give us best-in-class observability."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "652d4600-8f95-493f-b9b9-d4095aed9218",
"metadata": {},
"outputs": [],
"source": [
"os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
"os.environ[\"LANGCHAIN_API_KEY\"] = getpass.getpass(\"LangSmith API Key:\")"
]
},
{
"cell_type": "markdown",
"id": "5dace4a9-7c9e-4da2-bf7b-e58d0d05581e",