Options
All
  • Public
  • Public/Protected
  • All
Menu

This class supports building assistants that enables conversation with LLM models.
Do not create it directly; Get it from AinftJs instance.

Hierarchy

Index

Constructors

  • new Assistants(baseUrl: string, route: null | string, ain: default, ainize?: default): Assistants

Properties

ain: default

The Ain object for sign and send transaction to AIN blockchain.

ainize?: default

The Ainize object for send request to AIN blockchain.

baseUrl: string = ''

The base url of api server of AINFT Factory.

route: string

The subpath of api server request url.

Methods

  • buildReqBodyForCreateAssistant(objectId: string, tokenId: string, role: Role, params: AssistantCreateParams): { description: null | string; instructions: null | string; metadata: any; model: Model; name: string; objectId: string; options: { autoImage: boolean }; role: Role; tokenId: string }
  • Parameters

    Returns { description: null | string; instructions: null | string; metadata: any; model: Model; name: string; objectId: string; options: { autoImage: boolean }; role: Role; tokenId: string }

    • description: null | string
    • instructions: null | string
    • metadata: any
    • model: Model
    • name: string
    • objectId: string
    • options: { autoImage: boolean }
      • autoImage: boolean
    • role: Role
    • tokenId: string
  • buildReqBodyForUpdateAssistant(objectId: string, tokenId: string, assistantId: string, role: Role, params: AssistantUpdateParams): { assistantId: string; description: undefined | string; instructions: undefined | string; metadata: any; model: undefined | Model; name: undefined | string; objectId: string; role: Role; tokenId: string }
  • Parameters

    Returns { assistantId: string; description: undefined | string; instructions: undefined | string; metadata: any; model: undefined | Model; name: undefined | string; objectId: string; role: Role; tokenId: string }

    • assistantId: string
    • description: undefined | string
    • instructions: undefined | string
    • metadata: any
    • model: undefined | Model
    • name: undefined | string
    • objectId: string
    • role: Role
    • tokenId: string
  • buildTxBodyForCreateAssistant(assistant: Assistant, address: string): TransactionInput
  • buildTxBodyForDeleteAssistant(address: string, objectId: string, tokenId: string): TransactionInput
  • buildTxBodyForUpdateAssistant(address: string, objectId: string, tokenId: string, __namedParameters: Assistant): TransactionInput
  • Deletes an assistant.

    Parameters

    • objectId: string

      The ID of AINFT object.

    • tokenId: string

      The ID of AINFT token.

    • assistantId: string

      The ID of assistant.

    Returns Promise<AssistantDeleteTransactionResult>

    A promise that resolves with both the transaction result and the deleted assistant.

  • get(objectId: string, tokenId: string, assistantId: string): Promise<Assistant>
  • Retrieves an assistant.

    Parameters

    • objectId: string

      The ID of AINFT object.

    • tokenId: string

      The ID of AINFT token.

    • assistantId: string

      The ID of assistant.

    Returns Promise<Assistant>

    A promise that resolves with the assistant.

  • getAssistants(objectId: string, address?: null | string): Promise<Assistant[]>
  • Retrieves a list of assistants.

    Parameters

    • objectIds: string[]

      The ID(s) of AINFT object.

    • Optional address: null | string
    • [queryParamsWithoutSort={}]: QueryParamsWithoutSort = {}

      The parameters for querying items.

    Returns Promise<{ items: Assistant[]; total: number }>

    A promise that resolves with the list of assistants.

  • mint(objectId: string, to: string): Promise<any>
  • sendFormRequest(method: POST | PUT, trailingUrl: string, stringFields: {}, fileFields: {}): Promise<any>
  • Sends request that include form to api server of AINFT Factory. Used to upload asset data.

    Parameters

    • method: POST | PUT

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • stringFields: {}

      The string fields of form.

      • [key: string]: string
    • fileFields: {}

      The file fields of form.

      • [key: string]: { buffer: Buffer; filename: string }
        • buffer: Buffer
        • filename: string

    Returns Promise<any>

    Returns response of api request.

  • sendRequest(method: HttpMethod, trailingUrl: string, data?: Record<string, any>): Promise<any>
  • Sends request to api server of AINFT Factory. Authenticate by signing data.

    Parameters

    • method: HttpMethod

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • Optional data: Record<string, any>

      The data to be included in the api request.

    Returns Promise<any>

    Returns response of api request.

  • sendRequestWithoutSign(method: HttpMethod, trailingUrl: string, data?: Record<string, any>, headers?: AxiosRequestHeaders): Promise<any>
  • Sends request to api server of AINFT Factory. Used when authentication is not required.

    Parameters

    • method: HttpMethod

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • Optional data: Record<string, any>

      The data to be included in the api request.

    • Optional headers: AxiosRequestHeaders

      The headers of Http api request.

    Returns Promise<any>

    Returns response of api request.

  • setBaseUrl(baseUrl: string): void
  • signData(data: any): string | Promise<string>
  • Sign the data with the private key that the user has registered.

    Parameters

    • data: any

      The data to sign.

    Returns string | Promise<string>

    Returns signature string.

  • transformMetadata(metadata: any): any
  • Updates an assistant.

    Parameters

    • objectId: string

      The ID of the AINFT object.

    • tokenId: string

      The ID of the AINFT token.

    • assistantId: string

      The ID of the assistant.

    • params: AssistantUpdateParams

    Returns Promise<AssistantTransactionResult>

    A promise that resolves with both the transaction result and the updated assistant.

Generated using TypeDoc