The AIQueryApi class provides methods to query AI Agents on Nevermined.

Remarks

This API is oriented for AI users who already purchased access to an AI Agent and want to start querying them.

Hierarchy

  • AbstractHTTPClient
    • AIQueryApi

Constructors

Methods

  • Parameters

    • url: string
    • data: any
    • reqOptions: HTTPRequestOptions

    Returns Promise<AxiosResponse<any, any>>

  • Parameters

    • url: string
    • reqOptions: HTTPRequestOptions = ...

    Returns Promise<AxiosResponse<any, any>>

  • Parameters

    • requestHeaders: {
          [key: string]: string;
      }
      • [key: string]: string
    • Optional accessToken: string

    Returns {
        Authorization?: string;
    }

    • Optional Authorization?: string
  • Parameters

    • urlRequested: string
    • reqOptions: HTTPRequestOptions

    Returns string

  • Parameters

    • url: string
    • data: any
    • reqOptions: HTTPRequestOptions

    Returns Promise<AxiosResponse<any, any>>

  • Parameters

    • url: string
    • data: any
    • reqOptions: HTTPRequestOptions

    Returns Promise<AxiosResponse<any, any>>

  • Parameters

    • method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH"
    • url: string
    • Optional data: any
    • reqOptions: HTTPRequestOptions = ...

    Returns Promise<AxiosResponse<any, any>>

  • It sends a request to the AI Agent/Service.

    Parameters

    • accessCredentials: AgentAccessCredentials
    • method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH"

      The HTTP method to use when querying the Agent

    • url: string

      The URL of the endpoint to query the Agent/Service.

    • Optional data: any

      The data to send to the Agent/Service.

    • reqOptions: HTTPRequestOptions = ...

      The request options to use when querying the Agent/Service.

    Returns Promise<AxiosResponse<any, any>>

    The result of query

    Remarks

    This method is used to query an existing AI Agent. It requires the user controlling the NVM API Key to have access to the agent.

    Example

    await payments.query.send(accessCredentials, 'POST', 'http://example.com/agent/prompt', {'input': 'Hello'})
    

    See

    AxiosRequestConfig.method