A11 TypeScript API - v0.7.0
    Preparing search index...

    Function makeTextMessageInteraction

    • Build an interaction carrying a single text message.

      The content is the backend-neutral {role, content: [text part]} envelope, so a plain text turn stays portable across a mid-conversation model switch.

      content and system_instructions contain Chunk values. Building those chunks uses the asynchronous serialization registry, equivalent to a11.to_chunk in Python.

      Parameters

      • text: string
      • systemPrompt: string = ''
      • role: Role = Role.USER

      Returns Promise<
          StatusOr<
              {
                  action_calls: ActionMessage[];
                  action_configs: Record<
                      string,
                      {
                          header_autofills: Record<string, Uint8Array<ArrayBufferLike>>;
                          peer:
                              | string
                              | {
                                  endpoint: string;
                                  identity: string;
                                  protocol: "a11"
                                  | "mcp";
                                  scheme: "session" | "rtc" | "http" | "https" | "ws" | "wss";
                              };
                      },
                  >;
                  action_inputs: Record<string, NodeFragment[]>;
                  action_outputs: Record<string, NodeFragment[]>;
                  backend_specific_metadata: Record<string, Uint8Array<ArrayBufferLike>>;
                  content: Chunk[];
                  created_at_millis?: number | null;
                  id: string;
                  model: string;
                  previous_interaction_id: string;
                  role: "user" | "system" | "model";
                  status?: Status;
                  system_instructions: Chunk[];
                  usage_metadata?:
                      | {
                          cache_write_tokens?: number
                          | null;
                          cached_input_tokens?: number | null;
                          input_tokens?: number | null;
                          output_tokens?: number | null;
                          reasoning_tokens?: number | null;
                          total_tokens?: number | null;
                          [key: string]: unknown;
                      }
                      | null;
                  [key: string]: unknown;
              },
          >,
      >