feat: Add metadata field to request and response

This changes adds Optional metadata field to OpenAI compatible request
and response object.

fixes: #3564
Signed-off-by: Abhishek Bongale <abhishekbongale@outlook.com>
This commit is contained in:
Abhishek Bongale 2025-11-12 14:38:05 +00:00
parent 539b9c08f3
commit f3aac25352
5 changed files with 367 additions and 0 deletions

View file

@ -3909,6 +3909,19 @@ components:
$ref: '#/components/schemas/OpenAIChatCompletionUsage'
description: >-
Token usage information for the completion
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Set of key-value pairs that were attached to the request.
This metadata is copied from the request.
input_messages:
type: array
items:
@ -4619,6 +4632,19 @@ components:
user:
type: string
description: (Optional) The user to use.
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Set of key-value pairs that can be attached to the request.
This metadata will be included in the response object.
additionalProperties: false
required:
- model
@ -4655,6 +4681,19 @@ components:
$ref: '#/components/schemas/OpenAIChatCompletionUsage'
description: >-
Token usage information for the completion
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Set of key-value pairs that were attached to the request. This
metadata is copied from the request.
additionalProperties: false
required:
- id
@ -4694,6 +4733,19 @@ components:
$ref: '#/components/schemas/OpenAIChatCompletionUsage'
description: >-
Token usage information (typically included in final chunk with stream_options)
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Set of key-value pairs that were attached to the request. This
metadata is copied from the request.
additionalProperties: false
required:
- id
@ -4783,6 +4835,19 @@ components:
$ref: '#/components/schemas/OpenAIChatCompletionUsage'
description: >-
Token usage information for the completion
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Set of key-value pairs that were attached to the request. This
metadata is copied from the request.
input_messages:
type: array
items:
@ -4888,6 +4953,19 @@ components:
type: string
description: >-
(Optional) The suffix that should be appended to the completion.
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Set of key-value pairs that can be attached to the request.
This metadata will be included in the response object.
additionalProperties: false
required:
- model
@ -4912,6 +4990,16 @@ components:
type: string
const: text_completion
default: text_completion
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
additionalProperties: false
required:
- id
@ -5744,6 +5832,19 @@ components:
description: >-
(Optional) A unique identifier representing your end-user, which can help
OpenAI to monitor and detect abuse.
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Set of key-value pairs that can be attached to the request.
This metadata will be included in the response object.
additionalProperties: false
required:
- model
@ -5817,6 +5918,19 @@ components:
usage:
$ref: '#/components/schemas/OpenAIEmbeddingUsage'
description: Usage information
metadata:
type: object
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >-
(Optional) Set of key-value pairs that were attached to the request. This
metadata is copied from the request.
additionalProperties: false
required:
- object