> ## Documentation Index
> Fetch the complete documentation index at: https://developer.duplik.cn/llms.txt
> Use this file to discover all available pages before exploring further.

> 基于应用级别的 Function Call 调用

# Chat Completion with Function Call



## OpenAPI

````yaml post /v1/spaces/completions/{space_id}/function
openapi: 3.0.2
info:
  title: Duplik Backend
  description: The API for Duplik Backend.
  version: 0.1.0
servers:
  - url: https://api.duplik.cn
security: []
paths:
  /v1/spaces/completions/{space_id}/function:
    post:
      tags:
        - openapi-space
      summary: Chat Completion with Function Call
      operationId: >-
        generate_function_arguments_v1_spaces_completions__space_id__function_post
      parameters:
        - required: true
          schema:
            title: Space Id
            type: integer
          name: space_id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateFunctionArgumentsRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateFunctionArgumentsResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - HTTPBearer: []
components:
  schemas:
    GenerateFunctionArgumentsRequest:
      title: GenerateFunctionArgumentsRequest
      required:
        - function
        - user_message
      type: object
      properties:
        model_name:
          title: Model Name
          type: string
        max_tokens:
          title: Max Tokens
          type: integer
        system_message:
          title: System Message
          type: string
        function:
          title: Function
          type: object
        user_message:
          title: User Message
          type: string
    GenerateFunctionArgumentsResponse:
      title: GenerateFunctionArgumentsResponse
      type: object
      properties:
        name:
          title: Name
          type: string
        arguments:
          title: Arguments
          type: object
    ErrorResponse:
      title: ErrorResponse
      required:
        - code
        - message
      type: object
      properties:
        code:
          title: Code
          type: integer
        message:
          title: Message
          type: string
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````