feat(api)!: support passing extra_body to embeddings and vector_stores APIs

Applies the same pattern from #3777 to embeddings and vector_stores.create() endpoints.

Breaking change: Method signatures now accept a single params object with Pydantic extra="allow" instead of individual parameters. Provider-specific params can be passed via extra_body and accessed through params.model_extra.

Updated APIs: openai_embeddings(), openai_create_vector_store(), openai_create_vector_store_file_batch()
This commit is contained in:
Ashwin Bharambe 2025-10-11 15:27:47 -07:00
parent cfd2e303db
commit 74e2976c1e
20 changed files with 364 additions and 297 deletions

View file

@ -765,7 +765,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OpenaiEmbeddingsRequest"
"$ref": "#/components/schemas/OpenAIEmbeddingsRequestWithExtraBody"
}
}
},
@ -3170,13 +3170,13 @@
"VectorIO"
],
"summary": "Creates a vector store.",
"description": "Creates a vector store.",
"description": "Creates a vector store.\nGenerate an OpenAI-compatible vector store with the given parameters.",
"parameters": [],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OpenaiCreateVectorStoreRequest"
"$ref": "#/components/schemas/OpenAICreateVectorStoreRequestWithExtraBody"
}
}
},
@ -3356,7 +3356,7 @@
"VectorIO"
],
"summary": "Create a vector store file batch.",
"description": "Create a vector store file batch.",
"description": "Create a vector store file batch.\nGenerate an OpenAI-compatible vector store file batch for the given vector store.",
"parameters": [
{
"name": "vector_store_id",
@ -3372,7 +3372,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OpenaiCreateVectorStoreFileBatchRequest"
"$ref": "#/components/schemas/OpenAICreateVectorStoreFileBatchRequestWithExtraBody"
}
}
},
@ -8333,7 +8333,7 @@
"title": "ConversationItemDeletedResource",
"description": "Response for deleted conversation item."
},
"OpenaiEmbeddingsRequest": {
"OpenAIEmbeddingsRequestWithExtraBody": {
"type": "object",
"properties": {
"model": {
@ -8356,6 +8356,7 @@
},
"encoding_format": {
"type": "string",
"default": "float",
"description": "(Optional) The format to return the embeddings in. Can be either \"float\" or \"base64\". Defaults to \"float\"."
},
"dimensions": {
@ -8372,7 +8373,8 @@
"model",
"input"
],
"title": "OpenaiEmbeddingsRequest"
"title": "OpenAIEmbeddingsRequestWithExtraBody",
"description": "Request parameters for OpenAI-compatible embeddings endpoint."
},
"OpenAIEmbeddingData": {
"type": "object",
@ -14596,19 +14598,19 @@
"title": "VectorStoreObject",
"description": "OpenAI Vector Store object."
},
"OpenaiCreateVectorStoreRequest": {
"OpenAICreateVectorStoreRequestWithExtraBody": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "A name for the vector store."
"description": "(Optional) A name for the vector store"
},
"file_ids": {
"type": "array",
"items": {
"type": "string"
},
"description": "A list of File IDs that the vector store should use. Useful for tools like `file_search` that can access files."
"description": "List of file IDs to include in the vector store"
},
"expires_after": {
"type": "object",
@ -14634,7 +14636,7 @@
}
]
},
"description": "The expiration policy for a vector store."
"description": "(Optional) Expiration policy for the vector store"
},
"chunking_strategy": {
"type": "object",
@ -14660,7 +14662,7 @@
}
]
},
"description": "The chunking strategy used to chunk the file(s). If not set, will use the `auto` strategy."
"description": "(Optional) Strategy for splitting files into chunks"
},
"metadata": {
"type": "object",
@ -14686,23 +14688,25 @@
}
]
},
"description": "Set of 16 key-value pairs that can be attached to an object."
"description": "Set of key-value pairs that can be attached to the vector store"
},
"embedding_model": {
"type": "string",
"description": "The embedding model to use for this vector store."
"description": "(Optional) The embedding model to use for this vector store"
},
"embedding_dimension": {
"type": "integer",
"description": "The dimension of the embedding vectors (default: 384)."
"default": 384,
"description": "(Optional) The dimension of the embedding vectors (default: 384)"
},
"provider_id": {
"type": "string",
"description": "The ID of the provider to use for this vector store."
"description": "(Optional) The ID of the provider to use for this vector store"
}
},
"additionalProperties": false,
"title": "OpenaiCreateVectorStoreRequest"
"title": "OpenAICreateVectorStoreRequestWithExtraBody",
"description": "Request to create a vector store with extra_body support."
},
"OpenaiUpdateVectorStoreRequest": {
"type": "object",
@ -14872,7 +14876,7 @@
"title": "VectorStoreChunkingStrategyStaticConfig",
"description": "Configuration for static chunking strategy."
},
"OpenaiCreateVectorStoreFileBatchRequest": {
"OpenAICreateVectorStoreFileBatchRequestWithExtraBody": {
"type": "object",
"properties": {
"file_ids": {
@ -14880,7 +14884,7 @@
"items": {
"type": "string"
},
"description": "A list of File IDs that the vector store should use."
"description": "A list of File IDs that the vector store should use"
},
"attributes": {
"type": "object",
@ -14906,18 +14910,19 @@
}
]
},
"description": "(Optional) Key-value attributes to store with the files."
"description": "(Optional) Key-value attributes to store with the files"
},
"chunking_strategy": {
"$ref": "#/components/schemas/VectorStoreChunkingStrategy",
"description": "(Optional) The chunking strategy used to chunk the file(s). Defaults to auto."
"description": "(Optional) The chunking strategy used to chunk the file(s). Defaults to auto"
}
},
"additionalProperties": false,
"required": [
"file_ids"
],
"title": "OpenaiCreateVectorStoreFileBatchRequest"
"title": "OpenAICreateVectorStoreFileBatchRequestWithExtraBody",
"description": "Request to create a vector store file batch with extra_body support."
},
"VectorStoreFileBatchObject": {
"type": "object",