SearchApi Class Definition.

Provides a wrapper around the SearchApi.

Ensure you've set the SEARCHAPI_API_KEY environment variable for authentication. You can obtain a free API key from https://www.searchapi.io/.

Example

const searchApi = new SearchApi("your-api-key", {
engine: "google_news",
});
const agent = RunnableSequence.from([
ChatPromptTemplate.fromMessages([
["ai", "Answer the following questions using a bulleted list markdown format.""],
["human", "{input}"],
]),
new ChatOpenAI({ temperature: 0 }),
(input: BaseMessageChunk) => ({
log: "test",
returnValues: {
output: input,
},
}),
]);
const executor = AgentExecutor.fromAgentAndTools({
agent,
tools: [searchApi],
});
const res = await executor.invoke({
input: "What's happening in Ukraine today?"",
});
console.log(res);

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

description: string = "a search engine. useful for when you need to answer questions about current events. input should be a search query."
name: string = "search"
apiKey: string
params: Partial<SearchApiParameters>

Methods

Generated using TypeDoc