Merge 6fb329d613 into sapling-pr-archive-ehhuang

This commit is contained in:
ehhuang 2025-11-05 14:11:07 -08:00 committed by GitHub
commit 913d9717b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 212 additions and 230 deletions

View file

@ -9976,6 +9976,70 @@ components:
- metadata - metadata
title: VectorStoreObject title: VectorStoreObject
description: OpenAI Vector Store object. description: OpenAI Vector Store object.
VectorStoreChunkingStrategy:
oneOf:
- $ref: '#/components/schemas/VectorStoreChunkingStrategyAuto'
- $ref: '#/components/schemas/VectorStoreChunkingStrategyStatic'
discriminator:
propertyName: type
mapping:
auto: '#/components/schemas/VectorStoreChunkingStrategyAuto'
static: '#/components/schemas/VectorStoreChunkingStrategyStatic'
VectorStoreChunkingStrategyAuto:
type: object
properties:
type:
type: string
const: auto
default: auto
description: >-
Strategy type, always "auto" for automatic chunking
additionalProperties: false
required:
- type
title: VectorStoreChunkingStrategyAuto
description: >-
Automatic chunking strategy for vector store files.
VectorStoreChunkingStrategyStatic:
type: object
properties:
type:
type: string
const: static
default: static
description: >-
Strategy type, always "static" for static chunking
static:
$ref: '#/components/schemas/VectorStoreChunkingStrategyStaticConfig'
description: >-
Configuration parameters for the static chunking strategy
additionalProperties: false
required:
- type
- static
title: VectorStoreChunkingStrategyStatic
description: >-
Static chunking strategy with configurable parameters.
VectorStoreChunkingStrategyStaticConfig:
type: object
properties:
chunk_overlap_tokens:
type: integer
default: 400
description: >-
Number of tokens to overlap between adjacent chunks
max_chunk_size_tokens:
type: integer
default: 800
description: >-
Maximum number of tokens per chunk, must be between 100 and 4096
additionalProperties: false
required:
- chunk_overlap_tokens
- max_chunk_size_tokens
title: VectorStoreChunkingStrategyStaticConfig
description: >-
Configuration for static chunking strategy.
"OpenAICreateVectorStoreRequestWithExtraBody": "OpenAICreateVectorStoreRequestWithExtraBody":
type: object type: object
properties: properties:
@ -10001,15 +10065,7 @@ components:
description: >- description: >-
(Optional) Expiration policy for the vector store (Optional) Expiration policy for the vector store
chunking_strategy: chunking_strategy:
type: object $ref: '#/components/schemas/VectorStoreChunkingStrategy'
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >- description: >-
(Optional) Strategy for splitting files into chunks (Optional) Strategy for splitting files into chunks
metadata: metadata:
@ -10085,70 +10141,6 @@ components:
- deleted - deleted
title: VectorStoreDeleteResponse title: VectorStoreDeleteResponse
description: Response from deleting a vector store. description: Response from deleting a vector store.
VectorStoreChunkingStrategy:
oneOf:
- $ref: '#/components/schemas/VectorStoreChunkingStrategyAuto'
- $ref: '#/components/schemas/VectorStoreChunkingStrategyStatic'
discriminator:
propertyName: type
mapping:
auto: '#/components/schemas/VectorStoreChunkingStrategyAuto'
static: '#/components/schemas/VectorStoreChunkingStrategyStatic'
VectorStoreChunkingStrategyAuto:
type: object
properties:
type:
type: string
const: auto
default: auto
description: >-
Strategy type, always "auto" for automatic chunking
additionalProperties: false
required:
- type
title: VectorStoreChunkingStrategyAuto
description: >-
Automatic chunking strategy for vector store files.
VectorStoreChunkingStrategyStatic:
type: object
properties:
type:
type: string
const: static
default: static
description: >-
Strategy type, always "static" for static chunking
static:
$ref: '#/components/schemas/VectorStoreChunkingStrategyStaticConfig'
description: >-
Configuration parameters for the static chunking strategy
additionalProperties: false
required:
- type
- static
title: VectorStoreChunkingStrategyStatic
description: >-
Static chunking strategy with configurable parameters.
VectorStoreChunkingStrategyStaticConfig:
type: object
properties:
chunk_overlap_tokens:
type: integer
default: 400
description: >-
Number of tokens to overlap between adjacent chunks
max_chunk_size_tokens:
type: integer
default: 800
description: >-
Maximum number of tokens per chunk, must be between 100 and 4096
additionalProperties: false
required:
- chunk_overlap_tokens
- max_chunk_size_tokens
title: VectorStoreChunkingStrategyStaticConfig
description: >-
Configuration for static chunking strategy.
"OpenAICreateVectorStoreFileBatchRequestWithExtraBody": "OpenAICreateVectorStoreFileBatchRequestWithExtraBody":
type: object type: object
properties: properties:
@ -10606,7 +10598,9 @@ components:
description: >- description: >-
Object type identifier for the search results page Object type identifier for the search results page
search_query: search_query:
type: string type: array
items:
type: string
description: >- description: >-
The original search query that was executed The original search query that was executed
data: data:

View file

@ -9260,6 +9260,70 @@ components:
- metadata - metadata
title: VectorStoreObject title: VectorStoreObject
description: OpenAI Vector Store object. description: OpenAI Vector Store object.
VectorStoreChunkingStrategy:
oneOf:
- $ref: '#/components/schemas/VectorStoreChunkingStrategyAuto'
- $ref: '#/components/schemas/VectorStoreChunkingStrategyStatic'
discriminator:
propertyName: type
mapping:
auto: '#/components/schemas/VectorStoreChunkingStrategyAuto'
static: '#/components/schemas/VectorStoreChunkingStrategyStatic'
VectorStoreChunkingStrategyAuto:
type: object
properties:
type:
type: string
const: auto
default: auto
description: >-
Strategy type, always "auto" for automatic chunking
additionalProperties: false
required:
- type
title: VectorStoreChunkingStrategyAuto
description: >-
Automatic chunking strategy for vector store files.
VectorStoreChunkingStrategyStatic:
type: object
properties:
type:
type: string
const: static
default: static
description: >-
Strategy type, always "static" for static chunking
static:
$ref: '#/components/schemas/VectorStoreChunkingStrategyStaticConfig'
description: >-
Configuration parameters for the static chunking strategy
additionalProperties: false
required:
- type
- static
title: VectorStoreChunkingStrategyStatic
description: >-
Static chunking strategy with configurable parameters.
VectorStoreChunkingStrategyStaticConfig:
type: object
properties:
chunk_overlap_tokens:
type: integer
default: 400
description: >-
Number of tokens to overlap between adjacent chunks
max_chunk_size_tokens:
type: integer
default: 800
description: >-
Maximum number of tokens per chunk, must be between 100 and 4096
additionalProperties: false
required:
- chunk_overlap_tokens
- max_chunk_size_tokens
title: VectorStoreChunkingStrategyStaticConfig
description: >-
Configuration for static chunking strategy.
"OpenAICreateVectorStoreRequestWithExtraBody": "OpenAICreateVectorStoreRequestWithExtraBody":
type: object type: object
properties: properties:
@ -9285,15 +9349,7 @@ components:
description: >- description: >-
(Optional) Expiration policy for the vector store (Optional) Expiration policy for the vector store
chunking_strategy: chunking_strategy:
type: object $ref: '#/components/schemas/VectorStoreChunkingStrategy'
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >- description: >-
(Optional) Strategy for splitting files into chunks (Optional) Strategy for splitting files into chunks
metadata: metadata:
@ -9369,70 +9425,6 @@ components:
- deleted - deleted
title: VectorStoreDeleteResponse title: VectorStoreDeleteResponse
description: Response from deleting a vector store. description: Response from deleting a vector store.
VectorStoreChunkingStrategy:
oneOf:
- $ref: '#/components/schemas/VectorStoreChunkingStrategyAuto'
- $ref: '#/components/schemas/VectorStoreChunkingStrategyStatic'
discriminator:
propertyName: type
mapping:
auto: '#/components/schemas/VectorStoreChunkingStrategyAuto'
static: '#/components/schemas/VectorStoreChunkingStrategyStatic'
VectorStoreChunkingStrategyAuto:
type: object
properties:
type:
type: string
const: auto
default: auto
description: >-
Strategy type, always "auto" for automatic chunking
additionalProperties: false
required:
- type
title: VectorStoreChunkingStrategyAuto
description: >-
Automatic chunking strategy for vector store files.
VectorStoreChunkingStrategyStatic:
type: object
properties:
type:
type: string
const: static
default: static
description: >-
Strategy type, always "static" for static chunking
static:
$ref: '#/components/schemas/VectorStoreChunkingStrategyStaticConfig'
description: >-
Configuration parameters for the static chunking strategy
additionalProperties: false
required:
- type
- static
title: VectorStoreChunkingStrategyStatic
description: >-
Static chunking strategy with configurable parameters.
VectorStoreChunkingStrategyStaticConfig:
type: object
properties:
chunk_overlap_tokens:
type: integer
default: 400
description: >-
Number of tokens to overlap between adjacent chunks
max_chunk_size_tokens:
type: integer
default: 800
description: >-
Maximum number of tokens per chunk, must be between 100 and 4096
additionalProperties: false
required:
- chunk_overlap_tokens
- max_chunk_size_tokens
title: VectorStoreChunkingStrategyStaticConfig
description: >-
Configuration for static chunking strategy.
"OpenAICreateVectorStoreFileBatchRequestWithExtraBody": "OpenAICreateVectorStoreFileBatchRequestWithExtraBody":
type: object type: object
properties: properties:
@ -9890,7 +9882,9 @@ components:
description: >- description: >-
Object type identifier for the search results page Object type identifier for the search results page
search_query: search_query:
type: string type: array
items:
type: string
description: >- description: >-
The original search query that was executed The original search query that was executed
data: data:

View file

@ -9976,6 +9976,70 @@ components:
- metadata - metadata
title: VectorStoreObject title: VectorStoreObject
description: OpenAI Vector Store object. description: OpenAI Vector Store object.
VectorStoreChunkingStrategy:
oneOf:
- $ref: '#/components/schemas/VectorStoreChunkingStrategyAuto'
- $ref: '#/components/schemas/VectorStoreChunkingStrategyStatic'
discriminator:
propertyName: type
mapping:
auto: '#/components/schemas/VectorStoreChunkingStrategyAuto'
static: '#/components/schemas/VectorStoreChunkingStrategyStatic'
VectorStoreChunkingStrategyAuto:
type: object
properties:
type:
type: string
const: auto
default: auto
description: >-
Strategy type, always "auto" for automatic chunking
additionalProperties: false
required:
- type
title: VectorStoreChunkingStrategyAuto
description: >-
Automatic chunking strategy for vector store files.
VectorStoreChunkingStrategyStatic:
type: object
properties:
type:
type: string
const: static
default: static
description: >-
Strategy type, always "static" for static chunking
static:
$ref: '#/components/schemas/VectorStoreChunkingStrategyStaticConfig'
description: >-
Configuration parameters for the static chunking strategy
additionalProperties: false
required:
- type
- static
title: VectorStoreChunkingStrategyStatic
description: >-
Static chunking strategy with configurable parameters.
VectorStoreChunkingStrategyStaticConfig:
type: object
properties:
chunk_overlap_tokens:
type: integer
default: 400
description: >-
Number of tokens to overlap between adjacent chunks
max_chunk_size_tokens:
type: integer
default: 800
description: >-
Maximum number of tokens per chunk, must be between 100 and 4096
additionalProperties: false
required:
- chunk_overlap_tokens
- max_chunk_size_tokens
title: VectorStoreChunkingStrategyStaticConfig
description: >-
Configuration for static chunking strategy.
"OpenAICreateVectorStoreRequestWithExtraBody": "OpenAICreateVectorStoreRequestWithExtraBody":
type: object type: object
properties: properties:
@ -10001,15 +10065,7 @@ components:
description: >- description: >-
(Optional) Expiration policy for the vector store (Optional) Expiration policy for the vector store
chunking_strategy: chunking_strategy:
type: object $ref: '#/components/schemas/VectorStoreChunkingStrategy'
additionalProperties:
oneOf:
- type: 'null'
- type: boolean
- type: number
- type: string
- type: array
- type: object
description: >- description: >-
(Optional) Strategy for splitting files into chunks (Optional) Strategy for splitting files into chunks
metadata: metadata:
@ -10085,70 +10141,6 @@ components:
- deleted - deleted
title: VectorStoreDeleteResponse title: VectorStoreDeleteResponse
description: Response from deleting a vector store. description: Response from deleting a vector store.
VectorStoreChunkingStrategy:
oneOf:
- $ref: '#/components/schemas/VectorStoreChunkingStrategyAuto'
- $ref: '#/components/schemas/VectorStoreChunkingStrategyStatic'
discriminator:
propertyName: type
mapping:
auto: '#/components/schemas/VectorStoreChunkingStrategyAuto'
static: '#/components/schemas/VectorStoreChunkingStrategyStatic'
VectorStoreChunkingStrategyAuto:
type: object
properties:
type:
type: string
const: auto
default: auto
description: >-
Strategy type, always "auto" for automatic chunking
additionalProperties: false
required:
- type
title: VectorStoreChunkingStrategyAuto
description: >-
Automatic chunking strategy for vector store files.
VectorStoreChunkingStrategyStatic:
type: object
properties:
type:
type: string
const: static
default: static
description: >-
Strategy type, always "static" for static chunking
static:
$ref: '#/components/schemas/VectorStoreChunkingStrategyStaticConfig'
description: >-
Configuration parameters for the static chunking strategy
additionalProperties: false
required:
- type
- static
title: VectorStoreChunkingStrategyStatic
description: >-
Static chunking strategy with configurable parameters.
VectorStoreChunkingStrategyStaticConfig:
type: object
properties:
chunk_overlap_tokens:
type: integer
default: 400
description: >-
Number of tokens to overlap between adjacent chunks
max_chunk_size_tokens:
type: integer
default: 800
description: >-
Maximum number of tokens per chunk, must be between 100 and 4096
additionalProperties: false
required:
- chunk_overlap_tokens
- max_chunk_size_tokens
title: VectorStoreChunkingStrategyStaticConfig
description: >-
Configuration for static chunking strategy.
"OpenAICreateVectorStoreFileBatchRequestWithExtraBody": "OpenAICreateVectorStoreFileBatchRequestWithExtraBody":
type: object type: object
properties: properties:
@ -10606,7 +10598,9 @@ components:
description: >- description: >-
Object type identifier for the search results page Object type identifier for the search results page
search_query: search_query:
type: string type: array
items:
type: string
description: >- description: >-
The original search query that was executed The original search query that was executed
data: data:

View file

@ -260,7 +260,7 @@ class VectorStoreSearchResponsePage(BaseModel):
""" """
object: str = "vector_store.search_results.page" object: str = "vector_store.search_results.page"
search_query: str search_query: list[str]
data: list[VectorStoreSearchResponse] data: list[VectorStoreSearchResponse]
has_more: bool = False has_more: bool = False
next_page: str | None = None next_page: str | None = None
@ -478,7 +478,7 @@ class OpenAICreateVectorStoreRequestWithExtraBody(BaseModel, extra="allow"):
name: str | None = None name: str | None = None
file_ids: list[str] | None = None file_ids: list[str] | None = None
expires_after: dict[str, Any] | None = None expires_after: dict[str, Any] | None = None
chunking_strategy: dict[str, Any] | None = None chunking_strategy: VectorStoreChunkingStrategy | None = None
metadata: dict[str, Any] | None = None metadata: dict[str, Any] | None = None

View file

@ -642,7 +642,7 @@ class OpenAIVectorStoreMixin(ABC):
break break
return VectorStoreSearchResponsePage( return VectorStoreSearchResponsePage(
search_query=search_query, search_query=query if isinstance(query, list) else [query],
data=data, data=data,
has_more=False, # For simplicity, we don't implement pagination here has_more=False, # For simplicity, we don't implement pagination here
next_page=None, next_page=None,
@ -652,7 +652,7 @@ class OpenAIVectorStoreMixin(ABC):
logger.error(f"Error searching vector store {vector_store_id}: {e}") logger.error(f"Error searching vector store {vector_store_id}: {e}")
# Return empty results on error # Return empty results on error
return VectorStoreSearchResponsePage( return VectorStoreSearchResponsePage(
search_query=search_query, search_query=query if isinstance(query, list) else [query],
data=[], data=[],
has_more=False, has_more=False,
next_page=None, next_page=None,
@ -891,8 +891,8 @@ class OpenAIVectorStoreMixin(ABC):
# Determine pagination info # Determine pagination info
has_more = len(file_objects) > limit has_more = len(file_objects) > limit
first_id = file_objects[0].id if file_objects else None first_id = limited_files[0].id if file_objects else None
last_id = file_objects[-1].id if file_objects else None last_id = limited_files[-1].id if file_objects else None
return VectorStoreListFilesResponse( return VectorStoreListFilesResponse(
data=limited_files, data=limited_files,

View file

@ -350,7 +350,7 @@ def test_openai_vector_store_search_empty(
assert search_response is not None assert search_response is not None
assert hasattr(search_response, "data") assert hasattr(search_response, "data")
assert len(search_response.data) == 0 # Empty store should return no results assert len(search_response.data) == 0 # Empty store should return no results
assert search_response.search_query == "test query" assert search_response.search_query == ["test query"]
assert search_response.has_more is False assert search_response.has_more is False
@ -825,7 +825,7 @@ def test_openai_vector_store_list_files(
assert first_page.has_more assert first_page.has_more
assert len(first_page.data) == 2 assert len(first_page.data) == 2
assert first_page.first_id == first_page.data[0].id assert first_page.first_id == first_page.data[0].id
assert first_page.last_id != first_page.data[-1].id assert first_page.last_id == first_page.data[-1].id
next_page = compat_client.vector_stores.files.list( next_page = compat_client.vector_stores.files.list(
vector_store_id=vector_store.id, limit=2, after=first_page.data[-1].id vector_store_id=vector_store.id, limit=2, after=first_page.data[-1].id