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/.
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); Copy
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);
Protected
Converts the SearchApi instance to JSON. This method is not implemented and will throw an error if called.
Throws an error.
Builds a URL for the SearchApi request.
A string representing the built URL.
Generated using TypeDoc
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