# 流式生成请求（Streaming）

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/generate:
    post:
      summary: 流式生成请求（Streaming）
      deprecated: false
      description: ''
      tags:
        - 生成补全
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  x-apifox-mock: llama3.2
                prompt:
                  type: string
                  x-apifox-mock: Why is the sky blue?
              x-apifox-orders:
                - model
                - prompt
              required:
                - model
                - prompt
      responses:
        '200':
          description: 'A stream of JSON objects is returned:'
          content:
            application/json:
              schema:
                type: object
                properties:
                  model:
                    type: string
                  created_at:
                    type: string
                  response:
                    type: string
                  done:
                    type: boolean
                required:
                  - model
                  - created_at
                  - response
                  - done
                x-apifox-orders:
                  - model
                  - created_at
                  - response
                  - done
              examples:
                '1':
                  summary: Success
                  value:
                    model: llama3.2
                    created_at: '2023-08-04T08:52:19.385406455-07:00'
                    response: The
                    done: false
                '2':
                  summary: Success
                  value:
                    model: llama3.2
                    created_at: '2023-08-04T19:22:45.499127Z'
                    response: ''
                    done: true
                    context:
                      - 1
                      - 2
                      - 3
                    total_duration: 10706818083
                    load_duration: 6338219291
                    prompt_eval_count: 26
                    prompt_eval_duration: 130079000
                    eval_count: 259
                    eval_duration: 4232710000
          headers: {}
          x-apifox-name: Success
        x-200:Success:
          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
          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-272428812-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: http://localhost:11434/api/
    description: 正式环境
security: []

```
