# Generate Text

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/ml/general/generate_text:
    post:
      summary: Generate Text
      deprecated: false
      description: >-
        Generates a text based on text prompt.


        ## Body Parameters


        | **Parameter** | **Type** | **Required?**     |
        **Description**                                                                                                                     
        |

        |---------------|----------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------|

        | prompt        | String   | yes               | Text generation
        prompt.                                                                                                             
        |

        | temperature   | Float    | no (default null) | Generation variability
        and creativity, in range [0, 1]. If null or higher than 0, results in
        nondeterministic generation.            |

        | max_tokens    | Integer  | no (default null) | Maximum number of
        tokens (~number of words) allowed in a generated text. If null,
        terminates when generative model thinks it should. |


        ## Example


        ```shell

        curl -X POST \
            "https://api.mpc.placewise.com/v1/ml/general/generate_image"  \
            -H 'Content-Type: application/json' \
            -H 'Authorization: Bearer B7t9U9tsoWsGhrv2ouUoSqpM' \
            -H 'x-product-name: default' \
            -H 'x-user-agent: CURL manual test' \
            -d \
                '{ 
                "prompt": "Write a very short cheesecake recipe",
                "temperature": 0,
                "max_tokens": 1000
                }'
        ```


        > When successful, returns:

        ```

        {
            'text_generation_task': {
                'id': 1
            }
        }

        ```
      tags:
        - API Reference/ML API
      parameters:
        - name: Content-Type
          in: header
          description: '[Details](doc-341635)'
          required: true
          example: application/json
          schema:
            type: string
            default: application/json
            const: application/json
        - name: X-User-Agent
          in: header
          description: Arbitrary identifier of your client. [Details](doc-341635)
          required: true
          example: '{{X_USER_AGENT}}'
          schema:
            type: string
            default: '{{X_USER_AGENT}}'
        - name: X-Product-Name
          in: header
          description: API Product for API context. [Details](doc-341635)
          required: true
          example: '{{PRODUCT_NAME}}'
          schema:
            type: string
            default: '{{PRODUCT_NAME}}'
        - name: X-Loyalty-Club-Slug
          in: header
          description: LoyaltyClub for API context. [Details](doc-342138)
          required: false
          example: '{{LOYALTY_CLUB_SLUG}}'
          schema:
            type: string
            default: '{{LOYALTY_CLUB_SLUG}}'
        - name: Authorization
          in: header
          description: '[Member](doc-342129) or [User](doc-342130) Authorization.'
          required: false
          example: Bearer {{_OAUTH_TOKEN}}
          schema:
            type: string
            default: Bearer {{_OAUTH_TOKEN}}
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                prompt:
                  description: Text generation prompt
                  example: Write a very short cheesecake recipe
                  type: string
                temperature:
                  type: number
                  description: >-
                    Generation variability and creativity, in range [0, 1]. If
                    null or higher than 0, results in nondeterministic
                    generation.
                  example: 0
                  nullable: true
                max_tokens:
                  type: integer
                  description: >-
                    Maximum number of tokens (~number of words) allowed in a
                    generated text. If null, terminates when generative model
                    thinks it should.
                  example: 1000
                  nullable: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  text_generation_task:
                    type: object
                    properties:
                      id:
                        type: integer
                        description: Task ID
                    x-apidog-orders:
                      - id
                    required:
                      - id
                x-apidog-orders:
                  - text_generation_task
                required:
                  - text_generation_task
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: API Reference/ML API
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/346351/apis/api-3739179-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.mpc.dev.placewise.com
    description: Staging
security: []

```