> ## Documentation Index
> Fetch the complete documentation index at: https://domoinc-bradley-turek-pfilter-operators-reference.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Text Generation

> Generate text based on the given text input.



## OpenAPI

````yaml /openapi/product/AI-Services.yaml post /api/ai/v1/text/generation
openapi: 3.1.0
info:
  title: AI Services
  description: >-
    Domo AI Services provide a consistent API to leverage Foundation Models to
    solve common problems such as natural language SQL generation (text-to-SQL),
    Summarization, Classification, Tool Calling and others.
  version: 2.3.3639_master
servers:
  - url: https://{subdomain}.domo.com
    variables:
      subdomain:
        description: The Domo instance subdomain.
        default: subdomain
security: []
tags:
  - name: AI Services - Classification
    description: Domo AI Service Classification APIs
  - name: AI Services - Data Extraction
    description: Domo AI Service Data Extraction APIs
  - name: AI Services - Embedding
    description: Domo AI Service Embedding APIs
  - name: AI Services - Image
    description: Domo AI Service Image APIs
  - name: AI Services - Messages
    description: Domo AI Service Messages APIs
  - name: AI Services - Sentiment Analysis
    description: Domo AI Service Sentiment Analysis APIs
  - name: AI Services - Text
    description: Domo AI Service Text APIs
paths:
  /api/ai/v1/text/generation:
    post:
      tags:
        - AI Services - Text
      summary: Text Generation
      description: Generate text based on the given text input.
      operationId: textGeneration
      requestBody:
        description: Text Generation AI Service request.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextGenerationRequest'
            examples:
              Basic:
                description: Basic Text Generation request.
                value:
                  input: Why is the sky blue?
              Non-default Model:
                description: Text Generation request with DomoGPT Chat Small v1 model
                value:
                  input: Why is the sky blue?
                  model: domo.domo_ai.domogpt-small-v1:anthropic
              Prompt Template:
                description: Text Generation request with custom prompt template.
                value:
                  input: Why is the sky blue?
                  promptTemplate:
                    template: 'Respond to the following in ${language}: ${input}'
                  parameters:
                    language: Japanese
        required: true
      responses:
        '200':
          description: TextAIResponse The generated text and model token usage information.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextAIResponse'
              examples:
                Text Generation Response:
                  description: Text Generation Response
                  value:
                    prompt: Why is the sky blue?
                    output: The sky is blue because of Rayleigh scattering.
                    modelId: domo.domo_ai.domogpt-small-v1:anthropic
        '403':
          description: Forbidden
          content:
            '*/*':
              schema:
                type: string
        '409':
          description: Conflict
      security:
        - domo-developer-token: []
components:
  schemas:
    TextGenerationRequest:
      type: object
      description: |-
        <p>
         Text Generation AI Service Request.
         </p>

         <h2>Prompt Templates</h2>
         <p>
         A prompt template is a string that contains placeholders for parameters that will be replaced with parameter values before the prompt
         is submitted to the model.
         </p>
         <p>
         A default prompt template is set for each model configured for the Text Generation AI Service. Individual requests can override the
         default template by including the <code>promptTemplate</code> parameter.
         </p>
         <h3>Prompt Template Parameters</h3>
         <p>
         The following request parameters are automatically injected into the prompt template if the associated placeholder is present:
         <ul>
          <li>input</li>
          <li>system</li>
         </ul>
         </p>
         <p>
         Models with built-in support for system prompts and chat message history do not need to include <em>system</em> or
         <em>chatContext</em> in the prompt template.
         </p>
         <p>
         Additional parameters can be provided in the <code>parameters</code> map as key-value pairs.
         </p>
         <h3>Prompt Template Examples</h3>
         <ul>
             <li>"${input}"</li>
             <li>"${system}\n${input}"</li>
         </ul>
      properties:
        input:
          type: string
          description: The input text.
        sessionId:
          type: string
          format: uuid
          description: >-
            The AI session ID. If provided, this request will be associated with
            the specified AI Session.
        promptTemplate:
          $ref: '#/components/schemas/ParameterizedPromptTemplate'
          description: >-
            The prompt template to use for the Text Generation task. The default
            prompt template will be used if not
                                       provided.
        parameters:
          type: object
          additionalProperties:
            type: string
          description: >-
            Custom parameters to inject into the prompt template if an
            associated placeholder is present.
        model:
          type: string
          description: >-
            The ID of the model to use for Text Generation. The specified model
            must be configured for the Text Generation
                                       AI Service by an Admin.
        modelConfiguration:
          type: object
          additionalProperties: {}
          description: >-
            Additional model-specific configuration parameter key-value pairs.
            e.g. temperature, max_tokens, etc.
        system:
          type: string
          description: >-
            The system message to use for the Text Generation task. If not
            provided, the default system message will be
                                       used. If the model does not include built-in support for system prompts, this parameter may be included in the
                                       prompt template using the "${system}" placeholder.
        temperature:
          type: number
          format: double
          description: >-
            Controls randomness in the model's output. Lower values make output
            more deterministic.
        maxTokens:
          type: integer
          format: int32
          description: The maximum number of tokens to generate in the response.
        responseFormat:
          description: Model response format specification for structured outputs.
          oneOf:
            - $ref: '#/components/schemas/JsonResponseFormat'
        reasoningConfig:
          $ref: '#/components/schemas/ReasoningConfig'
          description: Configuration for reasoning behavior and effort level.
      required:
        - input
    TextAIResponse:
      type: object
      description: Response from a text AI Service.
      properties:
        prompt:
          type: string
          description: The formatted prompt that was used to generate the response.
        choices:
          type: array
          deprecated: true
          description: The list of choices generated by the model.
          items:
            $ref: '#/components/schemas/Choice'
        modelId:
          type: string
          description: The id of the model used to generate the response.
        sessionId:
          type: string
          format: uuid
          description: The id of the AI Session associated with this request.
        output:
          type: string
          description: The output of the model.
        modelProviderUsage:
          $ref: '#/components/schemas/ModelProviderUsage'
          description: The token usage from the model provider.
    ParameterizedPromptTemplate:
      type: object
      description: |-
        <p>
         A prompt template string that contains placeholders for parameters that will be replaced with parameter values before the prompt
         is submitted to the model.
         </p>
         <p>
         <h3>Prompt Template Examples</h3>
         <ul>
             <li>"${input}"</li>
             <li>"${system}\n${input}"</li>
         </ul>
      properties:
        template:
          type: string
    JsonResponseFormat:
      allOf:
        - $ref: '#/components/schemas/ResponseFormat'
        - type: object
          properties:
            schema:
              $ref: '#/components/schemas/ObjectFunctionParameter'
              description: The JSON Schema to which the model response should adhere.
      description: >-
        JSON response format provides schema information to the model for use
        cases where structured output is desired.
         The schema object follows the <a href="https://json-schema.org/specification">JSON Schema</a> specification.
    ReasoningConfig:
      type: object
      properties:
        reasoningEffort:
          type: string
          enum:
            - NONE
            - LOW
            - MEDIUM
            - HIGH
    Choice:
      type: object
      description: A choice generated by a text AI model.
      properties:
        output:
          type: string
          description: The text model output.
    ModelProviderUsage:
      type: object
      properties:
        inputTokens:
          type: integer
          format: int64
        outputTokens:
          type: integer
          format: int64
        totalTokens:
          type: integer
          format: int64
        reasoningTokens:
          type: integer
          format: int64
    ResponseFormat:
      discriminator:
        propertyName: type
      properties:
        type:
          type: string
      required:
        - type
    ObjectFunctionParameter:
      allOf:
        - $ref: '#/components/schemas/FunctionParameterObject'
        - type: object
          properties:
            description:
              type: string
            title:
              type: string
            additionalProperties:
              type: boolean
            required:
              type: array
              items:
                type: string
            enum:
              type: array
              items:
                type: object
                additionalProperties: {}
              uniqueItems: true
            properties:
              type: object
              additionalProperties:
                oneOf:
                  - $ref: '#/components/schemas/ArrayFunctionParameter'
                  - $ref: '#/components/schemas/BooleanFunctionParameter'
                  - $ref: '#/components/schemas/IntegerFunctionParameter'
                  - $ref: '#/components/schemas/LogicalOperatorFunctionParameter'
                  - $ref: '#/components/schemas/NullFunctionParameter'
                  - $ref: '#/components/schemas/NumberFunctionParameter'
                  - $ref: '#/components/schemas/ObjectFunctionParameter'
                  - $ref: '#/components/schemas/StringFunctionParameter'
            minProperties:
              type: integer
              format: int32
            maxProperties:
              type: integer
              format: int32
            const:
              type: object
              additionalProperties: {}
      required:
        - properties
        - type
    FunctionParameterObject:
      type: object
      properties:
        type:
          type: string
          enum:
            - object
            - array
            - string
            - number
            - integer
            - boolean
            - 'null'
            - unknown
            - oneOf
            - allOf
            - anyOf
        const: {}
        enum:
          type: array
          items: {}
          uniqueItems: true
      required:
        - type
    ArrayFunctionParameter:
      allOf:
        - $ref: '#/components/schemas/FunctionParameterObject'
        - type: object
          properties:
            description:
              type: string
            title:
              type: string
            items:
              oneOf:
                - $ref: '#/components/schemas/ArrayFunctionParameter'
                - $ref: '#/components/schemas/BooleanFunctionParameter'
                - $ref: '#/components/schemas/IntegerFunctionParameter'
                - $ref: '#/components/schemas/LogicalOperatorFunctionParameter'
                - $ref: '#/components/schemas/NullFunctionParameter'
                - $ref: '#/components/schemas/NumberFunctionParameter'
                - $ref: '#/components/schemas/ObjectFunctionParameter'
                - $ref: '#/components/schemas/StringFunctionParameter'
            enum:
              type: array
              items:
                type: array
                items: {}
              uniqueItems: true
            minItems:
              type: integer
              format: int32
            maxItems:
              type: integer
              format: int32
            uniqueItems:
              type: boolean
            const:
              type: array
              items: {}
      required:
        - description
        - type
    BooleanFunctionParameter:
      allOf:
        - $ref: '#/components/schemas/FunctionParameterObject'
        - type: object
          properties:
            description:
              type: string
            title:
              type: string
            const:
              type: boolean
            enum:
              type: array
              items:
                type: boolean
              uniqueItems: true
      required:
        - description
        - type
    IntegerFunctionParameter:
      allOf:
        - $ref: '#/components/schemas/FunctionParameterObject'
        - type: object
          properties:
            description:
              type: string
            title:
              type: string
            multipleOf:
              type: integer
              format: int32
            minimum:
              type: integer
              format: int32
            exclusiveMinimum:
              type: integer
              format: int32
            maximum:
              type: integer
              format: int32
            exclusiveMaximum:
              type: integer
              format: int32
            enum:
              type: array
              items:
                type: integer
                format: int32
              uniqueItems: true
            const:
              type: integer
              format: int32
      required:
        - description
        - type
    LogicalOperatorFunctionParameter:
      allOf:
        - $ref: '#/components/schemas/FunctionParameterObject'
        - type: object
          properties:
            description:
              type: string
            title:
              type: string
            oneOf:
              type: array
              items:
                oneOf:
                  - $ref: '#/components/schemas/ArrayFunctionParameter'
                  - $ref: '#/components/schemas/BooleanFunctionParameter'
                  - $ref: '#/components/schemas/IntegerFunctionParameter'
                  - $ref: '#/components/schemas/LogicalOperatorFunctionParameter'
                  - $ref: '#/components/schemas/NullFunctionParameter'
                  - $ref: '#/components/schemas/NumberFunctionParameter'
                  - $ref: '#/components/schemas/ObjectFunctionParameter'
                  - $ref: '#/components/schemas/StringFunctionParameter'
            allOf:
              type: array
              items:
                oneOf:
                  - $ref: '#/components/schemas/ArrayFunctionParameter'
                  - $ref: '#/components/schemas/BooleanFunctionParameter'
                  - $ref: '#/components/schemas/IntegerFunctionParameter'
                  - $ref: '#/components/schemas/LogicalOperatorFunctionParameter'
                  - $ref: '#/components/schemas/NullFunctionParameter'
                  - $ref: '#/components/schemas/NumberFunctionParameter'
                  - $ref: '#/components/schemas/ObjectFunctionParameter'
                  - $ref: '#/components/schemas/StringFunctionParameter'
            anyOf:
              type: array
              items:
                oneOf:
                  - $ref: '#/components/schemas/ArrayFunctionParameter'
                  - $ref: '#/components/schemas/BooleanFunctionParameter'
                  - $ref: '#/components/schemas/IntegerFunctionParameter'
                  - $ref: '#/components/schemas/LogicalOperatorFunctionParameter'
                  - $ref: '#/components/schemas/NullFunctionParameter'
                  - $ref: '#/components/schemas/NumberFunctionParameter'
                  - $ref: '#/components/schemas/ObjectFunctionParameter'
                  - $ref: '#/components/schemas/StringFunctionParameter'
      required:
        - description
        - type
    NullFunctionParameter:
      allOf:
        - $ref: '#/components/schemas/FunctionParameterObject'
        - type: object
          properties:
            description:
              type: string
            title:
              type: string
      required:
        - description
        - type
    NumberFunctionParameter:
      allOf:
        - $ref: '#/components/schemas/FunctionParameterObject'
        - type: object
          properties:
            description:
              type: string
            title:
              type: string
            multipleOf:
              type: number
              format: double
            minimum:
              type: number
              format: double
            exclusiveMinimum:
              type: number
              format: double
            maximum:
              type: number
              format: double
            exclusiveMaximum:
              type: number
              format: double
            enum:
              type: array
              items:
                type: number
                format: double
              uniqueItems: true
            const:
              type: number
              format: double
      required:
        - description
        - type
    StringFunctionParameter:
      allOf:
        - $ref: '#/components/schemas/FunctionParameterObject'
        - type: object
          properties:
            description:
              type: string
            title:
              type: string
            minLength:
              type: integer
              format: int32
            maxLength:
              type: integer
              format: int32
            pattern:
              type: string
            enum:
              type: array
              items:
                type: string
              uniqueItems: true
            format:
              type: string
            const:
              type: string
      required:
        - description
        - type
  securitySchemes:
    domo-developer-token:
      type: apiKey
      name: X-DOMO-Developer-Token
      in: header

````