LLM request class that allows passing in tools, output schema and system instructions to the model.

Attributes: model: The model name. contents: The contents to send to the model. config: Additional config for the generate content request. toolsDict: The tools dictionary.

Constructors

  • Parameters

    • Optionaldata: {
          model?: string;
          contents?: Content[];
          config?: GenerateContentConfig;
          liveConnectConfig?: LiveConnectConfig;
          toolsDict?: Record<string, BaseTool>;
      }
      • Optionalmodel?: string
      • Optionalcontents?: Content[]
      • Optionalconfig?: GenerateContentConfig
      • OptionalliveConnectConfig?: LiveConnectConfig
      • OptionaltoolsDict?: Record<string, BaseTool>

    Returns LlmRequest

Properties

model?: string

The model name.

contents: Content[]

The contents to send to the model.

config?: GenerateContentConfig

Additional config for the generate content request. Tools in generate_content_config should not be set.

liveConnectConfig: LiveConnectConfig

Live connect config for the request.

toolsDict: Record<string, BaseTool>

The tools dictionary.

Methods

  • Appends instructions to the system instruction.

    Parameters

    • instructions: string[]

      The instructions to append.

    Returns void

  • Extracts the system instruction as plain text from Content or string. System instructions can be either string or Content type.

    Returns string

    The system instruction as a string, or undefined if not set.

  • Extracts text content from a Content object. Used for extracting text from message contents.

    Parameters

    • content: any

      The Content object to extract text from.

    Returns string

    The extracted text as a string.