Documentation
    Preparing search index...

    Interface LlmConnectionHost

    Host adapter behind the NAP-LLM service.

    const host: LlmConnectionHost = {
    select: async (ctx, req) => chooser.pick(ctx.windowId, req), // null when the user declines
    describe: (_ctx, id) => store.get(id) ?? null,
    authorize: async (ctx, connection, request) => consent.ask(ctx, connection, request),
    generate: (_ctx, connection, request, hooks) => provider.generate(connection, request, hooks),
    };
    interface LlmConnectionHost {
        authorize(
            context: LlmRequestContext,
            connection: LlmConnection,
            request: LlmGenerationRequest,
            options?: LlmPromptOptions,
        ): boolean | Promise<boolean>;
        describe(
            context: LlmRequestContext,
            connectionId: string,
        ): LlmConnection | Promise<LlmConnection | null> | null;
        generate(
            context: LlmRequestContext,
            connection: LlmConnection,
            request: LlmGenerationRequest,
            hooks: LlmGenerateHooks,
        ): Promise<LlmGeneration>;
        select(
            context: LlmRequestContext,
            requirements: LlmRequirements,
            options?: LlmPromptOptions,
        ): LlmConnection | Promise<LlmConnection | null> | null;
        subscribe?(listener: () => void): () => void;
    }
    Index

    Methods

    • Notify the service when connections, credentials or the account change so every handle expires.

      Parameters

      • listener: () => void

      Returns () => void