@squidcloud/client
    Preparing search index...

    Class AiClient

    AiClient class serves as a facade for interacting with different AI services. It provides simplified access to AI chatbot and assistant functionalities through its methods.

    Index

    Methods

    • Returns a reference to the specified AI agent. If no ID is provided, the built-in agent is used by default.

      Parameters

      • agentId: string = BUILT_IN_AGENT_ID

      Returns AiAgentReference

    • Request to execute an AI-powered API call. Allows specifying allowed endpoints and whether to provide an explanation.

      Parameters

      • integrationId: string
      • prompt: string
      • OptionalallowedEndpoints: string[]
      • OptionalprovideExplanation: boolean

      Returns Promise<ExecuteAiApiResponse>

    • Executes an AI query using a specific DB integration, sending a prompt to the AI and returning its response. This function allows for direct interaction with the AI's capabilities by sending text prompts and receiving the AI's responses, which can be used for various applications such as automating tasks, generating content, or obtaining information.

      Parameters

      • integrationId: string

        The identifier for the DB integration which is used to direct the query to the appropriate DB.

      • prompt: string

        The text prompt to send to the AI. This should be formulated in a way that the AI can understand and respond to, taking into account the nature of the task or the information sought.

      • Optionaloptions: ExecuteAiQueryOptions

        Additional options to customize the query execution.

      Returns Promise<ExecuteAiQueryResponse>

      A promise that resolves to an ExecuteAiQueryResponse. This response includes the AI's reply to the provided prompt, along with any other relevant information that is part of the AI's response. The promise can be awaited to handle the response asynchronously.

      const response = await ai().executeAiQuery(myDbIntegrationId, "How many transactions ran yesterday?");
      console.log(response);

      For more details on the usage and capabilities of the AI Assistant, refer to the documentation provided at https://docs.squid.cloud/docs/ai.

    • Executes an AI query across multiple database integrations and returns their responses. Useful when querying multiple sources with the same prompt.

      Parameters

      • integrationIds: string[]

        The list of integration IDs to query.

      • prompt: string

        The prompt to send to the AI.

      • Optionaloptions: ExecuteAiQueryOptions

        Optional query execution parameters.

      Returns Promise<ExecuteAiQueryMultiResponse>

      A promise resolving to the responses from all queried integrations.

    • Lists all available AI agents.

      Returns Promise<AiAgent<undefined>[]>