diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 663f950e..fefaf86b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: Get GitHub OIDC Token if: github.repository == 'stainless-sdks/mixedbread-python' id: github-oidc - uses: actions/github-script@v6 + uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 563004f2..fea34540 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.46.0" + ".": "1.0.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 14e62078..9f60014e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 63 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-5ad16eef3948ad48d494f6c0bf0b7da1063e177df5b8deaeedb53502101026d7.yml -openapi_spec_hash: 631634e0b03b231050e790e28377e51f -config_hash: 9e3a32dc554db9ce76299ea928123b75 +configured_endpoints: 51 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-68449c5f406b2b3bc2b94ef7f94c47b3724aa0a69e1033bef1a84477f79420f5.yml +openapi_spec_hash: 2b6de88d9a14a977a66f37c066d0b47a +config_hash: fb2cfcdc5ef83ff03407a8b66c26a59b diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e3cc3f4..844a5b1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 1.0.0 (2026-02-12) + +Full Changelog: [v0.46.0...v1.0.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.46.0...v1.0.0) + +### Features + +* **api:** api update ([aa4cd1b](https://github.com/mixedbread-ai/mixedbread-python/commit/aa4cd1be677441f7099b98316825fa4873b7d0a9)) +* **api:** api update ([4ee152e](https://github.com/mixedbread-ai/mixedbread-python/commit/4ee152e99e45c3c3ead05f66864b8c5ad0f703bf)) +* **api:** api update ([dbf3b5a](https://github.com/mixedbread-ai/mixedbread-python/commit/dbf3b5a1de72068247b21fa1ccb6449f19af1437)) +* **api:** api update ([af6abf1](https://github.com/mixedbread-ai/mixedbread-python/commit/af6abf14e00dc0adf7ed962b0cb9edf3c40846fb)) +* **api:** api update ([650eb91](https://github.com/mixedbread-ai/mixedbread-python/commit/650eb91df9e65e4c6d9ad95db440f78381cee89e)) +* **api:** api update ([c5efbe2](https://github.com/mixedbread-ai/mixedbread-python/commit/c5efbe227c1ce9a01beace2df1019f30d39fe9b8)) +* **api:** manual updates ([8ac3ea2](https://github.com/mixedbread-ai/mixedbread-python/commit/8ac3ea2e1fd757e00ceab7eb97d7421848869664)) +* **client:** add custom JSON encoder for extended type support ([75cc241](https://github.com/mixedbread-ai/mixedbread-python/commit/75cc241a06480f5dee3f3a3c284ee51663e68193)) + + +### Chores + +* **ci:** upgrade `actions/github-script` ([56e9034](https://github.com/mixedbread-ai/mixedbread-python/commit/56e9034b3f755fef67982f5c2a122a69802c6ea4)) +* **internal:** bump dependencies ([580f6f8](https://github.com/mixedbread-ai/mixedbread-python/commit/580f6f8a878e936e1f9474138c1d7c839681b537)) + ## 0.46.0 (2026-01-17) Full Changelog: [v0.45.0...v0.46.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.45.0...v0.46.0) diff --git a/api.md b/api.md index 090bbc6c..f42e0be4 100644 --- a/api.md +++ b/api.md @@ -24,7 +24,7 @@ Methods: - client.info() -> InfoResponse - client.rerank(\*\*params) -> RerankResponse -# VectorStores +# Stores Types: @@ -35,54 +35,6 @@ from mixedbread.types import ( ScoredImageURLInputChunk, ScoredTextInputChunk, ScoredVideoURLInputChunk, - VectorStore, - VectorStoreChunkSearchOptions, - VectorStoreDeleteResponse, - VectorStoreQuestionAnsweringResponse, - VectorStoreSearchResponse, -) -``` - -Methods: - -- client.vector_stores.create(\*\*params) -> VectorStore -- client.vector_stores.retrieve(vector_store_identifier) -> VectorStore -- client.vector_stores.update(vector_store_identifier, \*\*params) -> VectorStore -- client.vector_stores.list(\*\*params) -> SyncCursor[VectorStore] -- client.vector_stores.delete(vector_store_identifier) -> VectorStoreDeleteResponse -- client.vector_stores.question_answering(\*\*params) -> VectorStoreQuestionAnsweringResponse -- client.vector_stores.search(\*\*params) -> VectorStoreSearchResponse - -## Files - -Types: - -```python -from mixedbread.types.vector_stores import ( - RerankConfig, - ScoredVectorStoreFile, - VectorStoreFileStatus, - VectorStoreFile, - FileListResponse, - FileDeleteResponse, - FileSearchResponse, -) -``` - -Methods: - -- client.vector_stores.files.create(vector_store_identifier, \*\*params) -> VectorStoreFile -- client.vector_stores.files.retrieve(file_id, \*, vector_store_identifier, \*\*params) -> VectorStoreFile -- client.vector_stores.files.list(vector_store_identifier, \*\*params) -> FileListResponse -- client.vector_stores.files.delete(file_id, \*, vector_store_identifier) -> FileDeleteResponse -- client.vector_stores.files.search(\*\*params) -> FileSearchResponse - -# Stores - -Types: - -```python -from mixedbread.types import ( Store, StoreChunkSearchOptions, StoreDeleteResponse, diff --git a/pyproject.toml b/pyproject.toml index 999e2513..babc8df7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mixedbread" -version = "0.46.0" +version = "1.0.0" description = "The official Python library for the Mixedbread API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/requirements-dev.lock b/requirements-dev.lock index fe8d5892..35a7b124 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,14 +12,14 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via httpx-aiohttp # via mixedbread aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.12.0 +anyio==4.12.1 # via httpx # via mixedbread argcomplete==3.6.3 @@ -31,7 +31,7 @@ attrs==25.4.0 # via nox backports-asyncio-runner==1.2.0 # via pytest-asyncio -certifi==2025.11.12 +certifi==2026.1.4 # via httpcore # via httpx colorlog==6.10.1 @@ -61,7 +61,7 @@ httpx==0.28.1 # via httpx-aiohttp # via mixedbread # via respx -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via mixedbread humanize==4.13.0 # via nox @@ -69,7 +69,7 @@ idna==3.11 # via anyio # via httpx # via yarl -importlib-metadata==8.7.0 +importlib-metadata==8.7.1 iniconfig==2.1.0 # via pytest markdown-it-py==3.0.0 @@ -82,14 +82,14 @@ multidict==6.7.0 mypy==1.17.0 mypy-extensions==1.1.0 # via mypy -nodeenv==1.9.1 +nodeenv==1.10.0 # via pyright nox==2025.11.12 packaging==25.0 # via dependency-groups # via nox # via pytest -pathspec==0.12.1 +pathspec==1.0.3 # via mypy platformdirs==4.4.0 # via virtualenv @@ -115,13 +115,13 @@ python-dateutil==2.9.0.post0 # via time-machine respx==0.22.0 rich==14.2.0 -ruff==0.14.7 +ruff==0.14.13 six==1.17.0 # via python-dateutil sniffio==1.3.1 # via mixedbread time-machine==2.19.0 -tomli==2.3.0 +tomli==2.4.0 # via dependency-groups # via mypy # via nox @@ -141,7 +141,7 @@ typing-extensions==4.15.0 # via virtualenv typing-inspection==0.4.2 # via pydantic -virtualenv==20.35.4 +virtualenv==20.36.1 # via nox yarl==1.22.0 # via aiohttp diff --git a/requirements.lock b/requirements.lock index 1161d859..ce962fbc 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,21 +12,21 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via httpx-aiohttp # via mixedbread aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.12.0 +anyio==4.12.1 # via httpx # via mixedbread async-timeout==5.0.1 # via aiohttp attrs==25.4.0 # via aiohttp -certifi==2025.11.12 +certifi==2026.1.4 # via httpcore # via httpx distro==1.9.0 @@ -43,7 +43,7 @@ httpcore==1.0.9 httpx==0.28.1 # via httpx-aiohttp # via mixedbread -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via mixedbread idna==3.11 # via anyio diff --git a/src/mixedbread/_base_client.py b/src/mixedbread/_base_client.py index 8da2f693..dded30e9 100644 --- a/src/mixedbread/_base_client.py +++ b/src/mixedbread/_base_client.py @@ -86,6 +86,7 @@ APIConnectionError, APIResponseValidationError, ) +from ._utils._json import openapi_dumps log: logging.Logger = logging.getLogger(__name__) @@ -554,8 +555,10 @@ def _build_request( kwargs["content"] = options.content elif isinstance(json_data, bytes): kwargs["content"] = json_data - else: - kwargs["json"] = json_data if is_given(json_data) else None + elif not files: + # Don't set content when JSON is sent as multipart/form-data, + # since httpx's content param overrides other body arguments + kwargs["content"] = openapi_dumps(json_data) if is_given(json_data) and json_data is not None else None kwargs["files"] = files else: headers.pop("Content-Type", None) diff --git a/src/mixedbread/_client.py b/src/mixedbread/_client.py index a70709d3..3982ee4e 100644 --- a/src/mixedbread/_client.py +++ b/src/mixedbread/_client.py @@ -53,7 +53,7 @@ from .types.embedding_create_response import EmbeddingCreateResponse if TYPE_CHECKING: - from .resources import chat, files, stores, parsing, api_keys, embeddings, extractions, data_sources, vector_stores + from .resources import chat, files, stores, parsing, api_keys, embeddings, extractions, data_sources from .resources.chat import ChatResource, AsyncChatResource from .resources.files import FilesResource, AsyncFilesResource from .resources.api_keys import APIKeysResource, AsyncAPIKeysResource @@ -62,7 +62,6 @@ from .resources.parsing.parsing import ParsingResource, AsyncParsingResource from .resources.extractions.extractions import ExtractionsResource, AsyncExtractionsResource from .resources.data_sources.data_sources import DataSourcesResource, AsyncDataSourcesResource - from .resources.vector_stores.vector_stores import VectorStoresResource, AsyncVectorStoresResource __all__ = [ "ENVIRONMENTS", @@ -162,12 +161,6 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - @cached_property - def vector_stores(self) -> VectorStoresResource: - from .resources.vector_stores import VectorStoresResource - - return VectorStoresResource(self) - @cached_property def stores(self) -> StoresResource: from .resources.stores import StoresResource @@ -565,12 +558,6 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - @cached_property - def vector_stores(self) -> AsyncVectorStoresResource: - from .resources.vector_stores import AsyncVectorStoresResource - - return AsyncVectorStoresResource(self) - @cached_property def stores(self) -> AsyncStoresResource: from .resources.stores import AsyncStoresResource @@ -905,12 +892,6 @@ def __init__(self, client: Mixedbread) -> None: client.rerank, ) - @cached_property - def vector_stores(self) -> vector_stores.VectorStoresResourceWithRawResponse: - from .resources.vector_stores import VectorStoresResourceWithRawResponse - - return VectorStoresResourceWithRawResponse(self._client.vector_stores) - @cached_property def stores(self) -> stores.StoresResourceWithRawResponse: from .resources.stores import StoresResourceWithRawResponse @@ -976,12 +957,6 @@ def __init__(self, client: AsyncMixedbread) -> None: client.rerank, ) - @cached_property - def vector_stores(self) -> vector_stores.AsyncVectorStoresResourceWithRawResponse: - from .resources.vector_stores import AsyncVectorStoresResourceWithRawResponse - - return AsyncVectorStoresResourceWithRawResponse(self._client.vector_stores) - @cached_property def stores(self) -> stores.AsyncStoresResourceWithRawResponse: from .resources.stores import AsyncStoresResourceWithRawResponse @@ -1047,12 +1022,6 @@ def __init__(self, client: Mixedbread) -> None: client.rerank, ) - @cached_property - def vector_stores(self) -> vector_stores.VectorStoresResourceWithStreamingResponse: - from .resources.vector_stores import VectorStoresResourceWithStreamingResponse - - return VectorStoresResourceWithStreamingResponse(self._client.vector_stores) - @cached_property def stores(self) -> stores.StoresResourceWithStreamingResponse: from .resources.stores import StoresResourceWithStreamingResponse @@ -1118,12 +1087,6 @@ def __init__(self, client: AsyncMixedbread) -> None: client.rerank, ) - @cached_property - def vector_stores(self) -> vector_stores.AsyncVectorStoresResourceWithStreamingResponse: - from .resources.vector_stores import AsyncVectorStoresResourceWithStreamingResponse - - return AsyncVectorStoresResourceWithStreamingResponse(self._client.vector_stores) - @cached_property def stores(self) -> stores.AsyncStoresResourceWithStreamingResponse: from .resources.stores import AsyncStoresResourceWithStreamingResponse diff --git a/src/mixedbread/_compat.py b/src/mixedbread/_compat.py index bdef67f0..786ff42a 100644 --- a/src/mixedbread/_compat.py +++ b/src/mixedbread/_compat.py @@ -139,6 +139,7 @@ def model_dump( exclude_defaults: bool = False, warnings: bool = True, mode: Literal["json", "python"] = "python", + by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): return model.model_dump( @@ -148,13 +149,12 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, + by_alias=by_alias, ) return cast( "dict[str, Any]", model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast] - exclude=exclude, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, + exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias) ), ) diff --git a/src/mixedbread/_utils/_json.py b/src/mixedbread/_utils/_json.py new file mode 100644 index 00000000..60584214 --- /dev/null +++ b/src/mixedbread/_utils/_json.py @@ -0,0 +1,35 @@ +import json +from typing import Any +from datetime import datetime +from typing_extensions import override + +import pydantic + +from .._compat import model_dump + + +def openapi_dumps(obj: Any) -> bytes: + """ + Serialize an object to UTF-8 encoded JSON bytes. + + Extends the standard json.dumps with support for additional types + commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc. + """ + return json.dumps( + obj, + cls=_CustomEncoder, + # Uses the same defaults as httpx's JSON serialization + ensure_ascii=False, + separators=(",", ":"), + allow_nan=False, + ).encode() + + +class _CustomEncoder(json.JSONEncoder): + @override + def default(self, o: Any) -> Any: + if isinstance(o, datetime): + return o.isoformat() + if isinstance(o, pydantic.BaseModel): + return model_dump(o, exclude_unset=True, mode="json", by_alias=True) + return super().default(o) diff --git a/src/mixedbread/_version.py b/src/mixedbread/_version.py index d86e36b9..a6b0880b 100644 --- a/src/mixedbread/_version.py +++ b/src/mixedbread/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "mixedbread" -__version__ = "0.46.0" # x-release-please-version +__version__ = "1.0.0" # x-release-please-version diff --git a/src/mixedbread/resources/__init__.py b/src/mixedbread/resources/__init__.py index 368addbe..a9073d39 100644 --- a/src/mixedbread/resources/__init__.py +++ b/src/mixedbread/resources/__init__.py @@ -64,22 +64,8 @@ DataSourcesResourceWithStreamingResponse, AsyncDataSourcesResourceWithStreamingResponse, ) -from .vector_stores import ( - VectorStoresResource, - AsyncVectorStoresResource, - VectorStoresResourceWithRawResponse, - AsyncVectorStoresResourceWithRawResponse, - VectorStoresResourceWithStreamingResponse, - AsyncVectorStoresResourceWithStreamingResponse, -) __all__ = [ - "VectorStoresResource", - "AsyncVectorStoresResource", - "VectorStoresResourceWithRawResponse", - "AsyncVectorStoresResourceWithRawResponse", - "VectorStoresResourceWithStreamingResponse", - "AsyncVectorStoresResourceWithStreamingResponse", "StoresResource", "AsyncStoresResource", "StoresResourceWithRawResponse", diff --git a/src/mixedbread/resources/stores/files.py b/src/mixedbread/resources/stores/files.py index cd131e06..6edd79dd 100644 --- a/src/mixedbread/resources/stores/files.py +++ b/src/mixedbread/resources/stores/files.py @@ -352,7 +352,7 @@ def delete( def search( self, *, - query: str, + query: file_search_params.Query, store_identifiers: SequenceNotStr[str], top_k: int | Omit = omit, filters: Optional[file_search_params.Filters] | Omit = omit, @@ -891,7 +891,7 @@ async def delete( async def search( self, *, - query: str, + query: file_search_params.Query, store_identifiers: SequenceNotStr[str], top_k: int | Omit = omit, filters: Optional[file_search_params.Filters] | Omit = omit, diff --git a/src/mixedbread/resources/stores/stores.py b/src/mixedbread/resources/stores/stores.py index 66a55d84..41eac718 100644 --- a/src/mixedbread/resources/stores/stores.py +++ b/src/mixedbread/resources/stores/stores.py @@ -484,7 +484,7 @@ def question_answering( def search( self, *, - query: str, + query: store_search_params.Query, store_identifiers: SequenceNotStr[str], top_k: int | Omit = omit, filters: Optional[store_search_params.Filters] | Omit = omit, @@ -1000,7 +1000,7 @@ async def question_answering( async def search( self, *, - query: str, + query: store_search_params.Query, store_identifiers: SequenceNotStr[str], top_k: int | Omit = omit, filters: Optional[store_search_params.Filters] | Omit = omit, diff --git a/src/mixedbread/resources/vector_stores/__init__.py b/src/mixedbread/resources/vector_stores/__init__.py deleted file mode 100644 index 85d202da..00000000 --- a/src/mixedbread/resources/vector_stores/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .files import ( - FilesResource, - AsyncFilesResource, - FilesResourceWithRawResponse, - AsyncFilesResourceWithRawResponse, - FilesResourceWithStreamingResponse, - AsyncFilesResourceWithStreamingResponse, -) -from .vector_stores import ( - VectorStoresResource, - AsyncVectorStoresResource, - VectorStoresResourceWithRawResponse, - AsyncVectorStoresResourceWithRawResponse, - VectorStoresResourceWithStreamingResponse, - AsyncVectorStoresResourceWithStreamingResponse, -) - -__all__ = [ - "FilesResource", - "AsyncFilesResource", - "FilesResourceWithRawResponse", - "AsyncFilesResourceWithRawResponse", - "FilesResourceWithStreamingResponse", - "AsyncFilesResourceWithStreamingResponse", - "VectorStoresResource", - "AsyncVectorStoresResource", - "VectorStoresResourceWithRawResponse", - "AsyncVectorStoresResourceWithRawResponse", - "VectorStoresResourceWithStreamingResponse", - "AsyncVectorStoresResourceWithStreamingResponse", -] diff --git a/src/mixedbread/resources/vector_stores/files.py b/src/mixedbread/resources/vector_stores/files.py deleted file mode 100644 index 2de5594a..00000000 --- a/src/mixedbread/resources/vector_stores/files.py +++ /dev/null @@ -1,992 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import functools -import typing_extensions -from typing import Any, List, Union, Iterable, Optional - -import httpx - -from ...lib import polling -from ..._types import Body, Omit, Query, Headers, NotGiven, FileTypes, SequenceNotStr, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options -from ...types.vector_stores import file_list_params, file_create_params, file_search_params, file_retrieve_params -from ...types.stores.store_file_status import StoreFileStatus -from ...types.vector_stores.vector_store_file import VectorStoreFile -from ...types.vector_stores.file_list_response import FileListResponse -from ...types.vector_stores.file_delete_response import FileDeleteResponse -from ...types.vector_stores.file_search_response import FileSearchResponse - -__all__ = ["FilesResource", "AsyncFilesResource"] - - -class FilesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> FilesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/mixedbread-ai/mixedbread-python#accessing-raw-response-data-eg-headers - """ - return FilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> FilesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/mixedbread-ai/mixedbread-python#with_streaming_response - """ - return FilesResourceWithStreamingResponse(self) - - @typing_extensions.deprecated("Use post stores.files instead") - def create( - self, - vector_store_identifier: str, - *, - metadata: object | Omit = omit, - config: file_create_params.Config | Omit = omit, - external_id: Optional[str] | Omit = omit, - overwrite: bool | Omit = omit, - file_id: str, - experimental: Optional[file_create_params.Experimental] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStoreFile: - """ - DEPRECATED: Use POST /stores/{store_identifier}/files instead - - Args: - vector_store_identifier: The ID or name of the vector store - - metadata: Optional metadata for the file - - config: Configuration for adding the file - - external_id: External identifier for this file in the store - - overwrite: If true, overwrite an existing file with the same external_id - - file_id: ID of the file to add - - experimental: Configuration for a file. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return self._post( - f"/v1/vector_stores/{vector_store_identifier}/files", - body=maybe_transform( - { - "metadata": metadata, - "config": config, - "external_id": external_id, - "overwrite": overwrite, - "file_id": file_id, - "experimental": experimental, - }, - file_create_params.FileCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFile, - ) - - @typing_extensions.deprecated("Use stores.files instead") - def retrieve( - self, - file_id: str, - *, - vector_store_identifier: str, - return_chunks: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStoreFile: - """ - DEPRECATED: Use GET /stores/{store_identifier}/files/{file_id} instead - - Args: - vector_store_identifier: The ID or name of the vector store - - file_id: The ID or name of the file - - return_chunks: Whether to return the chunks for the file - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return self._get( - f"/v1/vector_stores/{vector_store_identifier}/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"return_chunks": return_chunks}, file_retrieve_params.FileRetrieveParams), - ), - cast_to=VectorStoreFile, - ) - - @typing_extensions.deprecated("Use post stores.files.list instead") - def list( - self, - vector_store_identifier: str, - *, - limit: int | Omit = omit, - after: Optional[str] | Omit = omit, - before: Optional[str] | Omit = omit, - include_total: bool | Omit = omit, - statuses: Optional[List[StoreFileStatus]] | Omit = omit, - metadata_filter: Optional[file_list_params.MetadataFilter] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FileListResponse: - """ - DEPRECATED: Use POST /stores/{store_identifier}/files/list instead - - Args: - vector_store_identifier: The ID or name of the vector store - - limit: Maximum number of items to return per page (1-100) - - after: Cursor for forward pagination - get items after this position. Use last_cursor - from previous response. - - before: Cursor for backward pagination - get items before this position. Use - first_cursor from previous response. - - include_total: Whether to include total count in response (expensive operation) - - statuses: Status to filter by - - metadata_filter: Metadata filter to apply to the query - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return self._post( - f"/v1/vector_stores/{vector_store_identifier}/files/list", - body=maybe_transform( - { - "limit": limit, - "after": after, - "before": before, - "include_total": include_total, - "statuses": statuses, - "metadata_filter": metadata_filter, - }, - file_list_params.FileListParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileListResponse, - ) - - @typing_extensions.deprecated("Use stores.files instead") - def delete( - self, - file_id: str, - *, - vector_store_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FileDeleteResponse: - """ - DEPRECATED: Use DELETE /stores/{store_identifier}/files/{file_id} instead - - Args: - vector_store_identifier: The ID or name of the vector store - - file_id: The ID or name of the file to delete - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return self._delete( - f"/v1/vector_stores/{vector_store_identifier}/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileDeleteResponse, - ) - - @typing_extensions.deprecated("Use stores.files.search instead") - def search( - self, - *, - query: str, - vector_store_identifiers: SequenceNotStr[str], - top_k: int | Omit = omit, - filters: Optional[file_search_params.Filters] | Omit = omit, - file_ids: Union[Iterable[object], SequenceNotStr[str], None] | Omit = omit, - search_options: file_search_params.SearchOptions | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FileSearchResponse: - """ - DEPRECATED: Use POST /stores/{store_identifier}/files/search instead - - Args: - query: Search query text - - vector_store_identifiers: IDs or names of vector stores to search - - top_k: Number of results to return - - filters: Optional filter conditions - - file_ids: Optional list of file IDs to filter chunks by (inclusion filter) - - search_options: Search configuration options - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/v1/vector_stores/files/search", - body=maybe_transform( - { - "query": query, - "vector_store_identifiers": vector_store_identifiers, - "top_k": top_k, - "filters": filters, - "file_ids": file_ids, - "search_options": search_options, - }, - file_search_params.FileSearchParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileSearchResponse, - ) - - def poll( - self, - file_id: str, - *, - vector_store_identifier: str, - poll_interval_ms: int | NotGiven = not_given, - poll_timeout_ms: float | NotGiven = not_given, - **kwargs: Any, - ) -> VectorStoreFile: - """ - Poll for a file's status until it reaches a terminal state. - Args: - file_id: The ID of the file to poll - vector_store_identifier: The ID of the vector store - poll_interval_ms: The interval between polls in milliseconds - poll_timeout_ms: The maximum time to poll for in milliseconds - Returns: - The file object once it reaches a terminal state - """ - polling_interval_ms = poll_interval_ms or 500 - polling_timeout_ms = poll_timeout_ms or None - return polling.poll( - fn=functools.partial(self.retrieve, file_id, vector_store_identifier=vector_store_identifier, **kwargs), - condition=lambda res: res.status == "completed" or res.status == "failed" or res.status == "cancelled", - interval_seconds=polling_interval_ms / 1000, - timeout_seconds=polling_timeout_ms / 1000 if polling_timeout_ms else None, - ) - - def create_and_poll( - self, - file_id: str, - *, - vector_store_identifier: str, - metadata: Optional[object] | NotGiven = not_given, - experimental: file_create_params.Experimental | NotGiven = not_given, - poll_interval_ms: int | NotGiven = not_given, - poll_timeout_ms: float | NotGiven = not_given, - **kwargs: Any, - ) -> VectorStoreFile: - """ - Attach a file to the given vector store and wait for it to be processed. - Args: - file_id: The ID of the file to poll - vector_store_identifier: The ID of the vector store - metadata: The metadata to attach to the file - poll_interval_ms: The interval between polls in milliseconds - poll_timeout_ms: The maximum time to poll for in milliseconds - Returns: - The file object once it reaches a terminal state - """ - self.create( - vector_store_identifier=vector_store_identifier, file_id=file_id, metadata=metadata, experimental=experimental, **kwargs - ) - return self.poll( - file_id, - vector_store_identifier=vector_store_identifier, - poll_interval_ms=poll_interval_ms, - poll_timeout_ms=poll_timeout_ms, - **kwargs, - ) - - def upload( - self, - *, - vector_store_identifier: str, - file: FileTypes, - metadata: Optional[object] | NotGiven = not_given, - experimental: file_create_params.Experimental | NotGiven = not_given, - **kwargs: Any, - ) -> VectorStoreFile: - """Upload a file to the `files` API and then attach it to the given vector store. - Note the file will be asynchronously processed (you can use the alternative - polling helper method to wait for processing to complete). - """ - file_obj = self._client.files.create(file=file, **kwargs) - return self.create( - vector_store_identifier=vector_store_identifier, - file_id=file_obj.id, - metadata=metadata, - experimental=experimental, - **kwargs, - ) - - def upload_and_poll( - self, - *, - vector_store_identifier: str, - file: FileTypes, - metadata: Optional[object] | NotGiven = not_given, - experimental: file_create_params.Experimental | NotGiven = not_given, - poll_interval_ms: int | NotGiven = not_given, - poll_timeout_ms: float | NotGiven = not_given, - **kwargs: Any, - ) -> VectorStoreFile: - """Add a file to a vector store and poll until processing is complete.""" - file_obj = self._client.files.create(file=file, **kwargs) - return self.create_and_poll( - vector_store_identifier=vector_store_identifier, - file_id=file_obj.id, - metadata=metadata, - experimental=experimental, - poll_interval_ms=poll_interval_ms, - poll_timeout_ms=poll_timeout_ms, - **kwargs, - ) - - -class AsyncFilesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncFilesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/mixedbread-ai/mixedbread-python#accessing-raw-response-data-eg-headers - """ - return AsyncFilesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/mixedbread-ai/mixedbread-python#with_streaming_response - """ - return AsyncFilesResourceWithStreamingResponse(self) - - @typing_extensions.deprecated("Use post stores.files instead") - async def create( - self, - vector_store_identifier: str, - *, - metadata: object | Omit = omit, - config: file_create_params.Config | Omit = omit, - external_id: Optional[str] | Omit = omit, - overwrite: bool | Omit = omit, - file_id: str, - experimental: Optional[file_create_params.Experimental] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStoreFile: - """ - DEPRECATED: Use POST /stores/{store_identifier}/files instead - - Args: - vector_store_identifier: The ID or name of the vector store - - metadata: Optional metadata for the file - - config: Configuration for adding the file - - external_id: External identifier for this file in the store - - overwrite: If true, overwrite an existing file with the same external_id - - file_id: ID of the file to add - - experimental: Configuration for a file. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return await self._post( - f"/v1/vector_stores/{vector_store_identifier}/files", - body=await async_maybe_transform( - { - "metadata": metadata, - "config": config, - "external_id": external_id, - "overwrite": overwrite, - "file_id": file_id, - "experimental": experimental, - }, - file_create_params.FileCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreFile, - ) - - @typing_extensions.deprecated("Use stores.files instead") - async def retrieve( - self, - file_id: str, - *, - vector_store_identifier: str, - return_chunks: bool | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStoreFile: - """ - DEPRECATED: Use GET /stores/{store_identifier}/files/{file_id} instead - - Args: - vector_store_identifier: The ID or name of the vector store - - file_id: The ID or name of the file - - return_chunks: Whether to return the chunks for the file - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return await self._get( - f"/v1/vector_stores/{vector_store_identifier}/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"return_chunks": return_chunks}, file_retrieve_params.FileRetrieveParams - ), - ), - cast_to=VectorStoreFile, - ) - - @typing_extensions.deprecated("Use post stores.files.list instead") - async def list( - self, - vector_store_identifier: str, - *, - limit: int | Omit = omit, - after: Optional[str] | Omit = omit, - before: Optional[str] | Omit = omit, - include_total: bool | Omit = omit, - statuses: Optional[List[StoreFileStatus]] | Omit = omit, - metadata_filter: Optional[file_list_params.MetadataFilter] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FileListResponse: - """ - DEPRECATED: Use POST /stores/{store_identifier}/files/list instead - - Args: - vector_store_identifier: The ID or name of the vector store - - limit: Maximum number of items to return per page (1-100) - - after: Cursor for forward pagination - get items after this position. Use last_cursor - from previous response. - - before: Cursor for backward pagination - get items before this position. Use - first_cursor from previous response. - - include_total: Whether to include total count in response (expensive operation) - - statuses: Status to filter by - - metadata_filter: Metadata filter to apply to the query - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return await self._post( - f"/v1/vector_stores/{vector_store_identifier}/files/list", - body=await async_maybe_transform( - { - "limit": limit, - "after": after, - "before": before, - "include_total": include_total, - "statuses": statuses, - "metadata_filter": metadata_filter, - }, - file_list_params.FileListParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileListResponse, - ) - - @typing_extensions.deprecated("Use stores.files instead") - async def delete( - self, - file_id: str, - *, - vector_store_identifier: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FileDeleteResponse: - """ - DEPRECATED: Use DELETE /stores/{store_identifier}/files/{file_id} instead - - Args: - vector_store_identifier: The ID or name of the vector store - - file_id: The ID or name of the file to delete - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - if not file_id: - raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") - return await self._delete( - f"/v1/vector_stores/{vector_store_identifier}/files/{file_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileDeleteResponse, - ) - - @typing_extensions.deprecated("Use stores.files.search instead") - async def search( - self, - *, - query: str, - vector_store_identifiers: SequenceNotStr[str], - top_k: int | Omit = omit, - filters: Optional[file_search_params.Filters] | Omit = omit, - file_ids: Union[Iterable[object], SequenceNotStr[str], None] | Omit = omit, - search_options: file_search_params.SearchOptions | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> FileSearchResponse: - """ - DEPRECATED: Use POST /stores/{store_identifier}/files/search instead - - Args: - query: Search query text - - vector_store_identifiers: IDs or names of vector stores to search - - top_k: Number of results to return - - filters: Optional filter conditions - - file_ids: Optional list of file IDs to filter chunks by (inclusion filter) - - search_options: Search configuration options - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/v1/vector_stores/files/search", - body=await async_maybe_transform( - { - "query": query, - "vector_store_identifiers": vector_store_identifiers, - "top_k": top_k, - "filters": filters, - "file_ids": file_ids, - "search_options": search_options, - }, - file_search_params.FileSearchParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=FileSearchResponse, - ) - - async def poll( - self, - file_id: str, - *, - vector_store_identifier: str, - poll_interval_ms: int | NotGiven = not_given, - poll_timeout_ms: float | NotGiven = not_given, - **kwargs: Any, - ) -> VectorStoreFile: - """ - Poll for a file's status until it reaches a terminal state. - Args: - file_id: The ID of the file to poll - vector_store_identifier: The ID of the vector store - poll_interval_ms: The interval between polls in milliseconds - poll_timeout_ms: The maximum time to poll for in milliseconds - Returns: - The file object once it reaches a terminal state - """ - polling_interval_ms = poll_interval_ms or 500 - polling_timeout_ms = poll_timeout_ms or None - return await polling.poll_async( - fn=functools.partial(self.retrieve, file_id, vector_store_identifier=vector_store_identifier, **kwargs), - condition=lambda res: res.status == "completed" or res.status == "failed" or res.status == "cancelled", - interval_seconds=polling_interval_ms / 1000, - timeout_seconds=polling_timeout_ms / 1000 if polling_timeout_ms else None, - ) - - async def create_and_poll( - self, - file_id: str, - *, - vector_store_identifier: str, - metadata: Optional[object] | NotGiven = not_given, - experimental: file_create_params.Experimental | NotGiven = not_given, - poll_interval_ms: int | NotGiven = not_given, - poll_timeout_ms: float | NotGiven = not_given, - **kwargs: Any, - ) -> VectorStoreFile: - """ - Attach a file to the given vector store and wait for it to be processed. - Args: - file_id: The ID of the file to poll - vector_store_identifier: The ID of the vector store - metadata: The metadata to attach to the file - poll_interval_ms: The interval between polls in milliseconds - poll_timeout_ms: The maximum time to poll for in milliseconds - Returns: - The file object once it reaches a terminal state - """ - await self.create( - vector_store_identifier=vector_store_identifier, - file_id=file_id, - metadata=metadata, - experimental=experimental, - **kwargs, - ) - return await self.poll( - file_id, - vector_store_identifier=vector_store_identifier, - poll_interval_ms=poll_interval_ms, - poll_timeout_ms=poll_timeout_ms, - **kwargs, - ) - - async def upload( - self, - *, - vector_store_identifier: str, - file: FileTypes, - metadata: Optional[object] | NotGiven = not_given, - experimental: file_create_params.Experimental | NotGiven = not_given, - **kwargs: Any, - ) -> VectorStoreFile: - """Upload a file to the `files` API and then attach it to the given vector store. - Note the file will be asynchronously processed (you can use the alternative - polling helper method to wait for processing to complete). - """ - file_obj = await self._client.files.create(file=file, **kwargs) - return await self.create( - vector_store_identifier=vector_store_identifier, - file_id=file_obj.id, - metadata=metadata, - experimental=experimental, - **kwargs, - ) - - async def upload_and_poll( - self, - *, - vector_store_identifier: str, - file: FileTypes, - metadata: Optional[object] | NotGiven = not_given, - experimental: file_create_params.Experimental | NotGiven = not_given, - poll_interval_ms: int | NotGiven = not_given, - poll_timeout_ms: float | NotGiven = not_given, - **kwargs: Any, - ) -> VectorStoreFile: - """Add a file to a vector store and poll until processing is complete.""" - file_obj = await self._client.files.create(file=file, **kwargs) - return await self.create_and_poll( - vector_store_identifier=vector_store_identifier, - file_id=file_obj.id, - metadata=metadata, - experimental=experimental, - poll_interval_ms=poll_interval_ms, - poll_timeout_ms=poll_timeout_ms, - **kwargs, - ) - - -class FilesResourceWithRawResponse: - def __init__(self, files: FilesResource) -> None: - self._files = files - - self.create = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - files.create, # pyright: ignore[reportDeprecated], - ) - ) - self.retrieve = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - files.retrieve, # pyright: ignore[reportDeprecated], - ) - ) - self.list = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - files.list, # pyright: ignore[reportDeprecated], - ) - ) - self.delete = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - files.delete, # pyright: ignore[reportDeprecated], - ) - ) - self.search = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - files.search, # pyright: ignore[reportDeprecated], - ) - ) - - -class AsyncFilesResourceWithRawResponse: - def __init__(self, files: AsyncFilesResource) -> None: - self._files = files - - self.create = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - files.create, # pyright: ignore[reportDeprecated], - ) - ) - self.retrieve = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - files.retrieve, # pyright: ignore[reportDeprecated], - ) - ) - self.list = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - files.list, # pyright: ignore[reportDeprecated], - ) - ) - self.delete = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - files.delete, # pyright: ignore[reportDeprecated], - ) - ) - self.search = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - files.search, # pyright: ignore[reportDeprecated], - ) - ) - - -class FilesResourceWithStreamingResponse: - def __init__(self, files: FilesResource) -> None: - self._files = files - - self.create = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - files.create, # pyright: ignore[reportDeprecated], - ) - ) - self.retrieve = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - files.retrieve, # pyright: ignore[reportDeprecated], - ) - ) - self.list = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - files.list, # pyright: ignore[reportDeprecated], - ) - ) - self.delete = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - files.delete, # pyright: ignore[reportDeprecated], - ) - ) - self.search = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - files.search, # pyright: ignore[reportDeprecated], - ) - ) - - -class AsyncFilesResourceWithStreamingResponse: - def __init__(self, files: AsyncFilesResource) -> None: - self._files = files - - self.create = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - files.create, # pyright: ignore[reportDeprecated], - ) - ) - self.retrieve = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - files.retrieve, # pyright: ignore[reportDeprecated], - ) - ) - self.list = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - files.list, # pyright: ignore[reportDeprecated], - ) - ) - self.delete = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - files.delete, # pyright: ignore[reportDeprecated], - ) - ) - self.search = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - files.search, # pyright: ignore[reportDeprecated], - ) - ) diff --git a/src/mixedbread/resources/vector_stores/vector_stores.py b/src/mixedbread/resources/vector_stores/vector_stores.py deleted file mode 100644 index b8e3dd13..00000000 --- a/src/mixedbread/resources/vector_stores/vector_stores.py +++ /dev/null @@ -1,1054 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import typing_extensions -from typing import Union, Iterable, Optional - -import httpx - -from .files import ( - FilesResource, - AsyncFilesResource, - FilesResourceWithRawResponse, - AsyncFilesResourceWithRawResponse, - FilesResourceWithStreamingResponse, - AsyncFilesResourceWithStreamingResponse, -) -from ...types import ( - vector_store_list_params, - vector_store_create_params, - vector_store_search_params, - vector_store_update_params, - vector_store_question_answering_params, -) -from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...pagination import SyncCursor, AsyncCursor -from ..._base_client import AsyncPaginator, make_request_options -from ...types.vector_store import VectorStore -from ...types.expires_after_param import ExpiresAfterParam -from ...types.vector_store_delete_response import VectorStoreDeleteResponse -from ...types.vector_store_search_response import VectorStoreSearchResponse -from ...types.vector_store_chunk_search_options_param import VectorStoreChunkSearchOptionsParam -from ...types.vector_store_question_answering_response import VectorStoreQuestionAnsweringResponse - -__all__ = ["VectorStoresResource", "AsyncVectorStoresResource"] - - -class VectorStoresResource(SyncAPIResource): - @cached_property - def files(self) -> FilesResource: - return FilesResource(self._client) - - @cached_property - def with_raw_response(self) -> VectorStoresResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/mixedbread-ai/mixedbread-python#accessing-raw-response-data-eg-headers - """ - return VectorStoresResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> VectorStoresResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/mixedbread-ai/mixedbread-python#with_streaming_response - """ - return VectorStoresResourceWithStreamingResponse(self) - - @typing_extensions.deprecated("Use stores instead") - def create( - self, - *, - name: Optional[str] | Omit = omit, - description: Optional[str] | Omit = omit, - is_public: bool | Omit = omit, - expires_after: Optional[ExpiresAfterParam] | Omit = omit, - metadata: object | Omit = omit, - file_ids: Optional[SequenceNotStr[str]] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStore: - """ - DEPRECATED: Use POST /stores instead - - Args: - name: Name for the new vector store - - description: Description of the vector store - - is_public: Whether the vector store can be accessed by anyone with valid login credentials - - expires_after: Represents an expiration policy for a store. - - metadata: Optional metadata key-value pairs - - file_ids: Optional list of file IDs - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/v1/vector_stores", - body=maybe_transform( - { - "name": name, - "description": description, - "is_public": is_public, - "expires_after": expires_after, - "metadata": metadata, - "file_ids": file_ids, - }, - vector_store_create_params.VectorStoreCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStore, - ) - - @typing_extensions.deprecated("Use stores instead") - def retrieve( - self, - vector_store_identifier: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStore: - """ - DEPRECATED: Use GET /stores/{store_identifier} instead - - Args: - vector_store_identifier: The ID or name of the vector store - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return self._get( - f"/v1/vector_stores/{vector_store_identifier}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStore, - ) - - @typing_extensions.deprecated("Use stores instead") - def update( - self, - vector_store_identifier: str, - *, - name: Optional[str] | Omit = omit, - description: Optional[str] | Omit = omit, - is_public: Optional[bool] | Omit = omit, - expires_after: Optional[ExpiresAfterParam] | Omit = omit, - metadata: object | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStore: - """ - DEPRECATED: Use PUT /stores/{store_identifier} instead - - Args: - vector_store_identifier: The ID or name of the vector store - - name: New name for the store - - description: New description - - is_public: Whether the vector store can be accessed by anyone with valid login credentials - - expires_after: Represents an expiration policy for a store. - - metadata: Optional metadata key-value pairs - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return self._put( - f"/v1/vector_stores/{vector_store_identifier}", - body=maybe_transform( - { - "name": name, - "description": description, - "is_public": is_public, - "expires_after": expires_after, - "metadata": metadata, - }, - vector_store_update_params.VectorStoreUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStore, - ) - - @typing_extensions.deprecated("Use stores instead") - def list( - self, - *, - limit: int | Omit = omit, - after: Optional[str] | Omit = omit, - before: Optional[str] | Omit = omit, - include_total: bool | Omit = omit, - q: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncCursor[VectorStore]: - """ - DEPRECATED: Use GET /stores instead - - Args: - limit: Maximum number of items to return per page (1-100) - - after: Cursor for forward pagination - get items after this position. Use last_cursor - from previous response. - - before: Cursor for backward pagination - get items before this position. Use - first_cursor from previous response. - - include_total: Whether to include total count in response (expensive operation) - - q: Search query for fuzzy matching over name and description fields - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - "/v1/vector_stores", - page=SyncCursor[VectorStore], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "limit": limit, - "after": after, - "before": before, - "include_total": include_total, - "q": q, - }, - vector_store_list_params.VectorStoreListParams, - ), - ), - model=VectorStore, - ) - - @typing_extensions.deprecated("Use stores instead") - def delete( - self, - vector_store_identifier: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStoreDeleteResponse: - """ - DEPRECATED: Use DELETE /stores/{store_identifier} instead - - Args: - vector_store_identifier: The ID or name of the vector store to delete - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return self._delete( - f"/v1/vector_stores/{vector_store_identifier}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreDeleteResponse, - ) - - @typing_extensions.deprecated("Use stores.question_answering instead") - def question_answering( - self, - *, - query: str | Omit = omit, - vector_store_identifiers: SequenceNotStr[str], - top_k: int | Omit = omit, - filters: Optional[vector_store_question_answering_params.Filters] | Omit = omit, - file_ids: Union[Iterable[object], SequenceNotStr[str], None] | Omit = omit, - search_options: VectorStoreChunkSearchOptionsParam | Omit = omit, - stream: bool | Omit = omit, - qa_options: vector_store_question_answering_params.QaOptions | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStoreQuestionAnsweringResponse: - """ - DEPRECATED: Use POST /stores/question-answering instead - - Args: - query: Question to answer. If not provided, the question will be extracted from the - passed messages. - - vector_store_identifiers: IDs or names of vector stores to search - - top_k: Number of results to return - - filters: Optional filter conditions - - file_ids: Optional list of file IDs to filter chunks by (inclusion filter) - - search_options: Search configuration options - - stream: Whether to stream the answer - - qa_options: Question answering configuration options - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/v1/vector_stores/question-answering", - body=maybe_transform( - { - "query": query, - "vector_store_identifiers": vector_store_identifiers, - "top_k": top_k, - "filters": filters, - "file_ids": file_ids, - "search_options": search_options, - "stream": stream, - "qa_options": qa_options, - }, - vector_store_question_answering_params.VectorStoreQuestionAnsweringParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreQuestionAnsweringResponse, - ) - - @typing_extensions.deprecated("Use stores.search instead") - def search( - self, - *, - query: str, - vector_store_identifiers: SequenceNotStr[str], - top_k: int | Omit = omit, - filters: Optional[vector_store_search_params.Filters] | Omit = omit, - file_ids: Union[Iterable[object], SequenceNotStr[str], None] | Omit = omit, - search_options: VectorStoreChunkSearchOptionsParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStoreSearchResponse: - """ - DEPRECATED: Use POST /stores/search instead - - Args: - query: Search query text - - vector_store_identifiers: IDs or names of vector stores to search - - top_k: Number of results to return - - filters: Optional filter conditions - - file_ids: Optional list of file IDs to filter chunks by (inclusion filter) - - search_options: Search configuration options - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/v1/vector_stores/search", - body=maybe_transform( - { - "query": query, - "vector_store_identifiers": vector_store_identifiers, - "top_k": top_k, - "filters": filters, - "file_ids": file_ids, - "search_options": search_options, - }, - vector_store_search_params.VectorStoreSearchParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreSearchResponse, - ) - - -class AsyncVectorStoresResource(AsyncAPIResource): - @cached_property - def files(self) -> AsyncFilesResource: - return AsyncFilesResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncVectorStoresResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/mixedbread-ai/mixedbread-python#accessing-raw-response-data-eg-headers - """ - return AsyncVectorStoresResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncVectorStoresResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/mixedbread-ai/mixedbread-python#with_streaming_response - """ - return AsyncVectorStoresResourceWithStreamingResponse(self) - - @typing_extensions.deprecated("Use stores instead") - async def create( - self, - *, - name: Optional[str] | Omit = omit, - description: Optional[str] | Omit = omit, - is_public: bool | Omit = omit, - expires_after: Optional[ExpiresAfterParam] | Omit = omit, - metadata: object | Omit = omit, - file_ids: Optional[SequenceNotStr[str]] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStore: - """ - DEPRECATED: Use POST /stores instead - - Args: - name: Name for the new vector store - - description: Description of the vector store - - is_public: Whether the vector store can be accessed by anyone with valid login credentials - - expires_after: Represents an expiration policy for a store. - - metadata: Optional metadata key-value pairs - - file_ids: Optional list of file IDs - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/v1/vector_stores", - body=await async_maybe_transform( - { - "name": name, - "description": description, - "is_public": is_public, - "expires_after": expires_after, - "metadata": metadata, - "file_ids": file_ids, - }, - vector_store_create_params.VectorStoreCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStore, - ) - - @typing_extensions.deprecated("Use stores instead") - async def retrieve( - self, - vector_store_identifier: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStore: - """ - DEPRECATED: Use GET /stores/{store_identifier} instead - - Args: - vector_store_identifier: The ID or name of the vector store - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return await self._get( - f"/v1/vector_stores/{vector_store_identifier}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStore, - ) - - @typing_extensions.deprecated("Use stores instead") - async def update( - self, - vector_store_identifier: str, - *, - name: Optional[str] | Omit = omit, - description: Optional[str] | Omit = omit, - is_public: Optional[bool] | Omit = omit, - expires_after: Optional[ExpiresAfterParam] | Omit = omit, - metadata: object | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStore: - """ - DEPRECATED: Use PUT /stores/{store_identifier} instead - - Args: - vector_store_identifier: The ID or name of the vector store - - name: New name for the store - - description: New description - - is_public: Whether the vector store can be accessed by anyone with valid login credentials - - expires_after: Represents an expiration policy for a store. - - metadata: Optional metadata key-value pairs - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return await self._put( - f"/v1/vector_stores/{vector_store_identifier}", - body=await async_maybe_transform( - { - "name": name, - "description": description, - "is_public": is_public, - "expires_after": expires_after, - "metadata": metadata, - }, - vector_store_update_params.VectorStoreUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStore, - ) - - @typing_extensions.deprecated("Use stores instead") - def list( - self, - *, - limit: int | Omit = omit, - after: Optional[str] | Omit = omit, - before: Optional[str] | Omit = omit, - include_total: bool | Omit = omit, - q: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[VectorStore, AsyncCursor[VectorStore]]: - """ - DEPRECATED: Use GET /stores instead - - Args: - limit: Maximum number of items to return per page (1-100) - - after: Cursor for forward pagination - get items after this position. Use last_cursor - from previous response. - - before: Cursor for backward pagination - get items before this position. Use - first_cursor from previous response. - - include_total: Whether to include total count in response (expensive operation) - - q: Search query for fuzzy matching over name and description fields - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - "/v1/vector_stores", - page=AsyncCursor[VectorStore], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "limit": limit, - "after": after, - "before": before, - "include_total": include_total, - "q": q, - }, - vector_store_list_params.VectorStoreListParams, - ), - ), - model=VectorStore, - ) - - @typing_extensions.deprecated("Use stores instead") - async def delete( - self, - vector_store_identifier: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStoreDeleteResponse: - """ - DEPRECATED: Use DELETE /stores/{store_identifier} instead - - Args: - vector_store_identifier: The ID or name of the vector store to delete - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not vector_store_identifier: - raise ValueError( - f"Expected a non-empty value for `vector_store_identifier` but received {vector_store_identifier!r}" - ) - return await self._delete( - f"/v1/vector_stores/{vector_store_identifier}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreDeleteResponse, - ) - - @typing_extensions.deprecated("Use stores.question_answering instead") - async def question_answering( - self, - *, - query: str | Omit = omit, - vector_store_identifiers: SequenceNotStr[str], - top_k: int | Omit = omit, - filters: Optional[vector_store_question_answering_params.Filters] | Omit = omit, - file_ids: Union[Iterable[object], SequenceNotStr[str], None] | Omit = omit, - search_options: VectorStoreChunkSearchOptionsParam | Omit = omit, - stream: bool | Omit = omit, - qa_options: vector_store_question_answering_params.QaOptions | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStoreQuestionAnsweringResponse: - """ - DEPRECATED: Use POST /stores/question-answering instead - - Args: - query: Question to answer. If not provided, the question will be extracted from the - passed messages. - - vector_store_identifiers: IDs or names of vector stores to search - - top_k: Number of results to return - - filters: Optional filter conditions - - file_ids: Optional list of file IDs to filter chunks by (inclusion filter) - - search_options: Search configuration options - - stream: Whether to stream the answer - - qa_options: Question answering configuration options - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/v1/vector_stores/question-answering", - body=await async_maybe_transform( - { - "query": query, - "vector_store_identifiers": vector_store_identifiers, - "top_k": top_k, - "filters": filters, - "file_ids": file_ids, - "search_options": search_options, - "stream": stream, - "qa_options": qa_options, - }, - vector_store_question_answering_params.VectorStoreQuestionAnsweringParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreQuestionAnsweringResponse, - ) - - @typing_extensions.deprecated("Use stores.search instead") - async def search( - self, - *, - query: str, - vector_store_identifiers: SequenceNotStr[str], - top_k: int | Omit = omit, - filters: Optional[vector_store_search_params.Filters] | Omit = omit, - file_ids: Union[Iterable[object], SequenceNotStr[str], None] | Omit = omit, - search_options: VectorStoreChunkSearchOptionsParam | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> VectorStoreSearchResponse: - """ - DEPRECATED: Use POST /stores/search instead - - Args: - query: Search query text - - vector_store_identifiers: IDs or names of vector stores to search - - top_k: Number of results to return - - filters: Optional filter conditions - - file_ids: Optional list of file IDs to filter chunks by (inclusion filter) - - search_options: Search configuration options - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/v1/vector_stores/search", - body=await async_maybe_transform( - { - "query": query, - "vector_store_identifiers": vector_store_identifiers, - "top_k": top_k, - "filters": filters, - "file_ids": file_ids, - "search_options": search_options, - }, - vector_store_search_params.VectorStoreSearchParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=VectorStoreSearchResponse, - ) - - -class VectorStoresResourceWithRawResponse: - def __init__(self, vector_stores: VectorStoresResource) -> None: - self._vector_stores = vector_stores - - self.create = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - vector_stores.create, # pyright: ignore[reportDeprecated], - ) - ) - self.retrieve = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - vector_stores.retrieve, # pyright: ignore[reportDeprecated], - ) - ) - self.update = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - vector_stores.update, # pyright: ignore[reportDeprecated], - ) - ) - self.list = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - vector_stores.list, # pyright: ignore[reportDeprecated], - ) - ) - self.delete = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - vector_stores.delete, # pyright: ignore[reportDeprecated], - ) - ) - self.question_answering = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - vector_stores.question_answering, # pyright: ignore[reportDeprecated], - ) - ) - self.search = ( # pyright: ignore[reportDeprecated] - to_raw_response_wrapper( - vector_stores.search, # pyright: ignore[reportDeprecated], - ) - ) - - @cached_property - def files(self) -> FilesResourceWithRawResponse: - return FilesResourceWithRawResponse(self._vector_stores.files) - - -class AsyncVectorStoresResourceWithRawResponse: - def __init__(self, vector_stores: AsyncVectorStoresResource) -> None: - self._vector_stores = vector_stores - - self.create = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - vector_stores.create, # pyright: ignore[reportDeprecated], - ) - ) - self.retrieve = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - vector_stores.retrieve, # pyright: ignore[reportDeprecated], - ) - ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - vector_stores.update, # pyright: ignore[reportDeprecated], - ) - ) - self.list = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - vector_stores.list, # pyright: ignore[reportDeprecated], - ) - ) - self.delete = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - vector_stores.delete, # pyright: ignore[reportDeprecated], - ) - ) - self.question_answering = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - vector_stores.question_answering, # pyright: ignore[reportDeprecated], - ) - ) - self.search = ( # pyright: ignore[reportDeprecated] - async_to_raw_response_wrapper( - vector_stores.search, # pyright: ignore[reportDeprecated], - ) - ) - - @cached_property - def files(self) -> AsyncFilesResourceWithRawResponse: - return AsyncFilesResourceWithRawResponse(self._vector_stores.files) - - -class VectorStoresResourceWithStreamingResponse: - def __init__(self, vector_stores: VectorStoresResource) -> None: - self._vector_stores = vector_stores - - self.create = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - vector_stores.create, # pyright: ignore[reportDeprecated], - ) - ) - self.retrieve = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - vector_stores.retrieve, # pyright: ignore[reportDeprecated], - ) - ) - self.update = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - vector_stores.update, # pyright: ignore[reportDeprecated], - ) - ) - self.list = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - vector_stores.list, # pyright: ignore[reportDeprecated], - ) - ) - self.delete = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - vector_stores.delete, # pyright: ignore[reportDeprecated], - ) - ) - self.question_answering = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - vector_stores.question_answering, # pyright: ignore[reportDeprecated], - ) - ) - self.search = ( # pyright: ignore[reportDeprecated] - to_streamed_response_wrapper( - vector_stores.search, # pyright: ignore[reportDeprecated], - ) - ) - - @cached_property - def files(self) -> FilesResourceWithStreamingResponse: - return FilesResourceWithStreamingResponse(self._vector_stores.files) - - -class AsyncVectorStoresResourceWithStreamingResponse: - def __init__(self, vector_stores: AsyncVectorStoresResource) -> None: - self._vector_stores = vector_stores - - self.create = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - vector_stores.create, # pyright: ignore[reportDeprecated], - ) - ) - self.retrieve = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - vector_stores.retrieve, # pyright: ignore[reportDeprecated], - ) - ) - self.update = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - vector_stores.update, # pyright: ignore[reportDeprecated], - ) - ) - self.list = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - vector_stores.list, # pyright: ignore[reportDeprecated], - ) - ) - self.delete = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - vector_stores.delete, # pyright: ignore[reportDeprecated], - ) - ) - self.question_answering = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - vector_stores.question_answering, # pyright: ignore[reportDeprecated], - ) - ) - self.search = ( # pyright: ignore[reportDeprecated] - async_to_streamed_response_wrapper( - vector_stores.search, # pyright: ignore[reportDeprecated], - ) - ) - - @cached_property - def files(self) -> AsyncFilesResourceWithStreamingResponse: - return AsyncFilesResourceWithStreamingResponse(self._vector_stores.files) diff --git a/src/mixedbread/types/__init__.py b/src/mixedbread/types/__init__.py index 20bcd899..306c151e 100644 --- a/src/mixedbread/types/__init__.py +++ b/src/mixedbread/types/__init__.py @@ -10,7 +10,6 @@ from .embedding import Embedding as Embedding from .data_source import DataSource as DataSource from .file_object import FileObject as FileObject -from .vector_store import VectorStore as VectorStore from .expires_after import ExpiresAfter as ExpiresAfter from .info_response import InfoResponse as InfoResponse from .oauth2_params import Oauth2Params as Oauth2Params @@ -41,34 +40,19 @@ from .linear_data_source_param import LinearDataSourceParam as LinearDataSourceParam from .multi_encoding_embedding import MultiEncodingEmbedding as MultiEncodingEmbedding from .notion_data_source_param import NotionDataSourceParam as NotionDataSourceParam -from .vector_store_list_params import VectorStoreListParams as VectorStoreListParams from .data_source_create_params import DataSourceCreateParams as DataSourceCreateParams from .data_source_oauth2_params import DataSourceOauth2Params as DataSourceOauth2Params from .data_source_update_params import DataSourceUpdateParams as DataSourceUpdateParams from .embedding_create_response import EmbeddingCreateResponse as EmbeddingCreateResponse -from .vector_store_create_params import VectorStoreCreateParams as VectorStoreCreateParams -from .vector_store_search_params import VectorStoreSearchParams as VectorStoreSearchParams -from .vector_store_update_params import VectorStoreUpdateParams as VectorStoreUpdateParams from .data_source_delete_response import DataSourceDeleteResponse as DataSourceDeleteResponse from .scored_audio_url_input_chunk import ScoredAudioURLInputChunk as ScoredAudioURLInputChunk from .scored_image_url_input_chunk import ScoredImageURLInputChunk as ScoredImageURLInputChunk from .scored_video_url_input_chunk import ScoredVideoURLInputChunk as ScoredVideoURLInputChunk from .store_metadata_facets_params import StoreMetadataFacetsParams as StoreMetadataFacetsParams -from .vector_store_delete_response import VectorStoreDeleteResponse as VectorStoreDeleteResponse -from .vector_store_search_response import VectorStoreSearchResponse as VectorStoreSearchResponse from .store_metadata_facets_response import StoreMetadataFacetsResponse as StoreMetadataFacetsResponse from .store_question_answering_params import StoreQuestionAnsweringParams as StoreQuestionAnsweringParams from .store_chunk_search_options_param import StoreChunkSearchOptionsParam as StoreChunkSearchOptionsParam from .store_question_answering_response import StoreQuestionAnsweringResponse as StoreQuestionAnsweringResponse -from .vector_store_question_answering_params import ( - VectorStoreQuestionAnsweringParams as VectorStoreQuestionAnsweringParams, -) -from .vector_store_chunk_search_options_param import ( - VectorStoreChunkSearchOptionsParam as VectorStoreChunkSearchOptionsParam, -) -from .vector_store_question_answering_response import ( - VectorStoreQuestionAnsweringResponse as VectorStoreQuestionAnsweringResponse, -) # Rebuild cyclical models only after all modules are imported. # This ensures that, when building the deferred (due to cyclical references) model schema, diff --git a/src/mixedbread/types/scored_audio_url_input_chunk.py b/src/mixedbread/types/scored_audio_url_input_chunk.py index 68a8d369..ce6ad67a 100644 --- a/src/mixedbread/types/scored_audio_url_input_chunk.py +++ b/src/mixedbread/types/scored_audio_url_input_chunk.py @@ -18,6 +18,7 @@ "GeneratedMetadataPdfChunkGeneratedMetadata", "GeneratedMetadataCodeChunkGeneratedMetadata", "GeneratedMetadataAudioChunkGeneratedMetadata", + "GeneratedMetadataVideoChunkGeneratedMetadata", "AudioURL", ] @@ -53,6 +54,8 @@ class GeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel): num_lines: Optional[int] = None + frontmatter: Optional[Dict[str, object]] = None + if TYPE_CHECKING: # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a # value to this field, so for compatibility we avoid doing it at runtime. @@ -172,6 +175,36 @@ def __getattr__(self, attr: str) -> object: ... __pydantic_extra__: Dict[str, object] +class GeneratedMetadataVideoChunkGeneratedMetadata(BaseModel): + type: Optional[Literal["video"]] = None + + file_type: str + + file_size: int + + total_duration_seconds: float + + fps: float + + width: int + + height: int + + frame_count: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + GeneratedMetadata: TypeAlias = Annotated[ Union[ GeneratedMetadataMarkdownChunkGeneratedMetadata, @@ -179,6 +212,7 @@ def __getattr__(self, attr: str) -> object: ... GeneratedMetadataPdfChunkGeneratedMetadata, GeneratedMetadataCodeChunkGeneratedMetadata, GeneratedMetadataAudioChunkGeneratedMetadata, + GeneratedMetadataVideoChunkGeneratedMetadata, None, ], PropertyInfo(discriminator="type"), @@ -186,7 +220,7 @@ def __getattr__(self, attr: str) -> object: ... class AudioURL(BaseModel): - """The audio input specification.""" + """Model for audio URL validation.""" url: str """The audio URL. Can be either a URL or a Data URI.""" @@ -229,8 +263,8 @@ class ScoredAudioURLInputChunk(BaseModel): summary: Optional[str] = None """summary of the audio""" - audio_url: AudioURL - """The audio input specification.""" + audio_url: Optional[AudioURL] = None + """Model for audio URL validation.""" sampling_rate: int """The sampling rate of the audio.""" diff --git a/src/mixedbread/types/scored_image_url_input_chunk.py b/src/mixedbread/types/scored_image_url_input_chunk.py index c142e5c4..5c41db69 100644 --- a/src/mixedbread/types/scored_image_url_input_chunk.py +++ b/src/mixedbread/types/scored_image_url_input_chunk.py @@ -18,6 +18,7 @@ "GeneratedMetadataPdfChunkGeneratedMetadata", "GeneratedMetadataCodeChunkGeneratedMetadata", "GeneratedMetadataAudioChunkGeneratedMetadata", + "GeneratedMetadataVideoChunkGeneratedMetadata", "ImageURL", ] @@ -53,6 +54,8 @@ class GeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel): num_lines: Optional[int] = None + frontmatter: Optional[Dict[str, object]] = None + if TYPE_CHECKING: # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a # value to this field, so for compatibility we avoid doing it at runtime. @@ -172,6 +175,36 @@ def __getattr__(self, attr: str) -> object: ... __pydantic_extra__: Dict[str, object] +class GeneratedMetadataVideoChunkGeneratedMetadata(BaseModel): + type: Optional[Literal["video"]] = None + + file_type: str + + file_size: int + + total_duration_seconds: float + + fps: float + + width: int + + height: int + + frame_count: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + GeneratedMetadata: TypeAlias = Annotated[ Union[ GeneratedMetadataMarkdownChunkGeneratedMetadata, @@ -179,6 +212,7 @@ def __getattr__(self, attr: str) -> object: ... GeneratedMetadataPdfChunkGeneratedMetadata, GeneratedMetadataCodeChunkGeneratedMetadata, GeneratedMetadataAudioChunkGeneratedMetadata, + GeneratedMetadataVideoChunkGeneratedMetadata, None, ], PropertyInfo(discriminator="type"), @@ -186,7 +220,7 @@ def __getattr__(self, attr: str) -> object: ... class ImageURL(BaseModel): - """The image input specification.""" + """Model for image URL validation.""" url: str """The image URL. Can be either a URL or a Data URI.""" @@ -232,5 +266,5 @@ class ScoredImageURLInputChunk(BaseModel): summary: Optional[str] = None """summary of the image""" - image_url: ImageURL - """The image input specification.""" + image_url: Optional[ImageURL] = None + """Model for image URL validation.""" diff --git a/src/mixedbread/types/scored_text_input_chunk.py b/src/mixedbread/types/scored_text_input_chunk.py index 2eeddb07..025eecdc 100644 --- a/src/mixedbread/types/scored_text_input_chunk.py +++ b/src/mixedbread/types/scored_text_input_chunk.py @@ -18,6 +18,7 @@ "GeneratedMetadataPdfChunkGeneratedMetadata", "GeneratedMetadataCodeChunkGeneratedMetadata", "GeneratedMetadataAudioChunkGeneratedMetadata", + "GeneratedMetadataVideoChunkGeneratedMetadata", ] @@ -52,6 +53,8 @@ class GeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel): num_lines: Optional[int] = None + frontmatter: Optional[Dict[str, object]] = None + if TYPE_CHECKING: # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a # value to this field, so for compatibility we avoid doing it at runtime. @@ -171,6 +174,36 @@ def __getattr__(self, attr: str) -> object: ... __pydantic_extra__: Dict[str, object] +class GeneratedMetadataVideoChunkGeneratedMetadata(BaseModel): + type: Optional[Literal["video"]] = None + + file_type: str + + file_size: int + + total_duration_seconds: float + + fps: float + + width: int + + height: int + + frame_count: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + GeneratedMetadata: TypeAlias = Annotated[ Union[ GeneratedMetadataMarkdownChunkGeneratedMetadata, @@ -178,6 +211,7 @@ def __getattr__(self, attr: str) -> object: ... GeneratedMetadataPdfChunkGeneratedMetadata, GeneratedMetadataCodeChunkGeneratedMetadata, GeneratedMetadataAudioChunkGeneratedMetadata, + GeneratedMetadataVideoChunkGeneratedMetadata, None, ], PropertyInfo(discriminator="type"), @@ -218,5 +252,5 @@ class ScoredTextInputChunk(BaseModel): offset: Optional[int] = None """The offset of the text in the file relative to the start of the file.""" - text: str - """Text content to process""" + text: Optional[str] = None + """Text content""" diff --git a/src/mixedbread/types/scored_video_url_input_chunk.py b/src/mixedbread/types/scored_video_url_input_chunk.py index 388c87ce..878c5bdf 100644 --- a/src/mixedbread/types/scored_video_url_input_chunk.py +++ b/src/mixedbread/types/scored_video_url_input_chunk.py @@ -18,6 +18,7 @@ "GeneratedMetadataPdfChunkGeneratedMetadata", "GeneratedMetadataCodeChunkGeneratedMetadata", "GeneratedMetadataAudioChunkGeneratedMetadata", + "GeneratedMetadataVideoChunkGeneratedMetadata", "VideoURL", ] @@ -53,6 +54,8 @@ class GeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel): num_lines: Optional[int] = None + frontmatter: Optional[Dict[str, object]] = None + if TYPE_CHECKING: # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a # value to this field, so for compatibility we avoid doing it at runtime. @@ -172,6 +175,36 @@ def __getattr__(self, attr: str) -> object: ... __pydantic_extra__: Dict[str, object] +class GeneratedMetadataVideoChunkGeneratedMetadata(BaseModel): + type: Optional[Literal["video"]] = None + + file_type: str + + file_size: int + + total_duration_seconds: float + + fps: float + + width: int + + height: int + + frame_count: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + GeneratedMetadata: TypeAlias = Annotated[ Union[ GeneratedMetadataMarkdownChunkGeneratedMetadata, @@ -179,6 +212,7 @@ def __getattr__(self, attr: str) -> object: ... GeneratedMetadataPdfChunkGeneratedMetadata, GeneratedMetadataCodeChunkGeneratedMetadata, GeneratedMetadataAudioChunkGeneratedMetadata, + GeneratedMetadataVideoChunkGeneratedMetadata, None, ], PropertyInfo(discriminator="type"), @@ -186,7 +220,7 @@ def __getattr__(self, attr: str) -> object: ... class VideoURL(BaseModel): - """The video input specification.""" + """Model for video URL validation.""" url: str """The video URL. Can be either a URL or a Data URI.""" @@ -229,5 +263,5 @@ class ScoredVideoURLInputChunk(BaseModel): summary: Optional[str] = None """summary of the video""" - video_url: VideoURL - """The video input specification.""" + video_url: Optional[VideoURL] = None + """Model for video URL validation.""" diff --git a/src/mixedbread/types/store.py b/src/mixedbread/types/store.py index 03c809d4..83de8954 100644 --- a/src/mixedbread/types/store.py +++ b/src/mixedbread/types/store.py @@ -29,6 +29,14 @@ class Config(BaseModel): contextualization: Optional[ConfigContextualization] = None """Contextualize files with metadata""" + save_content: Optional[bool] = None + """Whether to save original content in the store. + + When False, only vectors are indexed without the original content (index-only + mode). This is useful for data privacy. Note: Reranking is not supported when + content is not saved. + """ + class FileCounts(BaseModel): """Counts of files in different states""" diff --git a/src/mixedbread/types/store_chunk_search_options_param.py b/src/mixedbread/types/store_chunk_search_options_param.py index 773251c4..12e5f590 100644 --- a/src/mixedbread/types/store_chunk_search_options_param.py +++ b/src/mixedbread/types/store_chunk_search_options_param.py @@ -5,11 +5,28 @@ from typing import Union, Optional from typing_extensions import TypeAlias, TypedDict -from .vector_stores.rerank_config_param import RerankConfigParam +from .._types import SequenceNotStr -__all__ = ["StoreChunkSearchOptionsParam", "Rerank", "Agentic", "AgenticAgenticSearchConfig"] +__all__ = ["StoreChunkSearchOptionsParam", "Rerank", "RerankRerankConfig", "Agentic", "AgenticAgenticSearchConfig"] -Rerank: TypeAlias = Union[bool, RerankConfigParam] + +class RerankRerankConfig(TypedDict, total=False): + """Represents a reranking configuration.""" + + model: str + """The name of the reranking model""" + + with_metadata: Union[bool, SequenceNotStr[str]] + """Whether to include metadata in the reranked results""" + + top_k: Optional[int] + """Maximum number of results to return after reranking. + + If None, returns all reranked results. + """ + + +Rerank: TypeAlias = Union[bool, RerankRerankConfig] class AgenticAgenticSearchConfig(TypedDict, total=False): diff --git a/src/mixedbread/types/store_create_params.py b/src/mixedbread/types/store_create_params.py index 0edfa42b..b7814cdd 100644 --- a/src/mixedbread/types/store_create_params.py +++ b/src/mixedbread/types/store_create_params.py @@ -55,3 +55,11 @@ class Config(TypedDict, total=False): contextualization: ConfigContextualization """Contextualize files with metadata""" + + save_content: bool + """Whether to save original content in the store. + + When False, only vectors are indexed without the original content (index-only + mode). This is useful for data privacy. Note: Reranking is not supported when + content is not saved. + """ diff --git a/src/mixedbread/types/store_search_params.py b/src/mixedbread/types/store_search_params.py index 1bff13de..7a526d7d 100644 --- a/src/mixedbread/types/store_search_params.py +++ b/src/mixedbread/types/store_search_params.py @@ -6,14 +6,16 @@ from typing_extensions import Required, TypeAlias, TypedDict from .._types import SequenceNotStr +from .extractions.text_input_param import TextInputParam from .store_chunk_search_options_param import StoreChunkSearchOptionsParam +from .extractions.image_url_input_param import ImageURLInputParam from .shared_params.search_filter_condition import SearchFilterCondition -__all__ = ["StoreSearchParams", "Filters", "FiltersUnionMember2"] +__all__ = ["StoreSearchParams", "Query", "Filters", "FiltersUnionMember2"] class StoreSearchParams(TypedDict, total=False): - query: Required[str] + query: Required[Query] """Search query text""" store_identifiers: Required[SequenceNotStr[str]] @@ -32,6 +34,8 @@ class StoreSearchParams(TypedDict, total=False): """Search configuration options""" +Query: TypeAlias = Union[str, ImageURLInputParam, TextInputParam] + FiltersUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] Filters: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[FiltersUnionMember2]] diff --git a/src/mixedbread/types/stores/file_search_params.py b/src/mixedbread/types/stores/file_search_params.py index 99f27a59..e70bc15b 100644 --- a/src/mixedbread/types/stores/file_search_params.py +++ b/src/mixedbread/types/stores/file_search_params.py @@ -6,22 +6,25 @@ from typing_extensions import Required, TypeAlias, TypedDict from ..._types import SequenceNotStr -from ..vector_stores.rerank_config_param import RerankConfigParam +from ..extractions.text_input_param import TextInputParam +from ..extractions.image_url_input_param import ImageURLInputParam from ..shared_params.search_filter_condition import SearchFilterCondition __all__ = [ "FileSearchParams", + "Query", "Filters", "FiltersUnionMember2", "SearchOptions", "SearchOptionsRerank", + "SearchOptionsRerankRerankConfig", "SearchOptionsAgentic", "SearchOptionsAgenticAgenticSearchConfig", ] class FileSearchParams(TypedDict, total=False): - query: Required[str] + query: Required[Query] """Search query text""" store_identifiers: Required[SequenceNotStr[str]] @@ -40,11 +43,30 @@ class FileSearchParams(TypedDict, total=False): """Search configuration options""" +Query: TypeAlias = Union[str, ImageURLInputParam, TextInputParam] + FiltersUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] Filters: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[FiltersUnionMember2]] -SearchOptionsRerank: TypeAlias = Union[bool, RerankConfigParam] + +class SearchOptionsRerankRerankConfig(TypedDict, total=False): + """Represents a reranking configuration.""" + + model: str + """The name of the reranking model""" + + with_metadata: Union[bool, SequenceNotStr[str]] + """Whether to include metadata in the reranked results""" + + top_k: Optional[int] + """Maximum number of results to return after reranking. + + If None, returns all reranked results. + """ + + +SearchOptionsRerank: TypeAlias = Union[bool, SearchOptionsRerankRerankConfig] class SearchOptionsAgenticAgenticSearchConfig(TypedDict, total=False): diff --git a/src/mixedbread/types/stores/store_file.py b/src/mixedbread/types/stores/store_file.py index 133f054e..7c3c0e2e 100644 --- a/src/mixedbread/types/stores/store_file.py +++ b/src/mixedbread/types/stores/store_file.py @@ -23,6 +23,7 @@ "ChunkTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", "ChunkTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", "ChunkTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", + "ChunkTextInputChunkGeneratedMetadataVideoChunkGeneratedMetadata", "ChunkImageURLInputChunk", "ChunkImageURLInputChunkGeneratedMetadata", "ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", @@ -32,6 +33,7 @@ "ChunkImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", "ChunkImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", "ChunkImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", + "ChunkImageURLInputChunkGeneratedMetadataVideoChunkGeneratedMetadata", "ChunkImageURLInputChunkImageURL", "ChunkAudioURLInputChunk", "ChunkAudioURLInputChunkGeneratedMetadata", @@ -42,6 +44,7 @@ "ChunkAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", "ChunkAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", "ChunkAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", + "ChunkAudioURLInputChunkGeneratedMetadataVideoChunkGeneratedMetadata", "ChunkAudioURLInputChunkAudioURL", "ChunkVideoURLInputChunk", "ChunkVideoURLInputChunkGeneratedMetadata", @@ -52,6 +55,7 @@ "ChunkVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", "ChunkVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", "ChunkVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", + "ChunkVideoURLInputChunkGeneratedMetadataVideoChunkGeneratedMetadata", "ChunkVideoURLInputChunkVideoURL", ] @@ -98,6 +102,8 @@ class ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata(BaseMod num_lines: Optional[int] = None + frontmatter: Optional[Dict[str, object]] = None + if TYPE_CHECKING: # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a # value to this field, so for compatibility we avoid doing it at runtime. @@ -217,6 +223,36 @@ def __getattr__(self, attr: str) -> object: ... __pydantic_extra__: Dict[str, object] +class ChunkTextInputChunkGeneratedMetadataVideoChunkGeneratedMetadata(BaseModel): + type: Optional[Literal["video"]] = None + + file_type: str + + file_size: int + + total_duration_seconds: float + + fps: float + + width: int + + height: int + + frame_count: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + ChunkTextInputChunkGeneratedMetadata: TypeAlias = Annotated[ Union[ ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, @@ -224,6 +260,7 @@ def __getattr__(self, attr: str) -> object: ... ChunkTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, ChunkTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, ChunkTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, + ChunkTextInputChunkGeneratedMetadataVideoChunkGeneratedMetadata, None, ], PropertyInfo(discriminator="type"), @@ -249,8 +286,8 @@ class ChunkTextInputChunk(BaseModel): offset: Optional[int] = None """The offset of the text in the file relative to the start of the file.""" - text: str - """Text content to process""" + text: Optional[str] = None + """Text content""" class ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading(BaseModel): @@ -288,6 +325,8 @@ class ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata(Bas num_lines: Optional[int] = None + frontmatter: Optional[Dict[str, object]] = None + if TYPE_CHECKING: # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a # value to this field, so for compatibility we avoid doing it at runtime. @@ -407,6 +446,36 @@ def __getattr__(self, attr: str) -> object: ... __pydantic_extra__: Dict[str, object] +class ChunkImageURLInputChunkGeneratedMetadataVideoChunkGeneratedMetadata(BaseModel): + type: Optional[Literal["video"]] = None + + file_type: str + + file_size: int + + total_duration_seconds: float + + fps: float + + width: int + + height: int + + frame_count: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + ChunkImageURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ Union[ ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, @@ -414,6 +483,7 @@ def __getattr__(self, attr: str) -> object: ... ChunkImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, ChunkImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, ChunkImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, + ChunkImageURLInputChunkGeneratedMetadataVideoChunkGeneratedMetadata, None, ], PropertyInfo(discriminator="type"), @@ -421,7 +491,7 @@ def __getattr__(self, attr: str) -> object: ... class ChunkImageURLInputChunkImageURL(BaseModel): - """The image input specification.""" + """Model for image URL validation.""" url: str """The image URL. Can be either a URL or a Data URI.""" @@ -452,8 +522,8 @@ class ChunkImageURLInputChunk(BaseModel): summary: Optional[str] = None """summary of the image""" - image_url: ChunkImageURLInputChunkImageURL - """The image input specification.""" + image_url: Optional[ChunkImageURLInputChunkImageURL] = None + """Model for image URL validation.""" class ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading(BaseModel): @@ -491,6 +561,8 @@ class ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata(Bas num_lines: Optional[int] = None + frontmatter: Optional[Dict[str, object]] = None + if TYPE_CHECKING: # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a # value to this field, so for compatibility we avoid doing it at runtime. @@ -610,6 +682,36 @@ def __getattr__(self, attr: str) -> object: ... __pydantic_extra__: Dict[str, object] +class ChunkAudioURLInputChunkGeneratedMetadataVideoChunkGeneratedMetadata(BaseModel): + type: Optional[Literal["video"]] = None + + file_type: str + + file_size: int + + total_duration_seconds: float + + fps: float + + width: int + + height: int + + frame_count: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + ChunkAudioURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ Union[ ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, @@ -617,6 +719,7 @@ def __getattr__(self, attr: str) -> object: ... ChunkAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, ChunkAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, ChunkAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, + ChunkAudioURLInputChunkGeneratedMetadataVideoChunkGeneratedMetadata, None, ], PropertyInfo(discriminator="type"), @@ -624,7 +727,7 @@ def __getattr__(self, attr: str) -> object: ... class ChunkAudioURLInputChunkAudioURL(BaseModel): - """The audio input specification.""" + """Model for audio URL validation.""" url: str """The audio URL. Can be either a URL or a Data URI.""" @@ -652,8 +755,8 @@ class ChunkAudioURLInputChunk(BaseModel): summary: Optional[str] = None """summary of the audio""" - audio_url: ChunkAudioURLInputChunkAudioURL - """The audio input specification.""" + audio_url: Optional[ChunkAudioURLInputChunkAudioURL] = None + """Model for audio URL validation.""" sampling_rate: int """The sampling rate of the audio.""" @@ -694,6 +797,8 @@ class ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata(Bas num_lines: Optional[int] = None + frontmatter: Optional[Dict[str, object]] = None + if TYPE_CHECKING: # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a # value to this field, so for compatibility we avoid doing it at runtime. @@ -813,6 +918,36 @@ def __getattr__(self, attr: str) -> object: ... __pydantic_extra__: Dict[str, object] +class ChunkVideoURLInputChunkGeneratedMetadataVideoChunkGeneratedMetadata(BaseModel): + type: Optional[Literal["video"]] = None + + file_type: str + + file_size: int + + total_duration_seconds: float + + fps: float + + width: int + + height: int + + frame_count: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + ChunkVideoURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ Union[ ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, @@ -820,6 +955,7 @@ def __getattr__(self, attr: str) -> object: ... ChunkVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, ChunkVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, ChunkVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, + ChunkVideoURLInputChunkGeneratedMetadataVideoChunkGeneratedMetadata, None, ], PropertyInfo(discriminator="type"), @@ -827,7 +963,7 @@ def __getattr__(self, attr: str) -> object: ... class ChunkVideoURLInputChunkVideoURL(BaseModel): - """The video input specification.""" + """Model for video URL validation.""" url: str """The video URL. Can be either a URL or a Data URI.""" @@ -855,8 +991,8 @@ class ChunkVideoURLInputChunk(BaseModel): summary: Optional[str] = None """summary of the video""" - video_url: ChunkVideoURLInputChunkVideoURL - """The video input specification.""" + video_url: Optional[ChunkVideoURLInputChunkVideoURL] = None + """Model for video URL validation.""" Chunk: TypeAlias = Annotated[ diff --git a/src/mixedbread/types/vector_store.py b/src/mixedbread/types/vector_store.py deleted file mode 100644 index d24802cb..00000000 --- a/src/mixedbread/types/vector_store.py +++ /dev/null @@ -1,78 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel -from .expires_after import ExpiresAfter - -__all__ = ["VectorStore", "FileCounts"] - - -class FileCounts(BaseModel): - """Counts of files in different states""" - - pending: Optional[int] = None - """Number of files waiting to be processed""" - - in_progress: Optional[int] = None - """Number of files currently being processed""" - - cancelled: Optional[int] = None - """Number of files whose processing was cancelled""" - - completed: Optional[int] = None - """Number of successfully processed files""" - - failed: Optional[int] = None - """Number of files that failed processing""" - - total: Optional[int] = None - """Total number of files""" - - -class VectorStore(BaseModel): - """Model representing a vector store with its metadata and timestamps.""" - - id: str - """Unique identifier for the vector store""" - - name: str - """Name of the vector store""" - - description: Optional[str] = None - """Detailed description of the vector store's purpose and contents""" - - is_public: Optional[bool] = None - """Whether the vector store can be accessed by anyone with valid login credentials""" - - metadata: Optional[object] = None - """Additional metadata associated with the vector store""" - - file_counts: Optional[FileCounts] = None - """Counts of files in different states""" - - expires_after: Optional[ExpiresAfter] = None - """Represents an expiration policy for a store.""" - - status: Optional[Literal["expired", "in_progress", "completed"]] = None - """Processing status of the vector store""" - - created_at: datetime - """Timestamp when the vector store was created""" - - updated_at: datetime - """Timestamp when the vector store was last updated""" - - last_active_at: Optional[datetime] = None - """Timestamp when the vector store was last used""" - - usage_bytes: Optional[int] = None - """Total storage usage in bytes""" - - expires_at: Optional[datetime] = None - """Optional expiration timestamp for the vector store""" - - object: Optional[Literal["vector_store"]] = None - """Type of the object""" diff --git a/src/mixedbread/types/vector_store_chunk_search_options_param.py b/src/mixedbread/types/vector_store_chunk_search_options_param.py deleted file mode 100644 index b2b2f185..00000000 --- a/src/mixedbread/types/vector_store_chunk_search_options_param.py +++ /dev/null @@ -1,59 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Optional -from typing_extensions import TypeAlias, TypedDict - -from .vector_stores.rerank_config_param import RerankConfigParam - -__all__ = ["VectorStoreChunkSearchOptionsParam", "Rerank", "Agentic", "AgenticAgenticSearchConfig"] - -Rerank: TypeAlias = Union[bool, RerankConfigParam] - - -class AgenticAgenticSearchConfig(TypedDict, total=False): - """Configuration for agentic multi-query search.""" - - max_rounds: int - """Maximum number of search rounds""" - - queries_per_round: int - """Maximum queries per round""" - - results_per_query: int - """Results to fetch per query""" - - -Agentic: TypeAlias = Union[bool, AgenticAgenticSearchConfig] - - -class VectorStoreChunkSearchOptionsParam(TypedDict, total=False): - """Options for configuring vector store chunk searches.""" - - score_threshold: float - """Minimum similarity score threshold""" - - rewrite_query: bool - """Whether to rewrite the query. - - Ignored when agentic is enabled (the agent handles query decomposition). - """ - - rerank: Optional[Rerank] - """Whether to rerank results and optional reranking configuration. - - Ignored when agentic is enabled (the agent handles ranking). - """ - - agentic: Optional[Agentic] - """ - Whether to use agentic multi-query search with automatic query decomposition and - ranking. When enabled, rewrite_query and rerank options are ignored. - """ - - return_metadata: bool - """Whether to return file metadata""" - - apply_search_rules: bool - """Whether to apply search rules""" diff --git a/src/mixedbread/types/vector_store_create_params.py b/src/mixedbread/types/vector_store_create_params.py deleted file mode 100644 index 713342a5..00000000 --- a/src/mixedbread/types/vector_store_create_params.py +++ /dev/null @@ -1,31 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import TypedDict - -from .._types import SequenceNotStr -from .expires_after_param import ExpiresAfterParam - -__all__ = ["VectorStoreCreateParams"] - - -class VectorStoreCreateParams(TypedDict, total=False): - name: Optional[str] - """Name for the new vector store""" - - description: Optional[str] - """Description of the vector store""" - - is_public: bool - """Whether the vector store can be accessed by anyone with valid login credentials""" - - expires_after: Optional[ExpiresAfterParam] - """Represents an expiration policy for a store.""" - - metadata: object - """Optional metadata key-value pairs""" - - file_ids: Optional[SequenceNotStr[str]] - """Optional list of file IDs""" diff --git a/src/mixedbread/types/vector_store_delete_response.py b/src/mixedbread/types/vector_store_delete_response.py deleted file mode 100644 index 27af8ee3..00000000 --- a/src/mixedbread/types/vector_store_delete_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["VectorStoreDeleteResponse"] - - -class VectorStoreDeleteResponse(BaseModel): - """Response model for vector store deletion.""" - - id: str - """ID of the deleted vector store""" - - deleted: bool - """Whether the deletion was successful""" - - object: Optional[Literal["vector_store"]] = None - """Type of the deleted object""" diff --git a/src/mixedbread/types/vector_store_list_params.py b/src/mixedbread/types/vector_store_list_params.py deleted file mode 100644 index cdad6947..00000000 --- a/src/mixedbread/types/vector_store_list_params.py +++ /dev/null @@ -1,31 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import TypedDict - -__all__ = ["VectorStoreListParams"] - - -class VectorStoreListParams(TypedDict, total=False): - limit: int - """Maximum number of items to return per page (1-100)""" - - after: Optional[str] - """Cursor for forward pagination - get items after this position. - - Use last_cursor from previous response. - """ - - before: Optional[str] - """Cursor for backward pagination - get items before this position. - - Use first_cursor from previous response. - """ - - include_total: bool - """Whether to include total count in response (expensive operation)""" - - q: Optional[str] - """Search query for fuzzy matching over name and description fields""" diff --git a/src/mixedbread/types/vector_store_question_answering_params.py b/src/mixedbread/types/vector_store_question_answering_params.py deleted file mode 100644 index 295a761b..00000000 --- a/src/mixedbread/types/vector_store_question_answering_params.py +++ /dev/null @@ -1,59 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Iterable, Optional -from typing_extensions import Required, TypeAlias, TypedDict - -from .._types import SequenceNotStr -from .shared_params.search_filter_condition import SearchFilterCondition -from .vector_store_chunk_search_options_param import VectorStoreChunkSearchOptionsParam - -__all__ = ["VectorStoreQuestionAnsweringParams", "Filters", "FiltersUnionMember2", "QaOptions"] - - -class VectorStoreQuestionAnsweringParams(TypedDict, total=False): - query: str - """Question to answer. - - If not provided, the question will be extracted from the passed messages. - """ - - vector_store_identifiers: Required[SequenceNotStr[str]] - """IDs or names of vector stores to search""" - - top_k: int - """Number of results to return""" - - filters: Optional[Filters] - """Optional filter conditions""" - - file_ids: Union[Iterable[object], SequenceNotStr[str], None] - """Optional list of file IDs to filter chunks by (inclusion filter)""" - - search_options: VectorStoreChunkSearchOptionsParam - """Search configuration options""" - - stream: bool - """Whether to stream the answer""" - - qa_options: QaOptions - """Question answering configuration options""" - - -FiltersUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] - -Filters: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[FiltersUnionMember2]] - - -class QaOptions(TypedDict, total=False): - """Question answering configuration options""" - - cite: bool - """Whether to use citations""" - - multimodal: bool - """Whether to use multimodal context""" - - -from .shared_params.search_filter import SearchFilter diff --git a/src/mixedbread/types/vector_store_question_answering_response.py b/src/mixedbread/types/vector_store_question_answering_response.py deleted file mode 100644 index 6aec7bbc..00000000 --- a/src/mixedbread/types/vector_store_question_answering_response.py +++ /dev/null @@ -1,1018 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import TYPE_CHECKING, Dict, List, Union, Optional -from typing_extensions import Literal, Annotated, TypeAlias - -from pydantic import Field as FieldInfo - -from .._utils import PropertyInfo -from .._models import BaseModel - -__all__ = [ - "VectorStoreQuestionAnsweringResponse", - "Source", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunk", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunk", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkImageURL", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunk", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkAudioURL", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunk", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkVideoURL", -] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunk(BaseModel): - """Scored text chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["text"]] = None - """Input type identifier""" - - offset: Optional[int] = None - """The offset of the text in the file relative to the start of the file.""" - - text: str - """Text content to process""" - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkImageURL(BaseModel): - """The image input specification.""" - - url: str - """The image URL. Can be either a URL or a Data URI.""" - - format: Optional[str] = None - """The image format/mimetype""" - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunk(BaseModel): - """Scored image chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["image_url"]] = None - """Input type identifier""" - - ocr_text: Optional[str] = None - """ocr text of the image""" - - summary: Optional[str] = None - """summary of the image""" - - image_url: SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkImageURL - """The image input specification.""" - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkAudioURL(BaseModel): - """The audio input specification.""" - - url: str - """The audio URL. Can be either a URL or a Data URI.""" - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunk(BaseModel): - """Scored audio chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["audio_url"]] = None - """Input type identifier""" - - transcription: Optional[str] = None - """speech recognition (sr) text of the audio""" - - summary: Optional[str] = None - """summary of the audio""" - - audio_url: SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkAudioURL - """The audio input specification.""" - - sampling_rate: int - """The sampling rate of the audio.""" - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkVideoURL(BaseModel): - """The video input specification.""" - - url: str - """The video URL. Can be either a URL or a Data URI.""" - - -class SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunk(BaseModel): - """Scored video chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["video_url"]] = None - """Input type identifier""" - - transcription: Optional[str] = None - """speech recognition (sr) text of the video""" - - summary: Optional[str] = None - """summary of the video""" - - video_url: SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkVideoURL - """The video input specification.""" - - -Source: TypeAlias = Annotated[ - Union[ - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunk, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunk, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunk, - SourceMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunk, - ], - PropertyInfo(discriminator="type"), -] - - -class VectorStoreQuestionAnsweringResponse(BaseModel): - """Results from a question answering operation.""" - - answer: str - """The answer generated by the LLM""" - - sources: Optional[List[Source]] = None - """Source documents used to generate the answer""" diff --git a/src/mixedbread/types/vector_store_search_params.py b/src/mixedbread/types/vector_store_search_params.py deleted file mode 100644 index f5258d95..00000000 --- a/src/mixedbread/types/vector_store_search_params.py +++ /dev/null @@ -1,39 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Iterable, Optional -from typing_extensions import Required, TypeAlias, TypedDict - -from .._types import SequenceNotStr -from .shared_params.search_filter_condition import SearchFilterCondition -from .vector_store_chunk_search_options_param import VectorStoreChunkSearchOptionsParam - -__all__ = ["VectorStoreSearchParams", "Filters", "FiltersUnionMember2"] - - -class VectorStoreSearchParams(TypedDict, total=False): - query: Required[str] - """Search query text""" - - vector_store_identifiers: Required[SequenceNotStr[str]] - """IDs or names of vector stores to search""" - - top_k: int - """Number of results to return""" - - filters: Optional[Filters] - """Optional filter conditions""" - - file_ids: Union[Iterable[object], SequenceNotStr[str], None] - """Optional list of file IDs to filter chunks by (inclusion filter)""" - - search_options: VectorStoreChunkSearchOptionsParam - """Search configuration options""" - - -FiltersUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] - -Filters: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[FiltersUnionMember2]] - -from .shared_params.search_filter import SearchFilter diff --git a/src/mixedbread/types/vector_store_search_response.py b/src/mixedbread/types/vector_store_search_response.py deleted file mode 100644 index 8e46feb8..00000000 --- a/src/mixedbread/types/vector_store_search_response.py +++ /dev/null @@ -1,1016 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import TYPE_CHECKING, Dict, List, Union, Optional -from typing_extensions import Literal, Annotated, TypeAlias - -from pydantic import Field as FieldInfo - -from .._utils import PropertyInfo -from .._models import BaseModel - -__all__ = [ - "VectorStoreSearchResponse", - "Data", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunk", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunk", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkImageURL", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunk", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkAudioURL", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunk", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkVideoURL", -] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunk(BaseModel): - """Scored text chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["text"]] = None - """Input type identifier""" - - offset: Optional[int] = None - """The offset of the text in the file relative to the start of the file.""" - - text: str - """Text content to process""" - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkImageURL(BaseModel): - """The image input specification.""" - - url: str - """The image URL. Can be either a URL or a Data URI.""" - - format: Optional[str] = None - """The image format/mimetype""" - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunk(BaseModel): - """Scored image chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["image_url"]] = None - """Input type identifier""" - - ocr_text: Optional[str] = None - """ocr text of the image""" - - summary: Optional[str] = None - """summary of the image""" - - image_url: DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkImageURL - """The image input specification.""" - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkAudioURL(BaseModel): - """The audio input specification.""" - - url: str - """The audio URL. Can be either a URL or a Data URI.""" - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunk(BaseModel): - """Scored audio chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["audio_url"]] = None - """Input type identifier""" - - transcription: Optional[str] = None - """speech recognition (sr) text of the audio""" - - summary: Optional[str] = None - """summary of the audio""" - - audio_url: DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkAudioURL - """The audio input specification.""" - - sampling_rate: int - """The sampling rate of the audio.""" - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkVideoURL(BaseModel): - """The video input specification.""" - - url: str - """The video URL. Can be either a URL or a Data URI.""" - - -class DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunk(BaseModel): - """Scored video chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["video_url"]] = None - """Input type identifier""" - - transcription: Optional[str] = None - """speech recognition (sr) text of the video""" - - summary: Optional[str] = None - """summary of the video""" - - video_url: DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkVideoURL - """The video input specification.""" - - -Data: TypeAlias = Annotated[ - Union[ - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunk, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunk, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunk, - DataMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunk, - ], - PropertyInfo(discriminator="type"), -] - - -class VectorStoreSearchResponse(BaseModel): - object: Optional[Literal["list"]] = None - """The object type of the response""" - - data: List[Data] - """The list of scored vector store file chunks""" diff --git a/src/mixedbread/types/vector_store_update_params.py b/src/mixedbread/types/vector_store_update_params.py deleted file mode 100644 index 22545d43..00000000 --- a/src/mixedbread/types/vector_store_update_params.py +++ /dev/null @@ -1,27 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import TypedDict - -from .expires_after_param import ExpiresAfterParam - -__all__ = ["VectorStoreUpdateParams"] - - -class VectorStoreUpdateParams(TypedDict, total=False): - name: Optional[str] - """New name for the store""" - - description: Optional[str] - """New description""" - - is_public: Optional[bool] - """Whether the vector store can be accessed by anyone with valid login credentials""" - - expires_after: Optional[ExpiresAfterParam] - """Represents an expiration policy for a store.""" - - metadata: object - """Optional metadata key-value pairs""" diff --git a/src/mixedbread/types/vector_stores/__init__.py b/src/mixedbread/types/vector_stores/__init__.py deleted file mode 100644 index dcfaa05b..00000000 --- a/src/mixedbread/types/vector_stores/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .file_list_params import FileListParams as FileListParams -from .vector_store_file import VectorStoreFile as VectorStoreFile -from .file_create_params import FileCreateParams as FileCreateParams -from .file_list_response import FileListResponse as FileListResponse -from .file_search_params import FileSearchParams as FileSearchParams -from .rerank_config_param import RerankConfigParam as RerankConfigParam -from .file_delete_response import FileDeleteResponse as FileDeleteResponse -from .file_retrieve_params import FileRetrieveParams as FileRetrieveParams -from .file_search_response import FileSearchResponse as FileSearchResponse -from .scored_vector_store_file import ScoredVectorStoreFile as ScoredVectorStoreFile -from .vector_store_file_status import VectorStoreFileStatus as VectorStoreFileStatus diff --git a/src/mixedbread/types/vector_stores/file_create_params.py b/src/mixedbread/types/vector_stores/file_create_params.py deleted file mode 100644 index c776ea33..00000000 --- a/src/mixedbread/types/vector_stores/file_create_params.py +++ /dev/null @@ -1,42 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Literal, Required, TypedDict - -__all__ = ["FileCreateParams", "Config", "Experimental"] - - -class FileCreateParams(TypedDict, total=False): - metadata: object - """Optional metadata for the file""" - - config: Config - """Configuration for adding the file""" - - external_id: Optional[str] - """External identifier for this file in the store""" - - overwrite: bool - """If true, overwrite an existing file with the same external_id""" - - file_id: Required[str] - """ID of the file to add""" - - experimental: Optional[Experimental] - """Configuration for a file.""" - - -class Config(TypedDict, total=False): - """Configuration for adding the file""" - - parsing_strategy: Literal["fast", "high_quality"] - """Strategy for adding the file, this overrides the store-level default""" - - -class Experimental(TypedDict, total=False): - """Configuration for a file.""" - - parsing_strategy: Literal["fast", "high_quality"] - """Strategy for adding the file, this overrides the store-level default""" diff --git a/src/mixedbread/types/vector_stores/file_delete_response.py b/src/mixedbread/types/vector_stores/file_delete_response.py deleted file mode 100644 index 191203c4..00000000 --- a/src/mixedbread/types/vector_stores/file_delete_response.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["FileDeleteResponse"] - - -class FileDeleteResponse(BaseModel): - """Response model for file deletion.""" - - id: str - """ID of the deleted file""" - - deleted: Optional[bool] = None - """Whether the deletion was successful""" - - object: Optional[Literal["vector_store.file"]] = None - """Type of the deleted object""" diff --git a/src/mixedbread/types/vector_stores/file_list_params.py b/src/mixedbread/types/vector_stores/file_list_params.py deleted file mode 100644 index ef2c2848..00000000 --- a/src/mixedbread/types/vector_stores/file_list_params.py +++ /dev/null @@ -1,44 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Iterable, Optional -from typing_extensions import TypeAlias, TypedDict - -from ..stores.store_file_status import StoreFileStatus -from ..shared_params.search_filter_condition import SearchFilterCondition - -__all__ = ["FileListParams", "MetadataFilter", "MetadataFilterUnionMember2"] - - -class FileListParams(TypedDict, total=False): - limit: int - """Maximum number of items to return per page (1-100)""" - - after: Optional[str] - """Cursor for forward pagination - get items after this position. - - Use last_cursor from previous response. - """ - - before: Optional[str] - """Cursor for backward pagination - get items before this position. - - Use first_cursor from previous response. - """ - - include_total: bool - """Whether to include total count in response (expensive operation)""" - - statuses: Optional[List[StoreFileStatus]] - """Status to filter by""" - - metadata_filter: Optional[MetadataFilter] - """Metadata filter to apply to the query""" - - -MetadataFilterUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] - -MetadataFilter: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[MetadataFilterUnionMember2]] - -from ..shared_params.search_filter import SearchFilter diff --git a/src/mixedbread/types/vector_stores/file_list_response.py b/src/mixedbread/types/vector_stores/file_list_response.py deleted file mode 100644 index 9b20d19f..00000000 --- a/src/mixedbread/types/vector_stores/file_list_response.py +++ /dev/null @@ -1,52 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel -from .vector_store_file import VectorStoreFile - -__all__ = ["FileListResponse", "Pagination"] - - -class Pagination(BaseModel): - """Response model for cursor-based pagination.""" - - has_more: bool - """ - Contextual direction-aware flag: True if more items exist in the requested - pagination direction. For 'after': more items after this page. For 'before': - more items before this page. - """ - - first_cursor: Optional[str] = None - """Cursor of the first item in this page. - - Use for backward pagination. None if page is empty. - """ - - last_cursor: Optional[str] = None - """Cursor of the last item in this page. - - Use for forward pagination. None if page is empty. - """ - - total: Optional[int] = None - """Total number of items available across all pages. - - Only included when include_total=true was requested. Expensive operation - use - sparingly. - """ - - -class FileListResponse(BaseModel): - """List response wrapper for vector store files.""" - - pagination: Pagination - """Response model for cursor-based pagination.""" - - object: Optional[Literal["list"]] = None - """The object type of the response""" - - data: List[VectorStoreFile] - """The list of vector store files""" diff --git a/src/mixedbread/types/vector_stores/file_retrieve_params.py b/src/mixedbread/types/vector_stores/file_retrieve_params.py deleted file mode 100644 index 0bbdedfc..00000000 --- a/src/mixedbread/types/vector_stores/file_retrieve_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["FileRetrieveParams"] - - -class FileRetrieveParams(TypedDict, total=False): - vector_store_identifier: Required[str] - """The ID or name of the vector store""" - - return_chunks: bool - """Whether to return the chunks for the file""" diff --git a/src/mixedbread/types/vector_stores/file_search_params.py b/src/mixedbread/types/vector_stores/file_search_params.py deleted file mode 100644 index 617a82f4..00000000 --- a/src/mixedbread/types/vector_stores/file_search_params.py +++ /dev/null @@ -1,103 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Iterable, Optional -from typing_extensions import Required, TypeAlias, TypedDict - -from ..._types import SequenceNotStr -from .rerank_config_param import RerankConfigParam -from ..shared_params.search_filter_condition import SearchFilterCondition - -__all__ = [ - "FileSearchParams", - "Filters", - "FiltersUnionMember2", - "SearchOptions", - "SearchOptionsRerank", - "SearchOptionsAgentic", - "SearchOptionsAgenticAgenticSearchConfig", -] - - -class FileSearchParams(TypedDict, total=False): - query: Required[str] - """Search query text""" - - vector_store_identifiers: Required[SequenceNotStr[str]] - """IDs or names of vector stores to search""" - - top_k: int - """Number of results to return""" - - filters: Optional[Filters] - """Optional filter conditions""" - - file_ids: Union[Iterable[object], SequenceNotStr[str], None] - """Optional list of file IDs to filter chunks by (inclusion filter)""" - - search_options: SearchOptions - """Search configuration options""" - - -FiltersUnionMember2: TypeAlias = Union["SearchFilter", SearchFilterCondition] - -Filters: TypeAlias = Union["SearchFilter", SearchFilterCondition, Iterable[FiltersUnionMember2]] - -SearchOptionsRerank: TypeAlias = Union[bool, RerankConfigParam] - - -class SearchOptionsAgenticAgenticSearchConfig(TypedDict, total=False): - """Configuration for agentic multi-query search.""" - - max_rounds: int - """Maximum number of search rounds""" - - queries_per_round: int - """Maximum queries per round""" - - results_per_query: int - """Results to fetch per query""" - - -SearchOptionsAgentic: TypeAlias = Union[bool, SearchOptionsAgenticAgenticSearchConfig] - - -class SearchOptions(TypedDict, total=False): - """Search configuration options""" - - score_threshold: float - """Minimum similarity score threshold""" - - rewrite_query: bool - """Whether to rewrite the query. - - Ignored when agentic is enabled (the agent handles query decomposition). - """ - - rerank: Optional[SearchOptionsRerank] - """Whether to rerank results and optional reranking configuration. - - Ignored when agentic is enabled (the agent handles ranking). - """ - - agentic: Optional[SearchOptionsAgentic] - """ - Whether to use agentic multi-query search with automatic query decomposition and - ranking. When enabled, rewrite_query and rerank options are ignored. - """ - - return_metadata: bool - """Whether to return file metadata""" - - return_chunks: bool - """Whether to return matching text chunks""" - - chunks_per_file: int - """Number of chunks to return for each file""" - - apply_search_rules: bool - """Whether to apply search rules""" - - -from ..shared_params.search_filter import SearchFilter diff --git a/src/mixedbread/types/vector_stores/file_search_response.py b/src/mixedbread/types/vector_stores/file_search_response.py deleted file mode 100644 index 04e14d9b..00000000 --- a/src/mixedbread/types/vector_stores/file_search_response.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel -from .scored_vector_store_file import ScoredVectorStoreFile - -__all__ = ["FileSearchResponse"] - - -class FileSearchResponse(BaseModel): - """Search response wrapper for vector store files.""" - - object: Optional[Literal["list"]] = None - """The object type of the response""" - - data: List[ScoredVectorStoreFile] - """The list of scored vector store files""" diff --git a/src/mixedbread/types/vector_stores/rerank_config_param.py b/src/mixedbread/types/vector_stores/rerank_config_param.py deleted file mode 100644 index 392bc60a..00000000 --- a/src/mixedbread/types/vector_stores/rerank_config_param.py +++ /dev/null @@ -1,26 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Optional -from typing_extensions import TypedDict - -from ..._types import SequenceNotStr - -__all__ = ["RerankConfigParam"] - - -class RerankConfigParam(TypedDict, total=False): - """Represents a reranking configuration.""" - - model: str - """The name of the reranking model""" - - with_metadata: Union[bool, SequenceNotStr[str]] - """Whether to include metadata in the reranked results""" - - top_k: Optional[int] - """Maximum number of results to return after reranking. - - If None, returns all reranked results. - """ diff --git a/src/mixedbread/types/vector_stores/scored_vector_store_file.py b/src/mixedbread/types/vector_stores/scored_vector_store_file.py deleted file mode 100644 index bc42fc2c..00000000 --- a/src/mixedbread/types/vector_stores/scored_vector_store_file.py +++ /dev/null @@ -1,1050 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import TYPE_CHECKING, Dict, List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, Annotated, TypeAlias - -from pydantic import Field as FieldInfo - -from ..._utils import PropertyInfo -from ..._models import BaseModel -from ..stores.store_file_status import StoreFileStatus - -__all__ = [ - "ScoredVectorStoreFile", - "Chunk", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunk", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunk", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkImageURL", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunk", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkAudioURL", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunk", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkVideoURL", -] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunk(BaseModel): - """Scored text chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["text"]] = None - """Input type identifier""" - - offset: Optional[int] = None - """The offset of the text in the file relative to the start of the file.""" - - text: str - """Text content to process""" - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkImageURL(BaseModel): - """The image input specification.""" - - url: str - """The image URL. Can be either a URL or a Data URI.""" - - format: Optional[str] = None - """The image format/mimetype""" - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunk(BaseModel): - """Scored image chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["image_url"]] = None - """Input type identifier""" - - ocr_text: Optional[str] = None - """ocr text of the image""" - - summary: Optional[str] = None - """summary of the image""" - - image_url: ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunkImageURL - """The image input specification.""" - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkAudioURL(BaseModel): - """The audio input specification.""" - - url: str - """The audio URL. Can be either a URL or a Data URI.""" - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunk(BaseModel): - """Scored audio chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["audio_url"]] = None - """Input type identifier""" - - transcription: Optional[str] = None - """speech recognition (sr) text of the audio""" - - summary: Optional[str] = None - """summary of the audio""" - - audio_url: ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunkAudioURL - """The audio input specification.""" - - sampling_rate: int - """The sampling rate of the audio.""" - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading( - BaseModel -): - level: int - - text: str - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext( - BaseModel -): - level: int - - text: str - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading - ] - ] = None - - heading_context: Optional[ - List[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext - ] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata( - BaseModel -): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkVideoURL(BaseModel): - """The video input specification.""" - - url: str - """The video URL. Can be either a URL or a Data URI.""" - - -class ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunk(BaseModel): - """Scored video chunk for deprecated API.""" - - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkGeneratedMetadata - ] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - score: float - """score of the chunk""" - - file_id: str - """file id""" - - filename: str - """filename""" - - vector_store_id: str - """store id""" - - metadata: Optional[object] = None - """file metadata""" - - type: Optional[Literal["video_url"]] = None - """Input type identifier""" - - transcription: Optional[str] = None - """speech recognition (sr) text of the video""" - - summary: Optional[str] = None - """summary of the video""" - - video_url: ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunkVideoURL - """The video input specification.""" - - -Chunk: TypeAlias = Annotated[ - Union[ - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredTextInputChunk, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredImageURLInputChunk, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredAudioURLInputChunk, - ChunkMxbaiOmniAPIRoutesV1DeprecatedVectorStoresModelsScoredVideoURLInputChunk, - ], - PropertyInfo(discriminator="type"), -] - - -class ScoredVectorStoreFile(BaseModel): - """Represents a scored store file.""" - - id: str - """Unique identifier for the file""" - - filename: Optional[str] = None - """Name of the file""" - - metadata: Optional[object] = None - """Optional file metadata""" - - status: Optional[StoreFileStatus] = None - """Processing status of the file""" - - last_error: Optional[object] = None - """Last error message if processing failed""" - - vector_store_id: str - """ID of the containing store""" - - created_at: datetime - """Timestamp of store file creation""" - - version: Optional[int] = None - """Version number of the file""" - - usage_bytes: Optional[int] = None - """Storage usage in bytes""" - - object: Optional[Literal["vector_store.file"]] = None - """Type of the object""" - - chunks: Optional[List[Chunk]] = None - """Array of scored file chunks""" - - score: float - """score of the file""" diff --git a/src/mixedbread/types/vector_stores/vector_store_file.py b/src/mixedbread/types/vector_stores/vector_store_file.py deleted file mode 100644 index 51bb8fa3..00000000 --- a/src/mixedbread/types/vector_stores/vector_store_file.py +++ /dev/null @@ -1,894 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import TYPE_CHECKING, Dict, List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, Annotated, TypeAlias - -from pydantic import Field as FieldInfo - -from ..._utils import PropertyInfo -from ..._models import BaseModel -from ..stores.store_file_status import StoreFileStatus - -__all__ = [ - "VectorStoreFile", - "Chunk", - "ChunkTextInputChunk", - "ChunkTextInputChunkGeneratedMetadata", - "ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "ChunkTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "ChunkTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "ChunkTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "ChunkTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "ChunkImageURLInputChunk", - "ChunkImageURLInputChunkGeneratedMetadata", - "ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "ChunkImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "ChunkImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "ChunkImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "ChunkImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "ChunkImageURLInputChunkImageURL", - "ChunkAudioURLInputChunk", - "ChunkAudioURLInputChunkGeneratedMetadata", - "ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "ChunkAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "ChunkAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "ChunkAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "ChunkAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "ChunkAudioURLInputChunkAudioURL", - "ChunkVideoURLInputChunk", - "ChunkVideoURLInputChunkGeneratedMetadata", - "ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata", - "ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading", - "ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext", - "ChunkVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata", - "ChunkVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata", - "ChunkVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata", - "ChunkVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata", - "ChunkVideoURLInputChunkVideoURL", -] - - -class ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading(BaseModel): - level: int - - text: str - - -class ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext(BaseModel): - level: int - - text: str - - -class ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[List[ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading]] = ( - None - ) - - heading_context: Optional[ - List[ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -ChunkTextInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - ChunkTextInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - ChunkTextInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - ChunkTextInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - ChunkTextInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - ChunkTextInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class ChunkTextInputChunk(BaseModel): - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ChunkTextInputChunkGeneratedMetadata] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - type: Optional[Literal["text"]] = None - """Input type identifier""" - - offset: Optional[int] = None - """The offset of the text in the file relative to the start of the file.""" - - text: str - """Text content to process""" - - -class ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading(BaseModel): - level: int - - text: str - - -class ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext(BaseModel): - level: int - - text: str - - -class ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading] - ] = None - - heading_context: Optional[ - List[ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -ChunkImageURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - ChunkImageURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - ChunkImageURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - ChunkImageURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - ChunkImageURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - ChunkImageURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class ChunkImageURLInputChunkImageURL(BaseModel): - """The image input specification.""" - - url: str - """The image URL. Can be either a URL or a Data URI.""" - - format: Optional[str] = None - """The image format/mimetype""" - - -class ChunkImageURLInputChunk(BaseModel): - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ChunkImageURLInputChunkGeneratedMetadata] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - type: Optional[Literal["image_url"]] = None - """Input type identifier""" - - ocr_text: Optional[str] = None - """ocr text of the image""" - - summary: Optional[str] = None - """summary of the image""" - - image_url: ChunkImageURLInputChunkImageURL - """The image input specification.""" - - -class ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading(BaseModel): - level: int - - text: str - - -class ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext(BaseModel): - level: int - - text: str - - -class ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading] - ] = None - - heading_context: Optional[ - List[ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -ChunkAudioURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - ChunkAudioURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - ChunkAudioURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - ChunkAudioURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - ChunkAudioURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - ChunkAudioURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class ChunkAudioURLInputChunkAudioURL(BaseModel): - """The audio input specification.""" - - url: str - """The audio URL. Can be either a URL or a Data URI.""" - - -class ChunkAudioURLInputChunk(BaseModel): - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ChunkAudioURLInputChunkGeneratedMetadata] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - type: Optional[Literal["audio_url"]] = None - """Input type identifier""" - - transcription: Optional[str] = None - """speech recognition (sr) text of the audio""" - - summary: Optional[str] = None - """summary of the audio""" - - audio_url: ChunkAudioURLInputChunkAudioURL - """The audio input specification.""" - - sampling_rate: int - """The sampling rate of the audio.""" - - -class ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading(BaseModel): - level: int - - text: str - - -class ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext(BaseModel): - level: int - - text: str - - -class ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["markdown"]] = None - - file_type: Optional[Literal["text/markdown"]] = None - - language: str - - word_count: int - - file_size: int - - chunk_headings: Optional[ - List[ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataChunkHeading] - ] = None - - heading_context: Optional[ - List[ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadataHeadingContext] - ] = None - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["text"]] = None - - file_type: Optional[Literal["text/plain"]] = None - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["pdf"]] = None - - file_type: Optional[Literal["application/pdf"]] = None - - total_pages: int - - total_size: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["code"]] = None - - file_type: str - - language: str - - word_count: int - - file_size: int - - start_line: Optional[int] = None - - num_lines: Optional[int] = None - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -class ChunkVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata(BaseModel): - type: Optional[Literal["audio"]] = None - - file_type: str - - file_size: int - - total_duration_seconds: float - - sample_rate: int - - channels: int - - audio_format: int - - if TYPE_CHECKING: - # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a - # value to this field, so for compatibility we avoid doing it at runtime. - __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - - # Stub to indicate that arbitrary properties are accepted. - # To access properties that are not valid identifiers you can use `getattr`, e.g. - # `getattr(obj, '$type')` - def __getattr__(self, attr: str) -> object: ... - else: - __pydantic_extra__: Dict[str, object] - - -ChunkVideoURLInputChunkGeneratedMetadata: TypeAlias = Annotated[ - Union[ - ChunkVideoURLInputChunkGeneratedMetadataMarkdownChunkGeneratedMetadata, - ChunkVideoURLInputChunkGeneratedMetadataTextChunkGeneratedMetadata, - ChunkVideoURLInputChunkGeneratedMetadataPdfChunkGeneratedMetadata, - ChunkVideoURLInputChunkGeneratedMetadataCodeChunkGeneratedMetadata, - ChunkVideoURLInputChunkGeneratedMetadataAudioChunkGeneratedMetadata, - None, - ], - PropertyInfo(discriminator="type"), -] - - -class ChunkVideoURLInputChunkVideoURL(BaseModel): - """The video input specification.""" - - url: str - """The video URL. Can be either a URL or a Data URI.""" - - -class ChunkVideoURLInputChunk(BaseModel): - chunk_index: int - """position of the chunk in a file""" - - mime_type: Optional[str] = None - """mime type of the chunk""" - - generated_metadata: Optional[ChunkVideoURLInputChunkGeneratedMetadata] = None - """metadata of the chunk""" - - model: Optional[str] = None - """model used for this chunk""" - - type: Optional[Literal["video_url"]] = None - """Input type identifier""" - - transcription: Optional[str] = None - """speech recognition (sr) text of the video""" - - summary: Optional[str] = None - """summary of the video""" - - video_url: ChunkVideoURLInputChunkVideoURL - """The video input specification.""" - - -Chunk: TypeAlias = Annotated[ - Union[ChunkTextInputChunk, ChunkImageURLInputChunk, ChunkAudioURLInputChunk, ChunkVideoURLInputChunk], - PropertyInfo(discriminator="type"), -] - - -class VectorStoreFile(BaseModel): - """Represents a file stored in a store.""" - - id: str - """Unique identifier for the file""" - - filename: Optional[str] = None - """Name of the file""" - - metadata: Optional[object] = None - """Optional file metadata""" - - status: Optional[StoreFileStatus] = None - """Processing status of the file""" - - last_error: Optional[object] = None - """Last error message if processing failed""" - - vector_store_id: str - """ID of the containing store""" - - created_at: datetime - """Timestamp of store file creation""" - - version: Optional[int] = None - """Version number of the file""" - - usage_bytes: Optional[int] = None - """Storage usage in bytes""" - - object: Optional[Literal["vector_store.file"]] = None - """Type of the object""" - - chunks: Optional[List[Chunk]] = None - """chunks""" diff --git a/src/mixedbread/types/vector_stores/vector_store_file_status.py b/src/mixedbread/types/vector_stores/vector_store_file_status.py deleted file mode 100644 index 12e80abd..00000000 --- a/src/mixedbread/types/vector_stores/vector_store_file_status.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["VectorStoreFileStatus"] - -VectorStoreFileStatus: TypeAlias = Literal["pending", "in_progress", "cancelled", "completed", "failed"] diff --git a/tests/api_resources/test_stores.py b/tests/api_resources/test_stores.py index cc59bc9f..0a076705 100644 --- a/tests/api_resources/test_stores.py +++ b/tests/api_resources/test_stores.py @@ -40,7 +40,10 @@ def test_method_create_with_all_params(self, client: Mixedbread) -> None: "days": 0, }, metadata={}, - config={"contextualization": True}, + config={ + "contextualization": True, + "save_content": True, + }, file_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], ) assert_matches_type(Store, store, path=["response"]) @@ -423,7 +426,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncMixedbread "days": 0, }, metadata={}, - config={"contextualization": True}, + config={ + "contextualization": True, + "save_content": True, + }, file_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], ) assert_matches_type(Store, store, path=["response"]) diff --git a/tests/api_resources/test_vector_stores.py b/tests/api_resources/test_vector_stores.py deleted file mode 100644 index 5bd08b5a..00000000 --- a/tests/api_resources/test_vector_stores.py +++ /dev/null @@ -1,768 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from mixedbread import Mixedbread, AsyncMixedbread -from tests.utils import assert_matches_type -from mixedbread.types import ( - VectorStore, - VectorStoreDeleteResponse, - VectorStoreSearchResponse, - VectorStoreQuestionAnsweringResponse, -) -from mixedbread.pagination import SyncCursor, AsyncCursor - -# pyright: reportDeprecated=false - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestVectorStores: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.create() - - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.create( - name="Technical Documentation", - description="Contains technical specifications and guides", - is_public=False, - expires_after={ - "anchor": "last_active_at", - "days": 0, - }, - metadata={}, - file_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.retrieve( - "vector_store_identifier", - ) - - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.with_raw_response.retrieve( - "vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.with_streaming_response.retrieve( - "vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - client.vector_stores.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_update(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.update( - vector_store_identifier="vector_store_identifier", - ) - - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.update( - vector_store_identifier="vector_store_identifier", - name="x", - description="description", - is_public=True, - expires_after={ - "anchor": "last_active_at", - "days": 0, - }, - metadata={}, - ) - - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.with_raw_response.update( - vector_store_identifier="vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.with_streaming_response.update( - vector_store_identifier="vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - client.vector_stores.with_raw_response.update( - vector_store_identifier="", - ) - - @parametrize - def test_method_list(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.list() - - assert_matches_type(SyncCursor[VectorStore], vector_store, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.list( - limit=10, - after="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - include_total=False, - q="x", - ) - - assert_matches_type(SyncCursor[VectorStore], vector_store, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(SyncCursor[VectorStore], vector_store, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(SyncCursor[VectorStore], vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.delete( - "vector_store_identifier", - ) - - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.with_raw_response.delete( - "vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.with_streaming_response.delete( - "vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - client.vector_stores.with_raw_response.delete( - "", - ) - - @parametrize - def test_method_question_answering(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.question_answering( - vector_store_identifiers=["string"], - ) - - assert_matches_type(VectorStoreQuestionAnsweringResponse, vector_store, path=["response"]) - - @parametrize - def test_method_question_answering_with_all_params(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.question_answering( - query="x", - vector_store_identifiers=["string"], - top_k=1, - filters={ - "all": [{}, {}], - "any": [{}, {}], - "none": [{}, {}], - }, - file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], - search_options={ - "score_threshold": 0, - "rewrite_query": True, - "rerank": True, - "agentic": True, - "return_metadata": True, - "apply_search_rules": True, - }, - stream=True, - qa_options={ - "cite": True, - "multimodal": True, - }, - ) - - assert_matches_type(VectorStoreQuestionAnsweringResponse, vector_store, path=["response"]) - - @parametrize - def test_raw_response_question_answering(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.with_raw_response.question_answering( - vector_store_identifiers=["string"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStoreQuestionAnsweringResponse, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_question_answering(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.with_streaming_response.question_answering( - vector_store_identifiers=["string"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStoreQuestionAnsweringResponse, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_search(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) - - assert_matches_type(VectorStoreSearchResponse, vector_store, path=["response"]) - - @parametrize - def test_method_search_with_all_params(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = client.vector_stores.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - top_k=1, - filters={ - "all": [{}, {}], - "any": [{}, {}], - "none": [{}, {}], - }, - file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], - search_options={ - "score_threshold": 0, - "rewrite_query": True, - "rerank": True, - "agentic": True, - "return_metadata": True, - "apply_search_rules": True, - }, - ) - - assert_matches_type(VectorStoreSearchResponse, vector_store, path=["response"]) - - @parametrize - def test_raw_response_search(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.with_raw_response.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = response.parse() - assert_matches_type(VectorStoreSearchResponse, vector_store, path=["response"]) - - @parametrize - def test_streaming_response_search(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.with_streaming_response.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = response.parse() - assert_matches_type(VectorStoreSearchResponse, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncVectorStores: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.create() - - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.create( - name="Technical Documentation", - description="Contains technical specifications and guides", - is_public=False, - expires_after={ - "anchor": "last_active_at", - "days": 0, - }, - metadata={}, - file_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - ) - - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.retrieve( - "vector_store_identifier", - ) - - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.with_raw_response.retrieve( - "vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.with_streaming_response.retrieve( - "vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - await async_client.vector_stores.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_update(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.update( - vector_store_identifier="vector_store_identifier", - ) - - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.update( - vector_store_identifier="vector_store_identifier", - name="x", - description="description", - is_public=True, - expires_after={ - "anchor": "last_active_at", - "days": 0, - }, - metadata={}, - ) - - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.with_raw_response.update( - vector_store_identifier="vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.with_streaming_response.update( - vector_store_identifier="vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStore, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - await async_client.vector_stores.with_raw_response.update( - vector_store_identifier="", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.list() - - assert_matches_type(AsyncCursor[VectorStore], vector_store, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.list( - limit=10, - after="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - include_total=False, - q="x", - ) - - assert_matches_type(AsyncCursor[VectorStore], vector_store, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(AsyncCursor[VectorStore], vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(AsyncCursor[VectorStore], vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.delete( - "vector_store_identifier", - ) - - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.with_raw_response.delete( - "vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.with_streaming_response.delete( - "vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStoreDeleteResponse, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - await async_client.vector_stores.with_raw_response.delete( - "", - ) - - @parametrize - async def test_method_question_answering(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.question_answering( - vector_store_identifiers=["string"], - ) - - assert_matches_type(VectorStoreQuestionAnsweringResponse, vector_store, path=["response"]) - - @parametrize - async def test_method_question_answering_with_all_params(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.question_answering( - query="x", - vector_store_identifiers=["string"], - top_k=1, - filters={ - "all": [{}, {}], - "any": [{}, {}], - "none": [{}, {}], - }, - file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], - search_options={ - "score_threshold": 0, - "rewrite_query": True, - "rerank": True, - "agentic": True, - "return_metadata": True, - "apply_search_rules": True, - }, - stream=True, - qa_options={ - "cite": True, - "multimodal": True, - }, - ) - - assert_matches_type(VectorStoreQuestionAnsweringResponse, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_question_answering(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.with_raw_response.question_answering( - vector_store_identifiers=["string"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStoreQuestionAnsweringResponse, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_question_answering(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.with_streaming_response.question_answering( - vector_store_identifiers=["string"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStoreQuestionAnsweringResponse, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_search(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) - - assert_matches_type(VectorStoreSearchResponse, vector_store, path=["response"]) - - @parametrize - async def test_method_search_with_all_params(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - vector_store = await async_client.vector_stores.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - top_k=1, - filters={ - "all": [{}, {}], - "any": [{}, {}], - "none": [{}, {}], - }, - file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], - search_options={ - "score_threshold": 0, - "rewrite_query": True, - "rerank": True, - "agentic": True, - "return_metadata": True, - "apply_search_rules": True, - }, - ) - - assert_matches_type(VectorStoreSearchResponse, vector_store, path=["response"]) - - @parametrize - async def test_raw_response_search(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.with_raw_response.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - vector_store = await response.parse() - assert_matches_type(VectorStoreSearchResponse, vector_store, path=["response"]) - - @parametrize - async def test_streaming_response_search(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.with_streaming_response.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - vector_store = await response.parse() - assert_matches_type(VectorStoreSearchResponse, vector_store, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/vector_stores/__init__.py b/tests/api_resources/vector_stores/__init__.py deleted file mode 100644 index fd8019a9..00000000 --- a/tests/api_resources/vector_stores/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/vector_stores/test_files.py b/tests/api_resources/vector_stores/test_files.py deleted file mode 100644 index d893b615..00000000 --- a/tests/api_resources/vector_stores/test_files.py +++ /dev/null @@ -1,659 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from mixedbread import Mixedbread, AsyncMixedbread -from tests.utils import assert_matches_type -from mixedbread.types.vector_stores import ( - VectorStoreFile, - FileListResponse, - FileDeleteResponse, - FileSearchResponse, -) - -# pyright: reportDeprecated=false - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestFiles: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = client.vector_stores.files.create( - vector_store_identifier="vector_store_identifier", - file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = client.vector_stores.files.create( - vector_store_identifier="vector_store_identifier", - metadata={}, - config={"parsing_strategy": "fast"}, - external_id="external_id", - overwrite=False, - file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - experimental={"parsing_strategy": "fast"}, - ) - - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.files.with_raw_response.create( - vector_store_identifier="vector_store_identifier", - file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.files.with_streaming_response.create( - vector_store_identifier="vector_store_identifier", - file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(VectorStoreFile, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - client.vector_stores.files.with_raw_response.create( - vector_store_identifier="", - file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - @parametrize - def test_method_retrieve(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = client.vector_stores.files.retrieve( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) - - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - def test_method_retrieve_with_all_params(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = client.vector_stores.files.retrieve( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - return_chunks=True, - ) - - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.files.with_raw_response.retrieve( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.files.with_streaming_response.retrieve( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(VectorStoreFile, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - client.vector_stores.files.with_raw_response.retrieve( - file_id="file_id", - vector_store_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - client.vector_stores.files.with_raw_response.retrieve( - file_id="", - vector_store_identifier="vector_store_identifier", - ) - - @parametrize - def test_method_list(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = client.vector_stores.files.list( - vector_store_identifier="vector_store_identifier", - ) - - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = client.vector_stores.files.list( - vector_store_identifier="vector_store_identifier", - limit=10, - after="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - include_total=False, - statuses=["pending"], - metadata_filter={ - "all": [{}, {}], - "any": [{}, {}], - "none": [{}, {}], - }, - ) - - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.files.with_raw_response.list( - vector_store_identifier="vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.files.with_streaming_response.list( - vector_store_identifier="vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - client.vector_stores.files.with_raw_response.list( - vector_store_identifier="", - ) - - @parametrize - def test_method_delete(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = client.vector_stores.files.delete( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) - - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.files.with_raw_response.delete( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.files.with_streaming_response.delete( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - client.vector_stores.files.with_raw_response.delete( - file_id="file_id", - vector_store_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - client.vector_stores.files.with_raw_response.delete( - file_id="", - vector_store_identifier="vector_store_identifier", - ) - - @parametrize - def test_method_search(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = client.vector_stores.files.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) - - assert_matches_type(FileSearchResponse, file, path=["response"]) - - @parametrize - def test_method_search_with_all_params(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = client.vector_stores.files.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - top_k=1, - filters={ - "all": [{}, {}], - "any": [{}, {}], - "none": [{}, {}], - }, - file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], - search_options={ - "score_threshold": 0, - "rewrite_query": True, - "rerank": True, - "agentic": True, - "return_metadata": True, - "return_chunks": True, - "chunks_per_file": 0, - "apply_search_rules": True, - }, - ) - - assert_matches_type(FileSearchResponse, file, path=["response"]) - - @parametrize - def test_raw_response_search(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = client.vector_stores.files.with_raw_response.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() - assert_matches_type(FileSearchResponse, file, path=["response"]) - - @parametrize - def test_streaming_response_search(self, client: Mixedbread) -> None: - with pytest.warns(DeprecationWarning): - with client.vector_stores.files.with_streaming_response.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = response.parse() - assert_matches_type(FileSearchResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncFiles: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = await async_client.vector_stores.files.create( - vector_store_identifier="vector_store_identifier", - file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = await async_client.vector_stores.files.create( - vector_store_identifier="vector_store_identifier", - metadata={}, - config={"parsing_strategy": "fast"}, - external_id="external_id", - overwrite=False, - file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - experimental={"parsing_strategy": "fast"}, - ) - - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.files.with_raw_response.create( - vector_store_identifier="vector_store_identifier", - file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.files.with_streaming_response.create( - vector_store_identifier="vector_store_identifier", - file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(VectorStoreFile, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - await async_client.vector_stores.files.with_raw_response.create( - vector_store_identifier="", - file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = await async_client.vector_stores.files.retrieve( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) - - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = await async_client.vector_stores.files.retrieve( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - return_chunks=True, - ) - - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.files.with_raw_response.retrieve( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(VectorStoreFile, file, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.files.with_streaming_response.retrieve( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(VectorStoreFile, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - await async_client.vector_stores.files.with_raw_response.retrieve( - file_id="file_id", - vector_store_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - await async_client.vector_stores.files.with_raw_response.retrieve( - file_id="", - vector_store_identifier="vector_store_identifier", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = await async_client.vector_stores.files.list( - vector_store_identifier="vector_store_identifier", - ) - - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = await async_client.vector_stores.files.list( - vector_store_identifier="vector_store_identifier", - limit=10, - after="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - before="eyJjcmVhdGVkX2F0IjoiMjAyNC0xMi0zMVQyMzo1OTo1OS4wMDBaIiwiaWQiOiJhYmMxMjMifQ==", - include_total=False, - statuses=["pending"], - metadata_filter={ - "all": [{}, {}], - "any": [{}, {}], - "none": [{}, {}], - }, - ) - - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.files.with_raw_response.list( - vector_store_identifier="vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.files.with_streaming_response.list( - vector_store_identifier="vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(FileListResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - await async_client.vector_stores.files.with_raw_response.list( - vector_store_identifier="", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = await async_client.vector_stores.files.delete( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) - - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.files.with_raw_response.delete( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.files.with_streaming_response.delete( - file_id="file_id", - vector_store_identifier="vector_store_identifier", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(FileDeleteResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `vector_store_identifier` but received ''" - ): - await async_client.vector_stores.files.with_raw_response.delete( - file_id="file_id", - vector_store_identifier="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): - await async_client.vector_stores.files.with_raw_response.delete( - file_id="", - vector_store_identifier="vector_store_identifier", - ) - - @parametrize - async def test_method_search(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = await async_client.vector_stores.files.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) - - assert_matches_type(FileSearchResponse, file, path=["response"]) - - @parametrize - async def test_method_search_with_all_params(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - file = await async_client.vector_stores.files.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - top_k=1, - filters={ - "all": [{}, {}], - "any": [{}, {}], - "none": [{}, {}], - }, - file_ids=["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"], - search_options={ - "score_threshold": 0, - "rewrite_query": True, - "rerank": True, - "agentic": True, - "return_metadata": True, - "return_chunks": True, - "chunks_per_file": 0, - "apply_search_rules": True, - }, - ) - - assert_matches_type(FileSearchResponse, file, path=["response"]) - - @parametrize - async def test_raw_response_search(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - response = await async_client.vector_stores.files.with_raw_response.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = await response.parse() - assert_matches_type(FileSearchResponse, file, path=["response"]) - - @parametrize - async def test_streaming_response_search(self, async_client: AsyncMixedbread) -> None: - with pytest.warns(DeprecationWarning): - async with async_client.vector_stores.files.with_streaming_response.search( - query="how to configure SSL", - vector_store_identifiers=["string"], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - file = await response.parse() - assert_matches_type(FileSearchResponse, file, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/test_utils/test_json.py b/tests/test_utils/test_json.py new file mode 100644 index 00000000..732c37f3 --- /dev/null +++ b/tests/test_utils/test_json.py @@ -0,0 +1,126 @@ +from __future__ import annotations + +import datetime +from typing import Union + +import pydantic + +from mixedbread import _compat +from mixedbread._utils._json import openapi_dumps + + +class TestOpenapiDumps: + def test_basic(self) -> None: + data = {"key": "value", "number": 42} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"key":"value","number":42}' + + def test_datetime_serialization(self) -> None: + dt = datetime.datetime(2023, 1, 1, 12, 0, 0) + data = {"datetime": dt} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"datetime":"2023-01-01T12:00:00"}' + + def test_pydantic_model_serialization(self) -> None: + class User(pydantic.BaseModel): + first_name: str + last_name: str + age: int + + model_instance = User(first_name="John", last_name="Kramer", age=83) + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"first_name":"John","last_name":"Kramer","age":83}}' + + def test_pydantic_model_with_default_values(self) -> None: + class User(pydantic.BaseModel): + name: str + role: str = "user" + active: bool = True + score: int = 0 + + model_instance = User(name="Alice") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Alice"}}' + + def test_pydantic_model_with_default_values_overridden(self) -> None: + class User(pydantic.BaseModel): + name: str + role: str = "user" + active: bool = True + + model_instance = User(name="Bob", role="admin", active=False) + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Bob","role":"admin","active":false}}' + + def test_pydantic_model_with_alias(self) -> None: + class User(pydantic.BaseModel): + first_name: str = pydantic.Field(alias="firstName") + last_name: str = pydantic.Field(alias="lastName") + + model_instance = User(firstName="John", lastName="Doe") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"firstName":"John","lastName":"Doe"}}' + + def test_pydantic_model_with_alias_and_default(self) -> None: + class User(pydantic.BaseModel): + user_name: str = pydantic.Field(alias="userName") + user_role: str = pydantic.Field(default="member", alias="userRole") + is_active: bool = pydantic.Field(default=True, alias="isActive") + + model_instance = User(userName="charlie") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"userName":"charlie"}}' + + model_with_overrides = User(userName="diana", userRole="admin", isActive=False) + data = {"model": model_with_overrides} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"userName":"diana","userRole":"admin","isActive":false}}' + + def test_pydantic_model_with_nested_models_and_defaults(self) -> None: + class Address(pydantic.BaseModel): + street: str + city: str = "Unknown" + + class User(pydantic.BaseModel): + name: str + address: Address + verified: bool = False + + if _compat.PYDANTIC_V1: + # to handle forward references in Pydantic v1 + User.update_forward_refs(**locals()) # type: ignore[reportDeprecated] + + address = Address(street="123 Main St") + user = User(name="Diana", address=address) + data = {"user": user} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"user":{"name":"Diana","address":{"street":"123 Main St"}}}' + + address_with_city = Address(street="456 Oak Ave", city="Boston") + user_verified = User(name="Eve", address=address_with_city, verified=True) + data = {"user": user_verified} + json_bytes = openapi_dumps(data) + assert ( + json_bytes == b'{"user":{"name":"Eve","address":{"street":"456 Oak Ave","city":"Boston"},"verified":true}}' + ) + + def test_pydantic_model_with_optional_fields(self) -> None: + class User(pydantic.BaseModel): + name: str + email: Union[str, None] + phone: Union[str, None] + + model_with_none = User(name="Eve", email=None, phone=None) + data = {"model": model_with_none} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Eve","email":null,"phone":null}}' + + model_with_values = User(name="Frank", email="frank@example.com", phone=None) + data = {"model": model_with_values} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Frank","email":"frank@example.com","phone":null}}'