# 参数化生成请求（with Options）

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/generate:
    post:
      summary: 参数化生成请求（with Options）
      deprecated: false
      description: >-
        If you want to set custom options for the model at runtime rather than
        in the Modelfile, you can do so with the `options` parameter. This
        example sets every available option, but you can set any of them
        individually and omit the ones you do not want to override.
      tags:
        - 生成补全
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  examples:
                    - llama2-7b
                prompt:
                  type: string
                  examples:
                    - 请用中文回答以下问题
                stream:
                  type: boolean
                  examples:
                    - false
                options:
                  type: object
                  properties:
                    num_keep:
                      type: integer
                      examples:
                        - 1024
                    seed:
                      type: integer
                      examples:
                        - 42
                    num_predict:
                      type: integer
                      examples:
                        - 128
                    top_k:
                      type: integer
                      examples:
                        - 40
                    top_p:
                      type: number
                      examples:
                        - 0.9
                    temperature:
                      type: number
                      examples:
                        - 0.8
                    repeat_penalty:
                      type: number
                      examples:
                        - 1.1
                    stop:
                      type: array
                      items:
                        type: string
                      examples:
                        - - |+

                          - 。
                  required:
                    - num_keep
                    - seed
                    - num_predict
                    - top_k
                    - top_p
                    - temperature
                    - repeat_penalty
                    - stop
              required:
                - model
                - prompt
                - stream
                - options
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  model:
                    type: string
                  created_at:
                    type: string
                  response:
                    type: string
                  done:
                    type: boolean
                  context:
                    type: array
                    items:
                      type: integer
                  total_duration:
                    type: integer
                  load_duration:
                    type: integer
                  prompt_eval_count:
                    type: integer
                  prompt_eval_duration:
                    type: integer
                  eval_count:
                    type: integer
                  eval_duration:
                    type: integer
                required:
                  - model
                  - created_at
                  - response
                  - done
                  - context
                  - total_duration
                  - load_duration
                  - prompt_eval_count
                  - prompt_eval_duration
                  - eval_count
                  - eval_duration
                x-apifox-orders:
                  - model
                  - created_at
                  - response
                  - done
                  - context
                  - total_duration
                  - load_duration
                  - prompt_eval_count
                  - prompt_eval_duration
                  - eval_count
                  - eval_duration
              example:
                model: llama3.2
                created_at: '2023-08-04T19:22:45.499127Z'
                response: The sky is blue because it is the color of the sky.
                done: true
                context:
                  - 1
                  - 2
                  - 3
                total_duration: 4935886791
                load_duration: 534986708
                prompt_eval_count: 26
                prompt_eval_duration: 107345000
                eval_count: 237
                eval_duration: 4289432000
          headers: {}
          x-apifox-name: Success
      security: []
      x-apifox-folder: 生成补全
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/6041320/apis/api-272428820-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: http://localhost:11434/api/
    description: 正式环境
security: []

```
