move search to not be a chain (#226)

This commit is contained in:
Harrison Chase
2022-11-29 20:07:44 -08:00
committed by GitHub
parent b19a73be26
commit ca2394028f
13 changed files with 40 additions and 54 deletions

View File

@@ -1,7 +1,7 @@
"""Integration test for self ask with search."""
from langchain.agents.self_ask_with_search.base import SelfAskWithSearchChain
from langchain.chains.serpapi import SerpAPIChain
from langchain.llms.openai import OpenAI
from langchain.serpapi import SerpAPIWrapper
def test_self_ask_with_search() -> None:
@@ -9,7 +9,7 @@ def test_self_ask_with_search() -> None:
question = "What is the hometown of the reigning men's U.S. Open champion?"
chain = SelfAskWithSearchChain(
llm=OpenAI(temperature=0),
search_chain=SerpAPIChain(),
search_chain=SerpAPIWrapper(),
input_key="q",
output_key="a",
)

View File

@@ -1,9 +1,9 @@
"""Integration test for SerpAPI."""
from langchain.chains.serpapi import SerpAPIChain
from langchain.serpapi import SerpAPIWrapper
def test_call() -> None:
"""Test that call gives the correct answer."""
chain = SerpAPIChain()
chain = SerpAPIWrapper()
output = chain.run("What was Obama's first name?")
assert output == "Barack Hussein Obama II"