mirror of
https://github.com/dair-ai/Prompt-Engineering-Guide
synced 2024-11-02 15:40:13 +00:00
Merge pull request #196 from Serper-API/main
Replaced search tool with google-serper
This commit is contained in:
commit
391ae1795c
@ -91,7 +91,7 @@
|
||||
"\n",
|
||||
"# for LangChain\n",
|
||||
"os.environ[\"OPENAI_API_KEY\"] = os.getenv(\"OPENAI_API_KEY\")\n",
|
||||
"os.environ[\"SERPAPI_API_KEY\"] = os.getenv(\"SERPAPI_API_KEY\")"
|
||||
"os.environ[\"SERPER_API_KEY\"] = os.getenv(\"SERPER_API_KEY\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -910,7 +910,7 @@
|
||||
"source": [
|
||||
"llm = OpenAI(temperature=0)\n",
|
||||
"\n",
|
||||
"tools = load_tools([\"serpapi\", \"llm-math\"], llm=llm)\n",
|
||||
"tools = load_tools([\"google-serper\", \"llm-math\"], llm=llm)\n",
|
||||
"agent = initialize_agent(tools, llm, agent=\"zero-shot-react-description\", verbose=True)"
|
||||
]
|
||||
},
|
||||
|
@ -32,7 +32,7 @@
|
||||
"\n",
|
||||
"# load API keys; you will need to obtain these if you haven't yet\n",
|
||||
"os.environ[\"OPENAI_API_KEY\"] = os.getenv(\"OPENAI_API_KEY\")\n",
|
||||
"os.environ[\"SERPAPI_API_KEY\"] = os.getenv(\"SERPAPI_API_KEY\")"
|
||||
"os.environ[\"SERPER_API_KEY\"] = os.getenv(\"SERPER_API_KEY\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -42,7 +42,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"llm = OpenAI(model_name=\"text-davinci-003\" ,temperature=0)\n",
|
||||
"tools = load_tools([\"serpapi\", \"llm-math\"], llm=llm)\n",
|
||||
"tools = load_tools([\"google-serper\", \"llm-math\"], llm=llm)\n",
|
||||
"agent = initialize_agent(tools, llm, agent=\"zero-shot-react-description\", verbose=True)"
|
||||
]
|
||||
},
|
||||
|
@ -126,7 +126,7 @@ load_dotenv()
|
||||
|
||||
# carrega les claus API; hauràs d'obtenir-les si encara no les tens
|
||||
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
||||
os.environ["SERPAPI_API_KEY"] = os.getenv("SERPAPI_API_KEY")
|
||||
os.environ["SERPER_API_KEY"] = os.getenv("SERPER_API_KEY")
|
||||
|
||||
```
|
||||
|
||||
@ -134,7 +134,7 @@ Ara podem configurar l'LLM, les eines que utilitzarem i l'agent que ens permet u
|
||||
|
||||
``` python
|
||||
llm = OpenAI(model_name="text-davinci-003" ,temperature=0)
|
||||
tools = load_tools(["serpapi", "llm-math"], llm=llm)
|
||||
tools = load_tools(["google-serper", "llm-math"], llm=llm)
|
||||
agent = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)
|
||||
```
|
||||
|
||||
|
@ -127,7 +127,7 @@ load_dotenv()
|
||||
|
||||
# load API keys; you will need to obtain these if you haven't yet
|
||||
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
||||
os.environ["SERPAPI_API_KEY"] = os.getenv("SERPAPI_API_KEY")
|
||||
os.environ["SERPER_API_KEY"] = os.getenv("SERPER_API_KEY")
|
||||
|
||||
```
|
||||
|
||||
@ -135,7 +135,7 @@ Now we can configure the LLM, the tools we will use, and the agent that allows u
|
||||
|
||||
``` python
|
||||
llm = OpenAI(model_name="text-davinci-003" ,temperature=0)
|
||||
tools = load_tools(["serpapi", "llm-math"], llm=llm)
|
||||
tools = load_tools(["google-serper", "llm-math"], llm=llm)
|
||||
agent = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)
|
||||
```
|
||||
|
||||
|
@ -116,7 +116,7 @@ load_dotenv()
|
||||
|
||||
# load API keys; you will need to obtain these if you haven't yet
|
||||
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
||||
os.environ["SERPAPI_API_KEY"] = os.getenv("SERPAPI_API_KEY")
|
||||
os.environ["SERPER_API_KEY"] = os.getenv("SERPER_API_KEY")
|
||||
|
||||
```
|
||||
|
||||
|
@ -126,7 +126,7 @@ load_dotenv()
|
||||
|
||||
# load API keys; you will need to obtain these if you haven't yet
|
||||
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
||||
os.environ["SERPAPI_API_KEY"] = os.getenv("SERPAPI_API_KEY")
|
||||
os.environ["SERPER_API_KEY"] = os.getenv("SERPER_API_KEY")
|
||||
|
||||
```
|
||||
|
||||
@ -134,7 +134,7 @@ os.environ["SERPAPI_API_KEY"] = os.getenv("SERPAPI_API_KEY")
|
||||
|
||||
``` python
|
||||
llm = OpenAI(model_name="text-davinci-003" ,temperature=0)
|
||||
tools = load_tools(["serpapi", "llm-math"], llm=llm)
|
||||
tools = load_tools(["google-serper", "llm-math"], llm=llm)
|
||||
agent = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)
|
||||
```
|
||||
|
||||
|
@ -116,7 +116,7 @@ load_dotenv()
|
||||
|
||||
# 载入 API keys; 如果没有,你需要先获取。
|
||||
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
|
||||
os.environ["SERPAPI_API_KEY"] = os.getenv("SERPAPI_API_KEY")
|
||||
os.environ["SERPER_API_KEY"] = os.getenv("SERPER_API_KEY")
|
||||
|
||||
```
|
||||
|
||||
@ -124,7 +124,7 @@ os.environ["SERPAPI_API_KEY"] = os.getenv("SERPAPI_API_KEY")
|
||||
|
||||
``` python
|
||||
llm = OpenAI(model_name="text-davinci-003" ,temperature=0)
|
||||
tools = load_tools(["serpapi", "llm-math"], llm=llm)
|
||||
tools = load_tools(["google-serper", "llm-math"], llm=llm)
|
||||
agent = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user