Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client-sdks/stainless/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13928,6 +13928,7 @@ components:
anyOf:
- type: string
- type: 'null'
description: Name of the ranking algorithm. Supported values are "weighted", "rrf", "neural", and "classifier". Other string values are accepted for OpenAI API compatibility but are not supported.
score_threshold:
anyOf:
- type: number
Expand Down
1 change: 1 addition & 0 deletions docs/static/deprecated-ogx-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7572,6 +7572,7 @@ components:
anyOf:
- type: string
- type: 'null'
description: Name of the ranking algorithm. Supported values are "weighted", "rrf", "neural", and "classifier". Other string values are accepted for OpenAI API compatibility but are not supported.
score_threshold:
anyOf:
- type: number
Expand Down
1 change: 1 addition & 0 deletions docs/static/experimental-ogx-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8942,6 +8942,7 @@ components:
anyOf:
- type: string
- type: 'null'
description: Name of the ranking algorithm. Supported values are "weighted", "rrf", "neural", and "classifier". Other string values are accepted for OpenAI API compatibility but are not supported.
score_threshold:
anyOf:
- type: number
Expand Down
1 change: 1 addition & 0 deletions docs/static/ogx-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12444,6 +12444,7 @@ components:
anyOf:
- type: string
- type: 'null'
description: Name of the ranking algorithm. Supported values are "weighted", "rrf", "neural", and "classifier". Other string values are accepted for OpenAI API compatibility but are not supported.
score_threshold:
anyOf:
- type: number
Expand Down
1 change: 1 addition & 0 deletions docs/static/stainless-ogx-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13928,6 +13928,7 @@ components:
anyOf:
- type: string
- type: 'null'
description: Name of the ranking algorithm. Supported values are "weighted", "rrf", "neural", and "classifier". Other string values are accepted for OpenAI API compatibility but are not supported.
score_threshold:
anyOf:
- type: number
Expand Down
8 changes: 7 additions & 1 deletion src/ogx_api/vector_io/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,13 @@ class SearchRankingOptions(BaseModel):
weights contains "neural".
"""

ranker: str | None = None
ranker: str | None = Field(
default=None,
description=(
'Name of the ranking algorithm. Supported values are "weighted", "rrf", "neural", and '
'"classifier". Other string values are accepted for OpenAI API compatibility but are not supported.'
),
)
# NOTE: OpenAI File Search Tool requires threshold to be between 0 and 1, however
# we don't guarantee that the score is between 0 and 1, so will leave this unconstrained
# and let the provider handle it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
from ogx_api.vector_io import SearchRankingOptions, VectorStoreSearchResponsePage


def test_ranking_options_schema_documents_supported_rankers():
"""The API schema should explain which ranker values OGX supports."""
ranker_schema = SearchRankingOptions.model_json_schema()["properties"]["ranker"]

description = ranker_schema.get("description")
assert description
for ranker in ("weighted", "rrf", "neural", "classifier"):
assert ranker in description


async def test_file_search_forwards_ranking_options_weights(mock_vector_io_api):
"""Test that file_search forwards ranking_options.weights to vector store search."""
query = "What is machine learning?"
Expand Down
Loading