@squidcloud/client
    Preparing search index...

    Class AiAssistantClient

    Client class for interacting with an AI Assistant server. Provides functionalities like creating and deleting assistants and threads, querying assistants, and managing files associated with assistants and threads.

    Index

    Methods

    • Adds a file to an AI assistant that can be available for retrieval or code analyzer.

      Parameters

      • assistantId: string

        The ID of the assistant.

      • file: File

        The file to be added.

      Returns Promise<string>

      A promise that resolves to the ID of the added file.

    • Adds a file to a specific thread of an AI assistant. These files can be used when asking a question in the thread.

      Parameters

      • threadId: string

        The ID of the thread.

      • file: File

        The file to be added.

      Returns Promise<string>

      A promise that resolves to the ID of the added file.

    • Creates a new AI assistant with specified characteristics.

      Parameters

      • name: string

        The name of the assistant.

      • instructions: string

        Instructions for the assistant.

      • functions: string[]

        Array of function names annotated with "@aiFunction" in your Squid backend that will be available to the assistant.

      • OptionaltoolTypes: AssistantToolType[]

        Optional array of tool types. If you want to use files for retrieval, you must add them using the addFileToAssistant method.

      Returns Promise<string>

      A promise that resolves to the created assistant's ID.

    • Creates a new thread for an AI assistant. A thread is a long-lived conversation with the assistant that you can always send questions to.

      Parameters

      • assistantId: string

        The ID of the assistant for which the thread is created.

      Returns Promise<string>

      A promise that resolves to the created thread's ID.

    • Deletes an AI assistant.

      Parameters

      • assistantId: string

        The ID of the assistant to be deleted.

      Returns Promise<void>

      A promise that resolves when the assistant is deleted.

    • Deletes a thread of an AI assistant.

      Parameters

      • threadId: string

        The ID of the thread to be deleted.

      Returns Promise<void>

      A promise that resolves when the thread is deleted.

    • Queries an AI assistant within a specific thread.

      Parameters

      • assistantId: string

        The ID of the assistant.

      • threadId: string

        The ID of the thread.

      • prompt: string

        The query prompt.

      • OptionalfileIds: string[]

        Optional array of file IDs to include in the query. These file IDs need to be added using the addFileToThread method.

      • Optionaloptions: QueryAssistantOptions

        Optional query options.

      Returns Promise<string>

      A promise that resolves to the assistant's response.

    • Removes a file from an AI assistant.

      Parameters

      • assistantId: string

        The ID of the assistant.

      • fileId: string

        The ID of the file to be removed.

      Returns Promise<void>

      A promise that resolves when the file is removed.