Skip to content

Commit

Permalink
more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
logan-markewich committed Dec 16, 2024
1 parent 8d1a81e commit 9f23093
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ Here's an example usage of the TavilyToolSpec.

```python
from llama_index.tools.tavily_research import TavilyToolSpec
from llama_index.agent.openai import OpenAIAgent
from llama_index.core.agent import FunctionCallingAgent
from llama_index.llms.openai import OpenAI

tavily_tool = TavilyToolSpec(
api_key="your-key",
)
agent = OpenAIAgent.from_tools(tavily_tool.to_tool_list())
agent = FunctionCallingAgent.from_tools(
tavily_tool.to_tool_list(),
llm=OpenAI(model="gpt-4o"),
)

agent.chat("What happened in the latest Burning Man festival?")
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install llama-index-tools-tavily-research llama-index llama-hub tavily-python"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ce6c6e5d-f61e-461e-8e8d-99d27fb3fcaf",
"metadata": {},
"outputs": [],
"source": [
"# Set up OpenAI\n",
"import openai\n",
"from llama_index.agent.openai import OpenAIAgent"
"%pip install llama-index-tools-tavily-research llama-index"
]
},
{
Expand All @@ -45,7 +33,11 @@
"metadata": {},
"outputs": [],
"source": [
"openai.api_key = \"sk-api-key\""
"# set your openai key, if using openai\n",
"import os\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = \"sk-...\"\n",
"os.environ[\"TAVILY_API_KEY\"] = \"...\""
]
},
{
Expand Down Expand Up @@ -125,8 +117,12 @@
"metadata": {},
"outputs": [],
"source": [
"agent = OpenAIAgent.from_tools(\n",
"from llama_index.core.agent import FunctionCallingAgent\n",
"from llama_index.llms.openai import OpenAI\n",
"\n",
"agent = FunctionCallingAgent.from_tools(\n",
" tavily_tool_list,\n",
" llm=OpenAI(model=\"gpt-4o\"),\n",
")"
]
},
Expand Down Expand Up @@ -176,9 +172,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "llama_hub",
"display_name": "llama-index-caVs7DDe-py3.10",
"language": "python",
"name": "llama_hub"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down

0 comments on commit 9f23093

Please sign in to comment.