Skip to content

Commit

Permalink
update title and env loading
Browse files Browse the repository at this point in the history
  • Loading branch information
jpt-sn committed Sep 28, 2024
1 parent efc0b4e commit ff7a0b8
Show file tree
Hide file tree
Showing 3 changed files with 454 additions and 431 deletions.
1 change: 1 addition & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@

# OPENAI_API_KEY="" # put your https://platform.openai.com/ key here
# OPENAI_ORGANIZATION="" # optional if you use your personal key

# TOGETHER_API_KEY=""
# HF_TOKEN=""
37 changes: 16 additions & 21 deletions examples/intro_clean.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,20 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 5. Set your LLM API keys"
"#### 0.6. Set your LLM API keys"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In a `.env` file at the root of `TapeAgents` repository:\n",
"Set environement variable in a `.env` file at the root of `TapeAgents` repository or set them below\n",
"\n",
"```bash\n",
"# .env file\n",
"OPENAI_API_KEY=\"\" # put your https://platform.openai.com/ key here\n",
"# OPENAI_ORGANIZATION=\"\" # optional if you use your personal key\n",
"```\n",
"\n",
"Then run the next block to set environment variable"
"```"
]
},
{
Expand All @@ -115,17 +113,8 @@
"source": [
"import dotenv\n",
"\n",
"env_file = \"../.env\"\n",
"dotenv.load_dotenv(env_file, override=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# You could also set them directly here\n",
"env_file = \".env\"\n",
"dotenv.load_dotenv(env_file, override=True)\n",
"\n",
"# os.environ[\"OPENAI_API_KEY\"] = \"\"\n",
"# os.environ[\"OPENAI_ORGANIZATION\"] = \"\" # optional if you use your personal key"
Expand Down Expand Up @@ -422,7 +411,10 @@
"# When the agent computes the view, it bumps up `top.next_node` every time it encounters a step with a new `prompt_id``.\n",
"# The new prompt_id on the tape signals to the agent the current node has run.\n",
"tape2 = DialogTape(\n",
" steps=[UserStep(content=\"Hi, AI!\"), AssistantStep(metadata=StepMetadata(prompt_id=\"123\"), content=\"AI here, how I can help?\")]\n",
" steps=[\n",
" UserStep(content=\"Hi, AI!\"),\n",
" AssistantStep(metadata=StepMetadata(prompt_id=\"123\"), content=\"AI here, how I can help?\"),\n",
" ]\n",
")\n",
"next_node2 = TapeViewStack.compute(tape2).top.next_node\n",
"print(next_node2)\n",
Expand Down Expand Up @@ -648,7 +640,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 0. Setup your LLM key"
"## 3.0. Setup your LLM key"
]
},
{
Expand All @@ -657,7 +649,10 @@
"metadata": {},
"outputs": [],
"source": [
"# Set more environment variables in the .env file or set them here\n",
"# Set more environment variables in the .env file or set them below\n",
"\n",
"dotenv.load_dotenv(env_file, override=True)\n",
"\n",
"# os.environ[\"TOGETHER_API_KEY\"] = \"\" # put your https://together.ai/ key here\n",
"# os.environ[\"HF_TOKEN\"] = \"\" # put your huggingface token here\n",
"\n",
Expand Down Expand Up @@ -694,7 +689,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1 Setup your Agents\n",
"## 3.1. Setup your Agents\n",
"\n",
"We've found that LLAMA3 function-calling is not yet battle-ready. We will use the structured output approach to make it call tools instead. We are also making this agent trainable by adding `make_llm_output` methods to each node. `Node.make_llm_output` defines how a node can reconstruct the LLM completion message that would be required to make the steps from the given tape at the given index. You can think of `Node.make_llm_output` as the inverse of `Node.generate_steps`.\n",
"\n",
Expand Down Expand Up @@ -848,7 +843,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2 Run your Agent"
"## 3.2. Run your Agent"
]
},
{
Expand Down
Loading

0 comments on commit ff7a0b8

Please sign in to comment.