Saltearse al contenido

SearchApi Tool

SearchApi Tool is a component that lets you perform live searches on the web using the SearchAPI service. It returns the most recent results for a query so you can feed them into your workflow or let an AI model use them as context.

¿Cómo funciona?

When you run the component, it creates a wrapper around the SearchAPI service. You provide the name of the search engine (for example, “google” or “bing”), the query you want to look up, and any optional search parameters such as the number of results or language. The wrapper sends a request to the SearchAPI endpoint, receives a JSON response, and extracts the organic results. Each result is turned into a Data object that contains the full result dictionary and a short snippet of text. The component also builds a Tool that can be passed to a LangChain model so the model can ask the API for fresh information during a conversation.

Entradas

Campos de Entrada

  • Engine: The name of the search engine you want to use (e.g., “google”, “bing”).
  • Input: The search query you want to send to the API.
  • Search parameters: Optional dictionary of additional parameters such as num_results, language, etc.

Credencial
Before using the component, you must create a Search API credential in Nappai’s credential section. The credential stores the Search API Key. After creating it, select that credential in the component’s “Credential” field. The key is automatically used by the component and is not shown in the input list.

Salidas

  • Data: A list of Data objects, each containing a full search result and a short snippet. These can be displayed in the dashboard or passed to other components.
  • Tool: A LangChain Tool that can be injected into a model so the model can perform searches on demand.

Ejemplo de Uso

  1. Create a credential

    • Go to CredencialesAgregar credencialSearch API.
    • Enter your Search API Key and save.
  2. Add the SearchApi Tool to your flow

    • Drag the component onto the canvas.
    • In the Credential dropdown, pick the credential you just created.
    • Set Engine to “google”.
    • Set Input to “What is the capital of France?”.
    • Leave Search parameters empty or add {"num_results": 3} to limit the results.
  3. Run the flow

    • The component will return a list of results.
    • You can connect the Data output to a Display component to show the snippets, or connect the Tool output to a Chat component so the AI can ask for updated information.

Componentes Relacionados

  • LangChain Tool – The generic tool interface that SearchApi Tool implements.
  • Credential Manager – Where you store and manage API keys for different services.

Consejos y Mejores Prácticas

  • Limit the number of results: Use the num_results parameter to keep the response small and fast.
  • Cache results: If you need the same query multiple times, store the Data output and reuse it instead of calling the API again.
  • Handle errors gracefully: Wrap the component in a try‑catch flow to manage network failures or rate limits.

Consideraciones de Seguridad

  • Keep your Search API Key confidential. Never expose it in public dashboards or share the credential file.
  • Use the credential system in Nappai to restrict who can view or edit the key.