diff --git a/.stats.yml b/.stats.yml index 2ace8ae2..89832423 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 33 +configured_endpoints: 24 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-43906e7132098c54e8b761fa3bd67fbd9174894faeb22367a681e92f60f6445f.yml diff --git a/api.md b/api.md index c5994fc6..c19bfce7 100644 --- a/api.md +++ b/api.md @@ -16,30 +16,6 @@ Methods: - client.info() -> InfoResponse -# Embeddings - -Types: - -```python -from mixedbread.types import Embedding, EmbeddingCreateResponse -``` - -Methods: - -- client.embeddings.create(\*\*params) -> EmbeddingCreateResponse - -# Reranking - -Types: - -```python -from mixedbread.types import RerankingCreateResponse -``` - -Methods: - -- client.reranking.create(\*\*params) -> RerankingCreateResponse - # Parsing ## Jobs @@ -122,56 +98,3 @@ Methods: - client.vector_stores.files.list(vector_store_id, \*\*params) -> SyncLimitOffset[VectorStoreFile] - client.vector_stores.files.delete(file_id, \*, vector_store_id) -> FileDeleteResponse - client.vector_stores.files.search(\*\*params) -> FileSearchResponse - -# Completions - -Types: - -```python -from mixedbread.types import CompletionCreateResponse -``` - -Methods: - -- client.completions.create() -> object - -# Extractions - -## Jobs - -Types: - -```python -from mixedbread.types.extractions import ExtractionJob -``` - -Methods: - -- client.extractions.jobs.create(\*\*params) -> ExtractionJob -- client.extractions.jobs.retrieve(job_id) -> ExtractionJob - -## Schema - -Types: - -```python -from mixedbread.types.extractions import CreatedJsonSchema, EnhancedJsonSchema, ValidatedJsonSchema -``` - -Methods: - -- client.extractions.schema.create(\*\*params) -> CreatedJsonSchema -- client.extractions.schema.enhance(\*\*params) -> EnhancedJsonSchema -- client.extractions.schema.validate(\*\*params) -> ValidatedJsonSchema - -## Content - -Types: - -```python -from mixedbread.types.extractions import ExtractionResult -``` - -Methods: - -- client.extractions.content.create(\*\*params) -> ExtractionResult diff --git a/src/mixedbread/_client.py b/src/mixedbread/_client.py index 1fcffdbb..9358b2b4 100644 --- a/src/mixedbread/_client.py +++ b/src/mixedbread/_client.py @@ -33,7 +33,7 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from .resources import files, reranking, embeddings, completions +from .resources import files from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import APIStatusError, MixedbreadError from ._base_client import ( @@ -44,7 +44,6 @@ ) from .resources.parsing import parsing from .types.info_response import InfoResponse -from .resources.extractions import extractions from .resources.vector_stores import vector_stores __all__ = [ @@ -66,13 +65,9 @@ class Mixedbread(SyncAPIClient): - embeddings: embeddings.EmbeddingsResource - reranking: reranking.RerankingResource parsing: parsing.ParsingResource files: files.FilesResource vector_stores: vector_stores.VectorStoresResource - completions: completions.CompletionsResource - extractions: extractions.ExtractionsResource with_raw_response: MixedbreadWithRawResponse with_streaming_response: MixedbreadWithStreamedResponse @@ -154,13 +149,9 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.embeddings = embeddings.EmbeddingsResource(self) - self.reranking = reranking.RerankingResource(self) self.parsing = parsing.ParsingResource(self) self.files = files.FilesResource(self) self.vector_stores = vector_stores.VectorStoresResource(self) - self.completions = completions.CompletionsResource(self) - self.extractions = extractions.ExtractionsResource(self) self.with_raw_response = MixedbreadWithRawResponse(self) self.with_streaming_response = MixedbreadWithStreamedResponse(self) @@ -295,13 +286,9 @@ def _make_status_error( class AsyncMixedbread(AsyncAPIClient): - embeddings: embeddings.AsyncEmbeddingsResource - reranking: reranking.AsyncRerankingResource parsing: parsing.AsyncParsingResource files: files.AsyncFilesResource vector_stores: vector_stores.AsyncVectorStoresResource - completions: completions.AsyncCompletionsResource - extractions: extractions.AsyncExtractionsResource with_raw_response: AsyncMixedbreadWithRawResponse with_streaming_response: AsyncMixedbreadWithStreamedResponse @@ -383,13 +370,9 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.embeddings = embeddings.AsyncEmbeddingsResource(self) - self.reranking = reranking.AsyncRerankingResource(self) self.parsing = parsing.AsyncParsingResource(self) self.files = files.AsyncFilesResource(self) self.vector_stores = vector_stores.AsyncVectorStoresResource(self) - self.completions = completions.AsyncCompletionsResource(self) - self.extractions = extractions.AsyncExtractionsResource(self) self.with_raw_response = AsyncMixedbreadWithRawResponse(self) self.with_streaming_response = AsyncMixedbreadWithStreamedResponse(self) @@ -525,13 +508,9 @@ def _make_status_error( class MixedbreadWithRawResponse: def __init__(self, client: Mixedbread) -> None: - self.embeddings = embeddings.EmbeddingsResourceWithRawResponse(client.embeddings) - self.reranking = reranking.RerankingResourceWithRawResponse(client.reranking) self.parsing = parsing.ParsingResourceWithRawResponse(client.parsing) self.files = files.FilesResourceWithRawResponse(client.files) self.vector_stores = vector_stores.VectorStoresResourceWithRawResponse(client.vector_stores) - self.completions = completions.CompletionsResourceWithRawResponse(client.completions) - self.extractions = extractions.ExtractionsResourceWithRawResponse(client.extractions) self.info = to_raw_response_wrapper( client.info, @@ -540,13 +519,9 @@ def __init__(self, client: Mixedbread) -> None: class AsyncMixedbreadWithRawResponse: def __init__(self, client: AsyncMixedbread) -> None: - self.embeddings = embeddings.AsyncEmbeddingsResourceWithRawResponse(client.embeddings) - self.reranking = reranking.AsyncRerankingResourceWithRawResponse(client.reranking) self.parsing = parsing.AsyncParsingResourceWithRawResponse(client.parsing) self.files = files.AsyncFilesResourceWithRawResponse(client.files) self.vector_stores = vector_stores.AsyncVectorStoresResourceWithRawResponse(client.vector_stores) - self.completions = completions.AsyncCompletionsResourceWithRawResponse(client.completions) - self.extractions = extractions.AsyncExtractionsResourceWithRawResponse(client.extractions) self.info = async_to_raw_response_wrapper( client.info, @@ -555,13 +530,9 @@ def __init__(self, client: AsyncMixedbread) -> None: class MixedbreadWithStreamedResponse: def __init__(self, client: Mixedbread) -> None: - self.embeddings = embeddings.EmbeddingsResourceWithStreamingResponse(client.embeddings) - self.reranking = reranking.RerankingResourceWithStreamingResponse(client.reranking) self.parsing = parsing.ParsingResourceWithStreamingResponse(client.parsing) self.files = files.FilesResourceWithStreamingResponse(client.files) self.vector_stores = vector_stores.VectorStoresResourceWithStreamingResponse(client.vector_stores) - self.completions = completions.CompletionsResourceWithStreamingResponse(client.completions) - self.extractions = extractions.ExtractionsResourceWithStreamingResponse(client.extractions) self.info = to_streamed_response_wrapper( client.info, @@ -570,13 +541,9 @@ def __init__(self, client: Mixedbread) -> None: class AsyncMixedbreadWithStreamedResponse: def __init__(self, client: AsyncMixedbread) -> None: - self.embeddings = embeddings.AsyncEmbeddingsResourceWithStreamingResponse(client.embeddings) - self.reranking = reranking.AsyncRerankingResourceWithStreamingResponse(client.reranking) self.parsing = parsing.AsyncParsingResourceWithStreamingResponse(client.parsing) self.files = files.AsyncFilesResourceWithStreamingResponse(client.files) self.vector_stores = vector_stores.AsyncVectorStoresResourceWithStreamingResponse(client.vector_stores) - self.completions = completions.AsyncCompletionsResourceWithStreamingResponse(client.completions) - self.extractions = extractions.AsyncExtractionsResourceWithStreamingResponse(client.extractions) self.info = async_to_streamed_response_wrapper( client.info, diff --git a/src/mixedbread/resources/__init__.py b/src/mixedbread/resources/__init__.py index 1cca98be..d1fe9468 100644 --- a/src/mixedbread/resources/__init__.py +++ b/src/mixedbread/resources/__init__.py @@ -16,38 +16,6 @@ ParsingResourceWithStreamingResponse, AsyncParsingResourceWithStreamingResponse, ) -from .reranking import ( - RerankingResource, - AsyncRerankingResource, - RerankingResourceWithRawResponse, - AsyncRerankingResourceWithRawResponse, - RerankingResourceWithStreamingResponse, - AsyncRerankingResourceWithStreamingResponse, -) -from .embeddings import ( - EmbeddingsResource, - AsyncEmbeddingsResource, - EmbeddingsResourceWithRawResponse, - AsyncEmbeddingsResourceWithRawResponse, - EmbeddingsResourceWithStreamingResponse, - AsyncEmbeddingsResourceWithStreamingResponse, -) -from .completions import ( - CompletionsResource, - AsyncCompletionsResource, - CompletionsResourceWithRawResponse, - AsyncCompletionsResourceWithRawResponse, - CompletionsResourceWithStreamingResponse, - AsyncCompletionsResourceWithStreamingResponse, -) -from .extractions import ( - ExtractionsResource, - AsyncExtractionsResource, - ExtractionsResourceWithRawResponse, - AsyncExtractionsResourceWithRawResponse, - ExtractionsResourceWithStreamingResponse, - AsyncExtractionsResourceWithStreamingResponse, -) from .vector_stores import ( VectorStoresResource, AsyncVectorStoresResource, @@ -58,18 +26,6 @@ ) __all__ = [ - "EmbeddingsResource", - "AsyncEmbeddingsResource", - "EmbeddingsResourceWithRawResponse", - "AsyncEmbeddingsResourceWithRawResponse", - "EmbeddingsResourceWithStreamingResponse", - "AsyncEmbeddingsResourceWithStreamingResponse", - "RerankingResource", - "AsyncRerankingResource", - "RerankingResourceWithRawResponse", - "AsyncRerankingResourceWithRawResponse", - "RerankingResourceWithStreamingResponse", - "AsyncRerankingResourceWithStreamingResponse", "ParsingResource", "AsyncParsingResource", "ParsingResourceWithRawResponse", @@ -88,16 +44,4 @@ "AsyncVectorStoresResourceWithRawResponse", "VectorStoresResourceWithStreamingResponse", "AsyncVectorStoresResourceWithStreamingResponse", - "CompletionsResource", - "AsyncCompletionsResource", - "CompletionsResourceWithRawResponse", - "AsyncCompletionsResourceWithRawResponse", - "CompletionsResourceWithStreamingResponse", - "AsyncCompletionsResourceWithStreamingResponse", - "ExtractionsResource", - "AsyncExtractionsResource", - "ExtractionsResourceWithRawResponse", - "AsyncExtractionsResourceWithRawResponse", - "ExtractionsResourceWithStreamingResponse", - "AsyncExtractionsResourceWithStreamingResponse", ] diff --git a/src/mixedbread/resources/completions.py b/src/mixedbread/resources/completions.py deleted file mode 100644 index 52d605b6..00000000 --- a/src/mixedbread/resources/completions.py +++ /dev/null @@ -1,164 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -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 - -__all__ = ["CompletionsResource", "AsyncCompletionsResource"] - - -class CompletionsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> CompletionsResourceWithRawResponse: - """ - 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 CompletionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CompletionsResourceWithStreamingResponse: - """ - 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 CompletionsResourceWithStreamingResponse(self) - - def create( - self, - *, - # 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, - ) -> object: - """ - Create a chat completion using the provided parameters. - - Generates a completion response based on the chat messages and model parameters - provided. The response can be either a full completion or streamed chunks - depending on the request parameters. - - Args: params: Parameters for creating the chat completion including messages, - model selection, and generation settings user: The authenticated user making the - request - - Returns: Either a ChatCompletion containing the full response, or - ChatCompletionChunk for streaming - - Raises: HTTPException: If there is an error creating the completion (500) - """ - return self._post( - "/v1/chat/completions", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - -class AsyncCompletionsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCompletionsResourceWithRawResponse: - """ - 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 AsyncCompletionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncCompletionsResourceWithStreamingResponse: - """ - 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 AsyncCompletionsResourceWithStreamingResponse(self) - - async def create( - self, - *, - # 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, - ) -> object: - """ - Create a chat completion using the provided parameters. - - Generates a completion response based on the chat messages and model parameters - provided. The response can be either a full completion or streamed chunks - depending on the request parameters. - - Args: params: Parameters for creating the chat completion including messages, - model selection, and generation settings user: The authenticated user making the - request - - Returns: Either a ChatCompletion containing the full response, or - ChatCompletionChunk for streaming - - Raises: HTTPException: If there is an error creating the completion (500) - """ - return await self._post( - "/v1/chat/completions", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - - -class CompletionsResourceWithRawResponse: - def __init__(self, completions: CompletionsResource) -> None: - self._completions = completions - - self.create = to_raw_response_wrapper( - completions.create, - ) - - -class AsyncCompletionsResourceWithRawResponse: - def __init__(self, completions: AsyncCompletionsResource) -> None: - self._completions = completions - - self.create = async_to_raw_response_wrapper( - completions.create, - ) - - -class CompletionsResourceWithStreamingResponse: - def __init__(self, completions: CompletionsResource) -> None: - self._completions = completions - - self.create = to_streamed_response_wrapper( - completions.create, - ) - - -class AsyncCompletionsResourceWithStreamingResponse: - def __init__(self, completions: AsyncCompletionsResource) -> None: - self._completions = completions - - self.create = async_to_streamed_response_wrapper( - completions.create, - ) diff --git a/src/mixedbread/resources/embeddings.py b/src/mixedbread/resources/embeddings.py deleted file mode 100644 index 1a6ecfe0..00000000 --- a/src/mixedbread/resources/embeddings.py +++ /dev/null @@ -1,241 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Optional -from typing_extensions import Literal - -import httpx - -from ..types import embedding_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -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.embedding_create_response import EmbeddingCreateResponse - -__all__ = ["EmbeddingsResource", "AsyncEmbeddingsResource"] - - -class EmbeddingsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> EmbeddingsResourceWithRawResponse: - """ - 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 EmbeddingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> EmbeddingsResourceWithStreamingResponse: - """ - 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 EmbeddingsResourceWithStreamingResponse(self) - - def create( - self, - *, - input: embedding_create_params.Input, - model: str, - dimensions: Optional[int] | NotGiven = NOT_GIVEN, - encoding_format: Union[ - Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"], - List[Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"]], - ] - | NotGiven = NOT_GIVEN, - normalized: bool | NotGiven = NOT_GIVEN, - prompt: Optional[str] | NotGiven = NOT_GIVEN, - # 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, - ) -> EmbeddingCreateResponse: - """ - Create embeddings for text or images using the specified model, encoding format, - and normalization. - - Args: params: The parameters for creating embeddings. - - Returns: EmbeddingCreateResponse: The response containing the embeddings. - - Args: - input: The input to create embeddings for. - - model: The model to use for creating embeddings. - - dimensions: The number of dimensions to use for the embeddings. - - encoding_format: The encoding format of the embeddings. - - normalized: Whether to normalize the embeddings. - - prompt: The prompt to use for the embedding creation. - - 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/embeddings", - body=maybe_transform( - { - "input": input, - "model": model, - "dimensions": dimensions, - "encoding_format": encoding_format, - "normalized": normalized, - "prompt": prompt, - }, - embedding_create_params.EmbeddingCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EmbeddingCreateResponse, - ) - - -class AsyncEmbeddingsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncEmbeddingsResourceWithRawResponse: - """ - 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 AsyncEmbeddingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncEmbeddingsResourceWithStreamingResponse: - """ - 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 AsyncEmbeddingsResourceWithStreamingResponse(self) - - async def create( - self, - *, - input: embedding_create_params.Input, - model: str, - dimensions: Optional[int] | NotGiven = NOT_GIVEN, - encoding_format: Union[ - Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"], - List[Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"]], - ] - | NotGiven = NOT_GIVEN, - normalized: bool | NotGiven = NOT_GIVEN, - prompt: Optional[str] | NotGiven = NOT_GIVEN, - # 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, - ) -> EmbeddingCreateResponse: - """ - Create embeddings for text or images using the specified model, encoding format, - and normalization. - - Args: params: The parameters for creating embeddings. - - Returns: EmbeddingCreateResponse: The response containing the embeddings. - - Args: - input: The input to create embeddings for. - - model: The model to use for creating embeddings. - - dimensions: The number of dimensions to use for the embeddings. - - encoding_format: The encoding format of the embeddings. - - normalized: Whether to normalize the embeddings. - - prompt: The prompt to use for the embedding creation. - - 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/embeddings", - body=await async_maybe_transform( - { - "input": input, - "model": model, - "dimensions": dimensions, - "encoding_format": encoding_format, - "normalized": normalized, - "prompt": prompt, - }, - embedding_create_params.EmbeddingCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EmbeddingCreateResponse, - ) - - -class EmbeddingsResourceWithRawResponse: - def __init__(self, embeddings: EmbeddingsResource) -> None: - self._embeddings = embeddings - - self.create = to_raw_response_wrapper( - embeddings.create, - ) - - -class AsyncEmbeddingsResourceWithRawResponse: - def __init__(self, embeddings: AsyncEmbeddingsResource) -> None: - self._embeddings = embeddings - - self.create = async_to_raw_response_wrapper( - embeddings.create, - ) - - -class EmbeddingsResourceWithStreamingResponse: - def __init__(self, embeddings: EmbeddingsResource) -> None: - self._embeddings = embeddings - - self.create = to_streamed_response_wrapper( - embeddings.create, - ) - - -class AsyncEmbeddingsResourceWithStreamingResponse: - def __init__(self, embeddings: AsyncEmbeddingsResource) -> None: - self._embeddings = embeddings - - self.create = async_to_streamed_response_wrapper( - embeddings.create, - ) diff --git a/src/mixedbread/resources/extractions/__init__.py b/src/mixedbread/resources/extractions/__init__.py deleted file mode 100644 index d9a42002..00000000 --- a/src/mixedbread/resources/extractions/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .jobs import ( - JobsResource, - AsyncJobsResource, - JobsResourceWithRawResponse, - AsyncJobsResourceWithRawResponse, - JobsResourceWithStreamingResponse, - AsyncJobsResourceWithStreamingResponse, -) -from .schema import ( - SchemaResource, - AsyncSchemaResource, - SchemaResourceWithRawResponse, - AsyncSchemaResourceWithRawResponse, - SchemaResourceWithStreamingResponse, - AsyncSchemaResourceWithStreamingResponse, -) -from .content import ( - ContentResource, - AsyncContentResource, - ContentResourceWithRawResponse, - AsyncContentResourceWithRawResponse, - ContentResourceWithStreamingResponse, - AsyncContentResourceWithStreamingResponse, -) -from .extractions import ( - ExtractionsResource, - AsyncExtractionsResource, - ExtractionsResourceWithRawResponse, - AsyncExtractionsResourceWithRawResponse, - ExtractionsResourceWithStreamingResponse, - AsyncExtractionsResourceWithStreamingResponse, -) - -__all__ = [ - "JobsResource", - "AsyncJobsResource", - "JobsResourceWithRawResponse", - "AsyncJobsResourceWithRawResponse", - "JobsResourceWithStreamingResponse", - "AsyncJobsResourceWithStreamingResponse", - "SchemaResource", - "AsyncSchemaResource", - "SchemaResourceWithRawResponse", - "AsyncSchemaResourceWithRawResponse", - "SchemaResourceWithStreamingResponse", - "AsyncSchemaResourceWithStreamingResponse", - "ContentResource", - "AsyncContentResource", - "ContentResourceWithRawResponse", - "AsyncContentResourceWithRawResponse", - "ContentResourceWithStreamingResponse", - "AsyncContentResourceWithStreamingResponse", - "ExtractionsResource", - "AsyncExtractionsResource", - "ExtractionsResourceWithRawResponse", - "AsyncExtractionsResourceWithRawResponse", - "ExtractionsResourceWithStreamingResponse", - "AsyncExtractionsResourceWithStreamingResponse", -] diff --git a/src/mixedbread/resources/extractions/content.py b/src/mixedbread/resources/extractions/content.py deleted file mode 100644 index cacd55a6..00000000 --- a/src/mixedbread/resources/extractions/content.py +++ /dev/null @@ -1,196 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -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.extractions import content_create_params -from ...types.extractions.extraction_result import ExtractionResult - -__all__ = ["ContentResource", "AsyncContentResource"] - - -class ContentResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ContentResourceWithRawResponse: - """ - 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 ContentResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ContentResourceWithStreamingResponse: - """ - 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 ContentResourceWithStreamingResponse(self) - - def create( - self, - *, - content: str, - json_schema: object, - # 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, - ) -> ExtractionResult: - """ - Extract content from a string using the provided schema. - - Args: params: The parameters for extracting content from a string. - - Returns: The extracted content. - - Args: - content: The content to extract from - - json_schema: The JSON schema to use for extraction - - 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/extractions/content", - body=maybe_transform( - { - "content": content, - "json_schema": json_schema, - }, - content_create_params.ContentCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ExtractionResult, - ) - - -class AsyncContentResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncContentResourceWithRawResponse: - """ - 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 AsyncContentResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncContentResourceWithStreamingResponse: - """ - 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 AsyncContentResourceWithStreamingResponse(self) - - async def create( - self, - *, - content: str, - json_schema: object, - # 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, - ) -> ExtractionResult: - """ - Extract content from a string using the provided schema. - - Args: params: The parameters for extracting content from a string. - - Returns: The extracted content. - - Args: - content: The content to extract from - - json_schema: The JSON schema to use for extraction - - 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/extractions/content", - body=await async_maybe_transform( - { - "content": content, - "json_schema": json_schema, - }, - content_create_params.ContentCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ExtractionResult, - ) - - -class ContentResourceWithRawResponse: - def __init__(self, content: ContentResource) -> None: - self._content = content - - self.create = to_raw_response_wrapper( - content.create, - ) - - -class AsyncContentResourceWithRawResponse: - def __init__(self, content: AsyncContentResource) -> None: - self._content = content - - self.create = async_to_raw_response_wrapper( - content.create, - ) - - -class ContentResourceWithStreamingResponse: - def __init__(self, content: ContentResource) -> None: - self._content = content - - self.create = to_streamed_response_wrapper( - content.create, - ) - - -class AsyncContentResourceWithStreamingResponse: - def __init__(self, content: AsyncContentResource) -> None: - self._content = content - - self.create = async_to_streamed_response_wrapper( - content.create, - ) diff --git a/src/mixedbread/resources/extractions/extractions.py b/src/mixedbread/resources/extractions/extractions.py deleted file mode 100644 index eebb3e40..00000000 --- a/src/mixedbread/resources/extractions/extractions.py +++ /dev/null @@ -1,166 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .jobs import ( - JobsResource, - AsyncJobsResource, - JobsResourceWithRawResponse, - AsyncJobsResourceWithRawResponse, - JobsResourceWithStreamingResponse, - AsyncJobsResourceWithStreamingResponse, -) -from .schema import ( - SchemaResource, - AsyncSchemaResource, - SchemaResourceWithRawResponse, - AsyncSchemaResourceWithRawResponse, - SchemaResourceWithStreamingResponse, - AsyncSchemaResourceWithStreamingResponse, -) -from .content import ( - ContentResource, - AsyncContentResource, - ContentResourceWithRawResponse, - AsyncContentResourceWithRawResponse, - ContentResourceWithStreamingResponse, - AsyncContentResourceWithStreamingResponse, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["ExtractionsResource", "AsyncExtractionsResource"] - - -class ExtractionsResource(SyncAPIResource): - @cached_property - def jobs(self) -> JobsResource: - return JobsResource(self._client) - - @cached_property - def schema(self) -> SchemaResource: - return SchemaResource(self._client) - - @cached_property - def content(self) -> ContentResource: - return ContentResource(self._client) - - @cached_property - def with_raw_response(self) -> ExtractionsResourceWithRawResponse: - """ - 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 ExtractionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ExtractionsResourceWithStreamingResponse: - """ - 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 ExtractionsResourceWithStreamingResponse(self) - - -class AsyncExtractionsResource(AsyncAPIResource): - @cached_property - def jobs(self) -> AsyncJobsResource: - return AsyncJobsResource(self._client) - - @cached_property - def schema(self) -> AsyncSchemaResource: - return AsyncSchemaResource(self._client) - - @cached_property - def content(self) -> AsyncContentResource: - return AsyncContentResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncExtractionsResourceWithRawResponse: - """ - 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 AsyncExtractionsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncExtractionsResourceWithStreamingResponse: - """ - 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 AsyncExtractionsResourceWithStreamingResponse(self) - - -class ExtractionsResourceWithRawResponse: - def __init__(self, extractions: ExtractionsResource) -> None: - self._extractions = extractions - - @cached_property - def jobs(self) -> JobsResourceWithRawResponse: - return JobsResourceWithRawResponse(self._extractions.jobs) - - @cached_property - def schema(self) -> SchemaResourceWithRawResponse: - return SchemaResourceWithRawResponse(self._extractions.schema) - - @cached_property - def content(self) -> ContentResourceWithRawResponse: - return ContentResourceWithRawResponse(self._extractions.content) - - -class AsyncExtractionsResourceWithRawResponse: - def __init__(self, extractions: AsyncExtractionsResource) -> None: - self._extractions = extractions - - @cached_property - def jobs(self) -> AsyncJobsResourceWithRawResponse: - return AsyncJobsResourceWithRawResponse(self._extractions.jobs) - - @cached_property - def schema(self) -> AsyncSchemaResourceWithRawResponse: - return AsyncSchemaResourceWithRawResponse(self._extractions.schema) - - @cached_property - def content(self) -> AsyncContentResourceWithRawResponse: - return AsyncContentResourceWithRawResponse(self._extractions.content) - - -class ExtractionsResourceWithStreamingResponse: - def __init__(self, extractions: ExtractionsResource) -> None: - self._extractions = extractions - - @cached_property - def jobs(self) -> JobsResourceWithStreamingResponse: - return JobsResourceWithStreamingResponse(self._extractions.jobs) - - @cached_property - def schema(self) -> SchemaResourceWithStreamingResponse: - return SchemaResourceWithStreamingResponse(self._extractions.schema) - - @cached_property - def content(self) -> ContentResourceWithStreamingResponse: - return ContentResourceWithStreamingResponse(self._extractions.content) - - -class AsyncExtractionsResourceWithStreamingResponse: - def __init__(self, extractions: AsyncExtractionsResource) -> None: - self._extractions = extractions - - @cached_property - def jobs(self) -> AsyncJobsResourceWithStreamingResponse: - return AsyncJobsResourceWithStreamingResponse(self._extractions.jobs) - - @cached_property - def schema(self) -> AsyncSchemaResourceWithStreamingResponse: - return AsyncSchemaResourceWithStreamingResponse(self._extractions.schema) - - @cached_property - def content(self) -> AsyncContentResourceWithStreamingResponse: - return AsyncContentResourceWithStreamingResponse(self._extractions.content) diff --git a/src/mixedbread/resources/extractions/jobs.py b/src/mixedbread/resources/extractions/jobs.py deleted file mode 100644 index 3abc64f9..00000000 --- a/src/mixedbread/resources/extractions/jobs.py +++ /dev/null @@ -1,286 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -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.extractions import job_create_params -from ...types.extractions.extraction_job import ExtractionJob - -__all__ = ["JobsResource", "AsyncJobsResource"] - - -class JobsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> JobsResourceWithRawResponse: - """ - 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 JobsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> JobsResourceWithStreamingResponse: - """ - 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 JobsResourceWithStreamingResponse(self) - - def create( - self, - *, - file_id: str, - json_schema: object, - # 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, - ) -> ExtractionJob: - """ - Start an extraction job for the provided file and schema. - - Args: params: The parameters for creating an extraction job. - - Returns: The created extraction job. - - Args: - file_id: The ID of the file to extract from - - json_schema: The JSON schema to use for extraction - - 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/extractions/jobs", - body=maybe_transform( - { - "file_id": file_id, - "json_schema": json_schema, - }, - job_create_params.JobCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ExtractionJob, - ) - - def retrieve( - self, - job_id: 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, - ) -> ExtractionJob: - """ - Get detailed information about a specific extraction job. - - Args: job_id: The ID of the extraction job. - - Returns: Detailed information about the extraction job. - - Args: - job_id: The ID of the extraction job to retrieve - - 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 job_id: - raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}") - return self._get( - f"/v1/extractions/jobs/{job_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ExtractionJob, - ) - - -class AsyncJobsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncJobsResourceWithRawResponse: - """ - 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 AsyncJobsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncJobsResourceWithStreamingResponse: - """ - 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 AsyncJobsResourceWithStreamingResponse(self) - - async def create( - self, - *, - file_id: str, - json_schema: object, - # 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, - ) -> ExtractionJob: - """ - Start an extraction job for the provided file and schema. - - Args: params: The parameters for creating an extraction job. - - Returns: The created extraction job. - - Args: - file_id: The ID of the file to extract from - - json_schema: The JSON schema to use for extraction - - 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/extractions/jobs", - body=await async_maybe_transform( - { - "file_id": file_id, - "json_schema": json_schema, - }, - job_create_params.JobCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ExtractionJob, - ) - - async def retrieve( - self, - job_id: 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, - ) -> ExtractionJob: - """ - Get detailed information about a specific extraction job. - - Args: job_id: The ID of the extraction job. - - Returns: Detailed information about the extraction job. - - Args: - job_id: The ID of the extraction job to retrieve - - 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 job_id: - raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}") - return await self._get( - f"/v1/extractions/jobs/{job_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ExtractionJob, - ) - - -class JobsResourceWithRawResponse: - def __init__(self, jobs: JobsResource) -> None: - self._jobs = jobs - - self.create = to_raw_response_wrapper( - jobs.create, - ) - self.retrieve = to_raw_response_wrapper( - jobs.retrieve, - ) - - -class AsyncJobsResourceWithRawResponse: - def __init__(self, jobs: AsyncJobsResource) -> None: - self._jobs = jobs - - self.create = async_to_raw_response_wrapper( - jobs.create, - ) - self.retrieve = async_to_raw_response_wrapper( - jobs.retrieve, - ) - - -class JobsResourceWithStreamingResponse: - def __init__(self, jobs: JobsResource) -> None: - self._jobs = jobs - - self.create = to_streamed_response_wrapper( - jobs.create, - ) - self.retrieve = to_streamed_response_wrapper( - jobs.retrieve, - ) - - -class AsyncJobsResourceWithStreamingResponse: - def __init__(self, jobs: AsyncJobsResource) -> None: - self._jobs = jobs - - self.create = async_to_streamed_response_wrapper( - jobs.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - jobs.retrieve, - ) diff --git a/src/mixedbread/resources/extractions/schema.py b/src/mixedbread/resources/extractions/schema.py deleted file mode 100644 index 60ee00a5..00000000 --- a/src/mixedbread/resources/extractions/schema.py +++ /dev/null @@ -1,356 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -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.extractions import schema_create_params, schema_enhance_params, schema_validate_params -from ...types.extractions.created_json_schema import CreatedJsonSchema -from ...types.extractions.enhanced_json_schema import EnhancedJsonSchema -from ...types.extractions.validated_json_schema import ValidatedJsonSchema - -__all__ = ["SchemaResource", "AsyncSchemaResource"] - - -class SchemaResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SchemaResourceWithRawResponse: - """ - 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 SchemaResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SchemaResourceWithStreamingResponse: - """ - 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 SchemaResourceWithStreamingResponse(self) - - def create( - self, - *, - description: 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, - ) -> CreatedJsonSchema: - """ - Create a schema with the provided parameters. - - Args: params: The parameters for creating a schema. - - Returns: The created schema. - - Args: - description: Description of the data to extract - - 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/extractions/schema", - body=maybe_transform({"description": description}, schema_create_params.SchemaCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CreatedJsonSchema, - ) - - def enhance( - self, - *, - json_schema: object, - # 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, - ) -> EnhancedJsonSchema: - """ - Enhance a schema by enriching the descriptions to aid extraction. - - Args: params: The parameters for enhancing a schema. - - Returns: The enhanced schema. - - Args: - json_schema: The JSON schema to enhance - - 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/extractions/schema/enhance", - body=maybe_transform({"json_schema": json_schema}, schema_enhance_params.SchemaEnhanceParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EnhancedJsonSchema, - ) - - def validate( - self, - *, - json_schema: object, - # 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, - ) -> ValidatedJsonSchema: - """ - Validate a schema. - - Args: params: The parameters for validating a schema. - - Returns: The validation result. - - Args: - json_schema: The JSON schema to validate - - 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/extractions/schema/validate", - body=maybe_transform({"json_schema": json_schema}, schema_validate_params.SchemaValidateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ValidatedJsonSchema, - ) - - -class AsyncSchemaResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSchemaResourceWithRawResponse: - """ - 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 AsyncSchemaResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSchemaResourceWithStreamingResponse: - """ - 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 AsyncSchemaResourceWithStreamingResponse(self) - - async def create( - self, - *, - description: 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, - ) -> CreatedJsonSchema: - """ - Create a schema with the provided parameters. - - Args: params: The parameters for creating a schema. - - Returns: The created schema. - - Args: - description: Description of the data to extract - - 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/extractions/schema", - body=await async_maybe_transform({"description": description}, schema_create_params.SchemaCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=CreatedJsonSchema, - ) - - async def enhance( - self, - *, - json_schema: object, - # 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, - ) -> EnhancedJsonSchema: - """ - Enhance a schema by enriching the descriptions to aid extraction. - - Args: params: The parameters for enhancing a schema. - - Returns: The enhanced schema. - - Args: - json_schema: The JSON schema to enhance - - 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/extractions/schema/enhance", - body=await async_maybe_transform({"json_schema": json_schema}, schema_enhance_params.SchemaEnhanceParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=EnhancedJsonSchema, - ) - - async def validate( - self, - *, - json_schema: object, - # 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, - ) -> ValidatedJsonSchema: - """ - Validate a schema. - - Args: params: The parameters for validating a schema. - - Returns: The validation result. - - Args: - json_schema: The JSON schema to validate - - 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/extractions/schema/validate", - body=await async_maybe_transform({"json_schema": json_schema}, schema_validate_params.SchemaValidateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ValidatedJsonSchema, - ) - - -class SchemaResourceWithRawResponse: - def __init__(self, schema: SchemaResource) -> None: - self._schema = schema - - self.create = to_raw_response_wrapper( - schema.create, - ) - self.enhance = to_raw_response_wrapper( - schema.enhance, - ) - self.validate = to_raw_response_wrapper( - schema.validate, - ) - - -class AsyncSchemaResourceWithRawResponse: - def __init__(self, schema: AsyncSchemaResource) -> None: - self._schema = schema - - self.create = async_to_raw_response_wrapper( - schema.create, - ) - self.enhance = async_to_raw_response_wrapper( - schema.enhance, - ) - self.validate = async_to_raw_response_wrapper( - schema.validate, - ) - - -class SchemaResourceWithStreamingResponse: - def __init__(self, schema: SchemaResource) -> None: - self._schema = schema - - self.create = to_streamed_response_wrapper( - schema.create, - ) - self.enhance = to_streamed_response_wrapper( - schema.enhance, - ) - self.validate = to_streamed_response_wrapper( - schema.validate, - ) - - -class AsyncSchemaResourceWithStreamingResponse: - def __init__(self, schema: AsyncSchemaResource) -> None: - self._schema = schema - - self.create = async_to_streamed_response_wrapper( - schema.create, - ) - self.enhance = async_to_streamed_response_wrapper( - schema.enhance, - ) - self.validate = async_to_streamed_response_wrapper( - schema.validate, - ) diff --git a/src/mixedbread/resources/reranking.py b/src/mixedbread/resources/reranking.py deleted file mode 100644 index 1c55f421..00000000 --- a/src/mixedbread/resources/reranking.py +++ /dev/null @@ -1,230 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Optional - -import httpx - -from ..types import reranking_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -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.reranking_create_response import RerankingCreateResponse - -__all__ = ["RerankingResource", "AsyncRerankingResource"] - - -class RerankingResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> RerankingResourceWithRawResponse: - """ - 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 RerankingResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RerankingResourceWithStreamingResponse: - """ - 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 RerankingResourceWithStreamingResponse(self) - - def create( - self, - *, - input: List[Union[str, object]], - query: str, - model: str | NotGiven = NOT_GIVEN, - rank_fields: Optional[List[str]] | NotGiven = NOT_GIVEN, - return_input: bool | NotGiven = NOT_GIVEN, - top_k: int | NotGiven = NOT_GIVEN, - # 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, - ) -> RerankingCreateResponse: - """ - Rerank different kind of documents for a given query. - - Args: params: RerankingCreateParams: The parameters for reranking. - - Returns: RerankingCreateResponse: The reranked documents for the input query. - - Args: - input: The input documents to rerank. - - query: The query to rerank the documents. - - model: The model to use for reranking documents. - - rank_fields: The fields of the documents to rank. - - return_input: Whether to return the documents. - - top_k: The number of documents to return. - - 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/reranking", - body=maybe_transform( - { - "input": input, - "query": query, - "model": model, - "rank_fields": rank_fields, - "return_input": return_input, - "top_k": top_k, - }, - reranking_create_params.RerankingCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RerankingCreateResponse, - ) - - -class AsyncRerankingResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRerankingResourceWithRawResponse: - """ - 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 AsyncRerankingResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRerankingResourceWithStreamingResponse: - """ - 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 AsyncRerankingResourceWithStreamingResponse(self) - - async def create( - self, - *, - input: List[Union[str, object]], - query: str, - model: str | NotGiven = NOT_GIVEN, - rank_fields: Optional[List[str]] | NotGiven = NOT_GIVEN, - return_input: bool | NotGiven = NOT_GIVEN, - top_k: int | NotGiven = NOT_GIVEN, - # 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, - ) -> RerankingCreateResponse: - """ - Rerank different kind of documents for a given query. - - Args: params: RerankingCreateParams: The parameters for reranking. - - Returns: RerankingCreateResponse: The reranked documents for the input query. - - Args: - input: The input documents to rerank. - - query: The query to rerank the documents. - - model: The model to use for reranking documents. - - rank_fields: The fields of the documents to rank. - - return_input: Whether to return the documents. - - top_k: The number of documents to return. - - 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/reranking", - body=await async_maybe_transform( - { - "input": input, - "query": query, - "model": model, - "rank_fields": rank_fields, - "return_input": return_input, - "top_k": top_k, - }, - reranking_create_params.RerankingCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RerankingCreateResponse, - ) - - -class RerankingResourceWithRawResponse: - def __init__(self, reranking: RerankingResource) -> None: - self._reranking = reranking - - self.create = to_raw_response_wrapper( - reranking.create, - ) - - -class AsyncRerankingResourceWithRawResponse: - def __init__(self, reranking: AsyncRerankingResource) -> None: - self._reranking = reranking - - self.create = async_to_raw_response_wrapper( - reranking.create, - ) - - -class RerankingResourceWithStreamingResponse: - def __init__(self, reranking: RerankingResource) -> None: - self._reranking = reranking - - self.create = to_streamed_response_wrapper( - reranking.create, - ) - - -class AsyncRerankingResourceWithStreamingResponse: - def __init__(self, reranking: AsyncRerankingResource) -> None: - self._reranking = reranking - - self.create = async_to_streamed_response_wrapper( - reranking.create, - ) diff --git a/src/mixedbread/types/__init__.py b/src/mixedbread/types/__init__.py index a426aa67..782a1804 100644 --- a/src/mixedbread/types/__init__.py +++ b/src/mixedbread/types/__init__.py @@ -3,7 +3,6 @@ from __future__ import annotations from .shared import SearchFilter as SearchFilter, SearchFilterCondition as SearchFilterCondition -from .embedding import Embedding as Embedding from .file_counts import FileCounts as FileCounts from .file_object import FileObject as FileObject from .vector_store import VectorStore as VectorStore @@ -14,11 +13,7 @@ from .file_update_params import FileUpdateParams as FileUpdateParams from .expires_after_param import ExpiresAfterParam as ExpiresAfterParam from .file_delete_response import FileDeleteResponse as FileDeleteResponse -from .embedding_create_params import EmbeddingCreateParams as EmbeddingCreateParams -from .reranking_create_params import RerankingCreateParams as RerankingCreateParams from .vector_store_list_params import VectorStoreListParams as VectorStoreListParams -from .embedding_create_response import EmbeddingCreateResponse as EmbeddingCreateResponse -from .reranking_create_response import RerankingCreateResponse as RerankingCreateResponse from .scored_vector_store_chunk import ScoredVectorStoreChunk as ScoredVectorStoreChunk from .vector_store_create_params import VectorStoreCreateParams as VectorStoreCreateParams from .vector_store_search_params import VectorStoreSearchParams as VectorStoreSearchParams diff --git a/src/mixedbread/types/embedding.py b/src/mixedbread/types/embedding.py deleted file mode 100644 index ad8cd3f0..00000000 --- a/src/mixedbread/types/embedding.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["Embedding"] - - -class Embedding(BaseModel): - embedding: Union[List[float], List[int], str] - """The encoded embedding.""" - - index: int - """The index of the embedding.""" - - object: Literal["embedding"] - """The object type of the embedding.""" diff --git a/src/mixedbread/types/embedding_create_params.py b/src/mixedbread/types/embedding_create_params.py deleted file mode 100644 index 6ca77dcf..00000000 --- a/src/mixedbread/types/embedding_create_params.py +++ /dev/null @@ -1,55 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Optional -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -__all__ = ["EmbeddingCreateParams", "Input", "InputImageURLInput", "InputImageURLInputImage", "InputTextInput"] - - -class EmbeddingCreateParams(TypedDict, total=False): - input: Required[Input] - """The input to create embeddings for.""" - - model: Required[str] - """The model to use for creating embeddings.""" - - dimensions: Optional[int] - """The number of dimensions to use for the embeddings.""" - - encoding_format: Union[ - Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"], - List[Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"]], - ] - """The encoding format of the embeddings.""" - - normalized: bool - """Whether to normalize the embeddings.""" - - prompt: Optional[str] - """The prompt to use for the embedding creation.""" - - -class InputImageURLInputImage(TypedDict, total=False): - url: Required[str] - """The image URL. Can be either a URL or a Data URI.""" - - -class InputImageURLInput(TypedDict, total=False): - image: Required[InputImageURLInputImage] - """The image input specification.""" - - type: Literal["image_url"] - """Input type identifier""" - - -class InputTextInput(TypedDict, total=False): - text: Required[str] - """Text content to process""" - - type: Literal["text"] - """Input type identifier""" - - -Input: TypeAlias = Union[str, InputImageURLInput, InputTextInput] diff --git a/src/mixedbread/types/embedding_create_response.py b/src/mixedbread/types/embedding_create_response.py deleted file mode 100644 index d31d69b4..00000000 --- a/src/mixedbread/types/embedding_create_response.py +++ /dev/null @@ -1,88 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import builtins -from typing import List, Union, Optional -from typing_extensions import Literal - -from .._models import BaseModel -from .embedding import Embedding - -__all__ = ["EmbeddingCreateResponse", "DataUnionMember1", "DataUnionMember1Embedding", "Usage"] - - -class DataUnionMember1Embedding(BaseModel): - base64: Optional[List[str]] = None - - binary: Optional[List[int]] = None - - float: Optional[List[builtins.float]] = None - - int8: Optional[List[int]] = None - - ubinary: Optional[List[int]] = None - - uint8: Optional[List[int]] = None - - -class DataUnionMember1(BaseModel): - embedding: DataUnionMember1Embedding - """ - The encoded embedding data by encoding format.Returned, if more than one - encoding format is used. - """ - - index: int - """The index of the embedding.""" - - object: Literal["embedding_dict"] - """The object type of the embedding.""" - - -class Usage(BaseModel): - prompt_tokens: int - """The number of tokens used for the prompt""" - - total_tokens: int - """The total number of tokens used""" - - completion_tokens: Optional[int] = None - """The number of tokens used for the completion""" - - -class EmbeddingCreateResponse(BaseModel): - data: Union[List[Embedding], List[DataUnionMember1]] - """The created embeddings.""" - - dimensions: Optional[int] = None - """The number of dimensions used for the embeddings.""" - - encoding_format: Union[ - Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"], - List[Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"]], - ] - """The encoding format of the embeddings.""" - - model: str - """The model used""" - - normalized: bool - """Whether the embeddings are normalized.""" - - usage: Usage - """The usage of the model""" - - object: Optional[ - Literal[ - "list", - "parsing_job", - "job", - "embedding", - "embedding_dict", - "text_document", - "file", - "vector_store", - "vector_store.file", - "api_key", - ] - ] = None - """The object type of the response""" diff --git a/src/mixedbread/types/extractions/__init__.py b/src/mixedbread/types/extractions/__init__.py deleted file mode 100644 index 6457c670..00000000 --- a/src/mixedbread/types/extractions/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .extraction_job import ExtractionJob as ExtractionJob -from .extraction_result import ExtractionResult as ExtractionResult -from .job_create_params import JobCreateParams as JobCreateParams -from .created_json_schema import CreatedJsonSchema as CreatedJsonSchema -from .enhanced_json_schema import EnhancedJsonSchema as EnhancedJsonSchema -from .schema_create_params import SchemaCreateParams as SchemaCreateParams -from .content_create_params import ContentCreateParams as ContentCreateParams -from .schema_enhance_params import SchemaEnhanceParams as SchemaEnhanceParams -from .validated_json_schema import ValidatedJsonSchema as ValidatedJsonSchema -from .schema_validate_params import SchemaValidateParams as SchemaValidateParams diff --git a/src/mixedbread/types/extractions/content_create_params.py b/src/mixedbread/types/extractions/content_create_params.py deleted file mode 100644 index 2bbdada2..00000000 --- a/src/mixedbread/types/extractions/content_create_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__ = ["ContentCreateParams"] - - -class ContentCreateParams(TypedDict, total=False): - content: Required[str] - """The content to extract from""" - - json_schema: Required[object] - """The JSON schema to use for extraction""" diff --git a/src/mixedbread/types/extractions/created_json_schema.py b/src/mixedbread/types/extractions/created_json_schema.py deleted file mode 100644 index 4b50c4c6..00000000 --- a/src/mixedbread/types/extractions/created_json_schema.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -from ..._models import BaseModel - -__all__ = ["CreatedJsonSchema"] - - -class CreatedJsonSchema(BaseModel): - json_schema: object - """The created JSON schema""" diff --git a/src/mixedbread/types/extractions/enhanced_json_schema.py b/src/mixedbread/types/extractions/enhanced_json_schema.py deleted file mode 100644 index 7b2ab04a..00000000 --- a/src/mixedbread/types/extractions/enhanced_json_schema.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -from ..._models import BaseModel - -__all__ = ["EnhancedJsonSchema"] - - -class EnhancedJsonSchema(BaseModel): - json_schema: object - """The enhanced JSON schema""" diff --git a/src/mixedbread/types/extractions/extraction_job.py b/src/mixedbread/types/extractions/extraction_job.py deleted file mode 100644 index 5d8a1604..00000000 --- a/src/mixedbread/types/extractions/extraction_job.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from ..._models import BaseModel -from .extraction_result import ExtractionResult - -__all__ = ["ExtractionJob"] - - -class ExtractionJob(BaseModel): - result: Optional[ExtractionResult] = None - """Result of an extraction operation.""" diff --git a/src/mixedbread/types/extractions/extraction_result.py b/src/mixedbread/types/extractions/extraction_result.py deleted file mode 100644 index fbac5d5f..00000000 --- a/src/mixedbread/types/extractions/extraction_result.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - - -from ..._models import BaseModel - -__all__ = ["ExtractionResult"] - - -class ExtractionResult(BaseModel): - data: object - """The extracted data""" diff --git a/src/mixedbread/types/extractions/job_create_params.py b/src/mixedbread/types/extractions/job_create_params.py deleted file mode 100644 index 476154b2..00000000 --- a/src/mixedbread/types/extractions/job_create_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__ = ["JobCreateParams"] - - -class JobCreateParams(TypedDict, total=False): - file_id: Required[str] - """The ID of the file to extract from""" - - json_schema: Required[object] - """The JSON schema to use for extraction""" diff --git a/src/mixedbread/types/extractions/schema_create_params.py b/src/mixedbread/types/extractions/schema_create_params.py deleted file mode 100644 index 8625ea66..00000000 --- a/src/mixedbread/types/extractions/schema_create_params.py +++ /dev/null @@ -1,12 +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__ = ["SchemaCreateParams"] - - -class SchemaCreateParams(TypedDict, total=False): - description: Required[str] - """Description of the data to extract""" diff --git a/src/mixedbread/types/extractions/schema_enhance_params.py b/src/mixedbread/types/extractions/schema_enhance_params.py deleted file mode 100644 index e0facf34..00000000 --- a/src/mixedbread/types/extractions/schema_enhance_params.py +++ /dev/null @@ -1,12 +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__ = ["SchemaEnhanceParams"] - - -class SchemaEnhanceParams(TypedDict, total=False): - json_schema: Required[object] - """The JSON schema to enhance""" diff --git a/src/mixedbread/types/extractions/schema_validate_params.py b/src/mixedbread/types/extractions/schema_validate_params.py deleted file mode 100644 index 947182ca..00000000 --- a/src/mixedbread/types/extractions/schema_validate_params.py +++ /dev/null @@ -1,12 +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__ = ["SchemaValidateParams"] - - -class SchemaValidateParams(TypedDict, total=False): - json_schema: Required[object] - """The JSON schema to validate""" diff --git a/src/mixedbread/types/extractions/validated_json_schema.py b/src/mixedbread/types/extractions/validated_json_schema.py deleted file mode 100644 index 42e6da5b..00000000 --- a/src/mixedbread/types/extractions/validated_json_schema.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..._models import BaseModel - -__all__ = ["ValidatedJsonSchema"] - - -class ValidatedJsonSchema(BaseModel): - errors: List[str] - """List of validation errors""" - - is_valid: bool - """Whether the schema is valid""" - - json_schema: object - """The validated JSON schema""" diff --git a/src/mixedbread/types/reranking_create_params.py b/src/mixedbread/types/reranking_create_params.py deleted file mode 100644 index cbf9514e..00000000 --- a/src/mixedbread/types/reranking_create_params.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import List, Union, Optional -from typing_extensions import Required, TypedDict - -__all__ = ["RerankingCreateParams"] - - -class RerankingCreateParams(TypedDict, total=False): - input: Required[List[Union[str, object]]] - """The input documents to rerank.""" - - query: Required[str] - """The query to rerank the documents.""" - - model: str - """The model to use for reranking documents.""" - - rank_fields: Optional[List[str]] - """The fields of the documents to rank.""" - - return_input: bool - """Whether to return the documents.""" - - top_k: int - """The number of documents to return.""" diff --git a/src/mixedbread/types/reranking_create_response.py b/src/mixedbread/types/reranking_create_response.py deleted file mode 100644 index a9d91d9c..00000000 --- a/src/mixedbread/types/reranking_create_response.py +++ /dev/null @@ -1,78 +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 - -__all__ = ["RerankingCreateResponse", "Data", "Usage"] - - -class Data(BaseModel): - index: int - - input: object - """The input document.""" - - score: float - """The score of the document.""" - - object: Optional[ - Literal[ - "list", - "parsing_job", - "job", - "embedding", - "embedding_dict", - "text_document", - "file", - "vector_store", - "vector_store.file", - "api_key", - ] - ] = None - """The object type.""" - - -class Usage(BaseModel): - prompt_tokens: int - """The number of tokens used for the prompt""" - - total_tokens: int - """The total number of tokens used""" - - completion_tokens: Optional[int] = None - """The number of tokens used for the completion""" - - -class RerankingCreateResponse(BaseModel): - data: List[Data] - """The ranked documents.""" - - model: str - """The model used""" - - return_input: bool - """Whether to return the documents.""" - - top_k: int - """The number of documents to return.""" - - usage: Usage - """The usage of the model""" - - object: Optional[ - Literal[ - "list", - "parsing_job", - "job", - "embedding", - "embedding_dict", - "text_document", - "file", - "vector_store", - "vector_store.file", - "api_key", - ] - ] = None - """The object type of the response""" diff --git a/tests/api_resources/extractions/__init__.py b/tests/api_resources/extractions/__init__.py deleted file mode 100644 index fd8019a9..00000000 --- a/tests/api_resources/extractions/__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/extractions/test_content.py b/tests/api_resources/extractions/test_content.py deleted file mode 100644 index 7beb468b..00000000 --- a/tests/api_resources/extractions/test_content.py +++ /dev/null @@ -1,90 +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.extractions import ExtractionResult - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestContent: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Mixedbread) -> None: - content = client.extractions.content.create( - content="content", - json_schema={}, - ) - assert_matches_type(ExtractionResult, content, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Mixedbread) -> None: - response = client.extractions.content.with_raw_response.create( - content="content", - json_schema={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = response.parse() - assert_matches_type(ExtractionResult, content, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Mixedbread) -> None: - with client.extractions.content.with_streaming_response.create( - content="content", - json_schema={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - content = response.parse() - assert_matches_type(ExtractionResult, content, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncContent: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncMixedbread) -> None: - content = await async_client.extractions.content.create( - content="content", - json_schema={}, - ) - assert_matches_type(ExtractionResult, content, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None: - response = await async_client.extractions.content.with_raw_response.create( - content="content", - json_schema={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - content = await response.parse() - assert_matches_type(ExtractionResult, content, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None: - async with async_client.extractions.content.with_streaming_response.create( - content="content", - json_schema={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - content = await response.parse() - assert_matches_type(ExtractionResult, content, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/extractions/test_jobs.py b/tests/api_resources/extractions/test_jobs.py deleted file mode 100644 index bb055ba7..00000000 --- a/tests/api_resources/extractions/test_jobs.py +++ /dev/null @@ -1,166 +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.extractions import ExtractionJob - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestJobs: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Mixedbread) -> None: - job = client.extractions.jobs.create( - file_id="file_id", - json_schema={}, - ) - assert_matches_type(ExtractionJob, job, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Mixedbread) -> None: - response = client.extractions.jobs.with_raw_response.create( - file_id="file_id", - json_schema={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = response.parse() - assert_matches_type(ExtractionJob, job, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Mixedbread) -> None: - with client.extractions.jobs.with_streaming_response.create( - file_id="file_id", - json_schema={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = response.parse() - assert_matches_type(ExtractionJob, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Mixedbread) -> None: - job = client.extractions.jobs.retrieve( - "job_id", - ) - assert_matches_type(ExtractionJob, job, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Mixedbread) -> None: - response = client.extractions.jobs.with_raw_response.retrieve( - "job_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = response.parse() - assert_matches_type(ExtractionJob, job, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Mixedbread) -> None: - with client.extractions.jobs.with_streaming_response.retrieve( - "job_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = response.parse() - assert_matches_type(ExtractionJob, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Mixedbread) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"): - client.extractions.jobs.with_raw_response.retrieve( - "", - ) - - -class TestAsyncJobs: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncMixedbread) -> None: - job = await async_client.extractions.jobs.create( - file_id="file_id", - json_schema={}, - ) - assert_matches_type(ExtractionJob, job, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None: - response = await async_client.extractions.jobs.with_raw_response.create( - file_id="file_id", - json_schema={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = await response.parse() - assert_matches_type(ExtractionJob, job, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None: - async with async_client.extractions.jobs.with_streaming_response.create( - file_id="file_id", - json_schema={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = await response.parse() - assert_matches_type(ExtractionJob, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncMixedbread) -> None: - job = await async_client.extractions.jobs.retrieve( - "job_id", - ) - assert_matches_type(ExtractionJob, job, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncMixedbread) -> None: - response = await async_client.extractions.jobs.with_raw_response.retrieve( - "job_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - job = await response.parse() - assert_matches_type(ExtractionJob, job, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncMixedbread) -> None: - async with async_client.extractions.jobs.with_streaming_response.retrieve( - "job_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - job = await response.parse() - assert_matches_type(ExtractionJob, job, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncMixedbread) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `job_id` but received ''"): - await async_client.extractions.jobs.with_raw_response.retrieve( - "", - ) diff --git a/tests/api_resources/extractions/test_schema.py b/tests/api_resources/extractions/test_schema.py deleted file mode 100644 index 5bff1298..00000000 --- a/tests/api_resources/extractions/test_schema.py +++ /dev/null @@ -1,212 +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.extractions import ( - CreatedJsonSchema, - EnhancedJsonSchema, - ValidatedJsonSchema, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSchema: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Mixedbread) -> None: - schema = client.extractions.schema.create( - description="description", - ) - assert_matches_type(CreatedJsonSchema, schema, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Mixedbread) -> None: - response = client.extractions.schema.with_raw_response.create( - description="description", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - schema = response.parse() - assert_matches_type(CreatedJsonSchema, schema, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Mixedbread) -> None: - with client.extractions.schema.with_streaming_response.create( - description="description", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - schema = response.parse() - assert_matches_type(CreatedJsonSchema, schema, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_enhance(self, client: Mixedbread) -> None: - schema = client.extractions.schema.enhance( - json_schema={}, - ) - assert_matches_type(EnhancedJsonSchema, schema, path=["response"]) - - @parametrize - def test_raw_response_enhance(self, client: Mixedbread) -> None: - response = client.extractions.schema.with_raw_response.enhance( - json_schema={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - schema = response.parse() - assert_matches_type(EnhancedJsonSchema, schema, path=["response"]) - - @parametrize - def test_streaming_response_enhance(self, client: Mixedbread) -> None: - with client.extractions.schema.with_streaming_response.enhance( - json_schema={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - schema = response.parse() - assert_matches_type(EnhancedJsonSchema, schema, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_validate(self, client: Mixedbread) -> None: - schema = client.extractions.schema.validate( - json_schema={}, - ) - assert_matches_type(ValidatedJsonSchema, schema, path=["response"]) - - @parametrize - def test_raw_response_validate(self, client: Mixedbread) -> None: - response = client.extractions.schema.with_raw_response.validate( - json_schema={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - schema = response.parse() - assert_matches_type(ValidatedJsonSchema, schema, path=["response"]) - - @parametrize - def test_streaming_response_validate(self, client: Mixedbread) -> None: - with client.extractions.schema.with_streaming_response.validate( - json_schema={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - schema = response.parse() - assert_matches_type(ValidatedJsonSchema, schema, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncSchema: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncMixedbread) -> None: - schema = await async_client.extractions.schema.create( - description="description", - ) - assert_matches_type(CreatedJsonSchema, schema, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None: - response = await async_client.extractions.schema.with_raw_response.create( - description="description", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - schema = await response.parse() - assert_matches_type(CreatedJsonSchema, schema, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None: - async with async_client.extractions.schema.with_streaming_response.create( - description="description", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - schema = await response.parse() - assert_matches_type(CreatedJsonSchema, schema, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_enhance(self, async_client: AsyncMixedbread) -> None: - schema = await async_client.extractions.schema.enhance( - json_schema={}, - ) - assert_matches_type(EnhancedJsonSchema, schema, path=["response"]) - - @parametrize - async def test_raw_response_enhance(self, async_client: AsyncMixedbread) -> None: - response = await async_client.extractions.schema.with_raw_response.enhance( - json_schema={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - schema = await response.parse() - assert_matches_type(EnhancedJsonSchema, schema, path=["response"]) - - @parametrize - async def test_streaming_response_enhance(self, async_client: AsyncMixedbread) -> None: - async with async_client.extractions.schema.with_streaming_response.enhance( - json_schema={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - schema = await response.parse() - assert_matches_type(EnhancedJsonSchema, schema, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_validate(self, async_client: AsyncMixedbread) -> None: - schema = await async_client.extractions.schema.validate( - json_schema={}, - ) - assert_matches_type(ValidatedJsonSchema, schema, path=["response"]) - - @parametrize - async def test_raw_response_validate(self, async_client: AsyncMixedbread) -> None: - response = await async_client.extractions.schema.with_raw_response.validate( - json_schema={}, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - schema = await response.parse() - assert_matches_type(ValidatedJsonSchema, schema, path=["response"]) - - @parametrize - async def test_streaming_response_validate(self, async_client: AsyncMixedbread) -> None: - async with async_client.extractions.schema.with_streaming_response.validate( - json_schema={}, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - schema = await response.parse() - assert_matches_type(ValidatedJsonSchema, schema, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_completions.py b/tests/api_resources/test_completions.py deleted file mode 100644 index af7af678..00000000 --- a/tests/api_resources/test_completions.py +++ /dev/null @@ -1,71 +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 - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestCompletions: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Mixedbread) -> None: - completion = client.completions.create() - assert_matches_type(object, completion, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Mixedbread) -> None: - response = client.completions.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - completion = response.parse() - assert_matches_type(object, completion, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Mixedbread) -> None: - with client.completions.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - completion = response.parse() - assert_matches_type(object, completion, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncCompletions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncMixedbread) -> None: - completion = await async_client.completions.create() - assert_matches_type(object, completion, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None: - response = await async_client.completions.with_raw_response.create() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - completion = await response.parse() - assert_matches_type(object, completion, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None: - async with async_client.completions.with_streaming_response.create() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - completion = await response.parse() - assert_matches_type(object, completion, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_embeddings.py b/tests/api_resources/test_embeddings.py deleted file mode 100644 index 62648a38..00000000 --- a/tests/api_resources/test_embeddings.py +++ /dev/null @@ -1,114 +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 EmbeddingCreateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestEmbeddings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Mixedbread) -> None: - embedding = client.embeddings.create( - input="This is a sample text input.", - model="mixedbread-ai/mxbai-embed-large-v1", - ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Mixedbread) -> None: - embedding = client.embeddings.create( - input="This is a sample text input.", - model="mixedbread-ai/mxbai-embed-large-v1", - dimensions=768, - encoding_format="float", - normalized=True, - prompt="Provide a detailed summary of the following text.", - ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Mixedbread) -> None: - response = client.embeddings.with_raw_response.create( - input="This is a sample text input.", - model="mixedbread-ai/mxbai-embed-large-v1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - embedding = response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Mixedbread) -> None: - with client.embeddings.with_streaming_response.create( - input="This is a sample text input.", - model="mixedbread-ai/mxbai-embed-large-v1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - embedding = response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncEmbeddings: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncMixedbread) -> None: - embedding = await async_client.embeddings.create( - input="This is a sample text input.", - model="mixedbread-ai/mxbai-embed-large-v1", - ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None: - embedding = await async_client.embeddings.create( - input="This is a sample text input.", - model="mixedbread-ai/mxbai-embed-large-v1", - dimensions=768, - encoding_format="float", - normalized=True, - prompt="Provide a detailed summary of the following text.", - ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None: - response = await async_client.embeddings.with_raw_response.create( - input="This is a sample text input.", - model="mixedbread-ai/mxbai-embed-large-v1", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - embedding = await response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None: - async with async_client.embeddings.with_streaming_response.create( - input="This is a sample text input.", - model="mixedbread-ai/mxbai-embed-large-v1", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - embedding = await response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_reranking.py b/tests/api_resources/test_reranking.py deleted file mode 100644 index 009148f5..00000000 --- a/tests/api_resources/test_reranking.py +++ /dev/null @@ -1,114 +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 RerankingCreateResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestReranking: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Mixedbread) -> None: - reranking = client.reranking.create( - input=["Document 1", "Document 2"], - query="What is mixedbread ai?", - ) - assert_matches_type(RerankingCreateResponse, reranking, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Mixedbread) -> None: - reranking = client.reranking.create( - input=["Document 1", "Document 2"], - query="What is mixedbread ai?", - model="x", - rank_fields=["field1", "field2"], - return_input=False, - top_k=10, - ) - assert_matches_type(RerankingCreateResponse, reranking, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Mixedbread) -> None: - response = client.reranking.with_raw_response.create( - input=["Document 1", "Document 2"], - query="What is mixedbread ai?", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - reranking = response.parse() - assert_matches_type(RerankingCreateResponse, reranking, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Mixedbread) -> None: - with client.reranking.with_streaming_response.create( - input=["Document 1", "Document 2"], - query="What is mixedbread ai?", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - reranking = response.parse() - assert_matches_type(RerankingCreateResponse, reranking, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncReranking: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncMixedbread) -> None: - reranking = await async_client.reranking.create( - input=["Document 1", "Document 2"], - query="What is mixedbread ai?", - ) - assert_matches_type(RerankingCreateResponse, reranking, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None: - reranking = await async_client.reranking.create( - input=["Document 1", "Document 2"], - query="What is mixedbread ai?", - model="x", - rank_fields=["field1", "field2"], - return_input=False, - top_k=10, - ) - assert_matches_type(RerankingCreateResponse, reranking, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None: - response = await async_client.reranking.with_raw_response.create( - input=["Document 1", "Document 2"], - query="What is mixedbread ai?", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - reranking = await response.parse() - assert_matches_type(RerankingCreateResponse, reranking, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None: - async with async_client.reranking.with_streaming_response.create( - input=["Document 1", "Document 2"], - query="What is mixedbread ai?", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - reranking = await response.parse() - assert_matches_type(RerankingCreateResponse, reranking, path=["response"]) - - assert cast(Any, response.is_closed) is True