diff --git a/.stats.yml b/.stats.yml index 9bfa71fc..68253575 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-82c2c1c322149cd73b2e8e45f475919b941752a89e74464ccecd1aee9352e9be.yml -openapi_spec_hash: d3ab27dba9665501eb2e47d18d3a2b68 +openapi_spec_hash: bbf8d4c5379fa9652890792e28f97f4e config_hash: f87f729f63f3b34364d1c144753b920d diff --git a/src/mixedbread/_client.py b/src/mixedbread/_client.py index 30ff9cca..c80b3274 100644 --- a/src/mixedbread/_client.py +++ b/src/mixedbread/_client.py @@ -242,7 +242,7 @@ def embed( self, *, model: str, - input: List[str], + input: Union[str, List[str]], dimensions: Optional[int] | NotGiven = NOT_GIVEN, prompt: Optional[str] | NotGiven = NOT_GIVEN, normalized: bool | NotGiven = NOT_GIVEN, @@ -599,7 +599,7 @@ async def embed( self, *, model: str, - input: List[str], + input: Union[str, List[str]], dimensions: Optional[int] | NotGiven = NOT_GIVEN, prompt: Optional[str] | NotGiven = NOT_GIVEN, normalized: bool | NotGiven = NOT_GIVEN, diff --git a/src/mixedbread/resources/embeddings.py b/src/mixedbread/resources/embeddings.py index d7390eda..3800954d 100644 --- a/src/mixedbread/resources/embeddings.py +++ b/src/mixedbread/resources/embeddings.py @@ -51,7 +51,7 @@ def create( self, *, model: str, - input: List[str], + input: Union[str, List[str]], dimensions: Optional[int] | NotGiven = NOT_GIVEN, prompt: Optional[str] | NotGiven = NOT_GIVEN, normalized: bool | NotGiven = NOT_GIVEN, @@ -141,7 +141,7 @@ async def create( self, *, model: str, - input: List[str], + input: Union[str, List[str]], dimensions: Optional[int] | NotGiven = NOT_GIVEN, prompt: Optional[str] | NotGiven = NOT_GIVEN, normalized: bool | NotGiven = NOT_GIVEN, diff --git a/src/mixedbread/types/client_embed_params.py b/src/mixedbread/types/client_embed_params.py index ec6a6e8b..3f27c1a3 100644 --- a/src/mixedbread/types/client_embed_params.py +++ b/src/mixedbread/types/client_embed_params.py @@ -12,7 +12,7 @@ class ClientEmbedParams(TypedDict, total=False): model: Required[str] """The model to use for creating embeddings.""" - input: Required[List[str]] + input: Required[Union[str, List[str]]] """The input to create embeddings for.""" dimensions: Optional[int] diff --git a/src/mixedbread/types/embedding_create_params.py b/src/mixedbread/types/embedding_create_params.py index 534982e3..6c9b29f6 100644 --- a/src/mixedbread/types/embedding_create_params.py +++ b/src/mixedbread/types/embedding_create_params.py @@ -12,7 +12,7 @@ class EmbeddingCreateParams(TypedDict, total=False): model: Required[str] """The model to use for creating embeddings.""" - input: Required[List[str]] + input: Required[Union[str, List[str]]] """The input to create embeddings for.""" dimensions: Optional[int] diff --git a/tests/api_resources/test_client.py b/tests/api_resources/test_client.py index 1c38d8ba..2122a9f1 100644 --- a/tests/api_resources/test_client.py +++ b/tests/api_resources/test_client.py @@ -25,7 +25,7 @@ class TestClient: def test_method_embed(self, client: Mixedbread) -> None: client_ = client.embed( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) assert_matches_type(EmbeddingCreateResponse, client_, path=["response"]) @@ -33,7 +33,7 @@ def test_method_embed(self, client: Mixedbread) -> None: def test_method_embed_with_all_params(self, client: Mixedbread) -> None: client_ = client.embed( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", dimensions=768, prompt="Provide a detailed summary of the following text.", normalized=True, @@ -45,7 +45,7 @@ def test_method_embed_with_all_params(self, client: Mixedbread) -> None: def test_raw_response_embed(self, client: Mixedbread) -> None: response = client.with_raw_response.embed( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) assert response.is_closed is True @@ -57,7 +57,7 @@ def test_raw_response_embed(self, client: Mixedbread) -> None: def test_streaming_response_embed(self, client: Mixedbread) -> None: with client.with_streaming_response.embed( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -95,7 +95,7 @@ def test_streaming_response_info(self, client: Mixedbread) -> None: @parametrize def test_method_rerank(self, client: Mixedbread) -> None: client_ = client.rerank( - query="What is mixedbread ai?", + query="What are the key features of the Mixedbread embedding model?", input=["Document 1", "Document 2"], ) assert_matches_type(RerankResponse, client_, path=["response"]) @@ -103,10 +103,10 @@ def test_method_rerank(self, client: Mixedbread) -> None: @parametrize def test_method_rerank_with_all_params(self, client: Mixedbread) -> None: client_ = client.rerank( - model="x", - query="What is mixedbread ai?", + model="mixedbread-ai/mxbai-rerank-large-v2", + query="What are the key features of the Mixedbread embedding model?", input=["Document 1", "Document 2"], - rank_fields=["field1", "field2"], + rank_fields=["content", "title"], top_k=10, return_input=False, ) @@ -115,7 +115,7 @@ def test_method_rerank_with_all_params(self, client: Mixedbread) -> None: @parametrize def test_raw_response_rerank(self, client: Mixedbread) -> None: response = client.with_raw_response.rerank( - query="What is mixedbread ai?", + query="What are the key features of the Mixedbread embedding model?", input=["Document 1", "Document 2"], ) @@ -127,7 +127,7 @@ def test_raw_response_rerank(self, client: Mixedbread) -> None: @parametrize def test_streaming_response_rerank(self, client: Mixedbread) -> None: with client.with_streaming_response.rerank( - query="What is mixedbread ai?", + query="What are the key features of the Mixedbread embedding model?", input=["Document 1", "Document 2"], ) as response: assert not response.is_closed @@ -146,7 +146,7 @@ class TestAsyncClient: async def test_method_embed(self, async_client: AsyncMixedbread) -> None: client = await async_client.embed( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) assert_matches_type(EmbeddingCreateResponse, client, path=["response"]) @@ -154,7 +154,7 @@ async def test_method_embed(self, async_client: AsyncMixedbread) -> None: async def test_method_embed_with_all_params(self, async_client: AsyncMixedbread) -> None: client = await async_client.embed( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", dimensions=768, prompt="Provide a detailed summary of the following text.", normalized=True, @@ -166,7 +166,7 @@ async def test_method_embed_with_all_params(self, async_client: AsyncMixedbread) async def test_raw_response_embed(self, async_client: AsyncMixedbread) -> None: response = await async_client.with_raw_response.embed( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) assert response.is_closed is True @@ -178,7 +178,7 @@ async def test_raw_response_embed(self, async_client: AsyncMixedbread) -> None: async def test_streaming_response_embed(self, async_client: AsyncMixedbread) -> None: async with async_client.with_streaming_response.embed( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -216,7 +216,7 @@ async def test_streaming_response_info(self, async_client: AsyncMixedbread) -> N @parametrize async def test_method_rerank(self, async_client: AsyncMixedbread) -> None: client = await async_client.rerank( - query="What is mixedbread ai?", + query="What are the key features of the Mixedbread embedding model?", input=["Document 1", "Document 2"], ) assert_matches_type(RerankResponse, client, path=["response"]) @@ -224,10 +224,10 @@ async def test_method_rerank(self, async_client: AsyncMixedbread) -> None: @parametrize async def test_method_rerank_with_all_params(self, async_client: AsyncMixedbread) -> None: client = await async_client.rerank( - model="x", - query="What is mixedbread ai?", + model="mixedbread-ai/mxbai-rerank-large-v2", + query="What are the key features of the Mixedbread embedding model?", input=["Document 1", "Document 2"], - rank_fields=["field1", "field2"], + rank_fields=["content", "title"], top_k=10, return_input=False, ) @@ -236,7 +236,7 @@ async def test_method_rerank_with_all_params(self, async_client: AsyncMixedbread @parametrize async def test_raw_response_rerank(self, async_client: AsyncMixedbread) -> None: response = await async_client.with_raw_response.rerank( - query="What is mixedbread ai?", + query="What are the key features of the Mixedbread embedding model?", input=["Document 1", "Document 2"], ) @@ -248,7 +248,7 @@ async def test_raw_response_rerank(self, async_client: AsyncMixedbread) -> None: @parametrize async def test_streaming_response_rerank(self, async_client: AsyncMixedbread) -> None: async with async_client.with_streaming_response.rerank( - query="What is mixedbread ai?", + query="What are the key features of the Mixedbread embedding model?", input=["Document 1", "Document 2"], ) as response: assert not response.is_closed diff --git a/tests/api_resources/test_embeddings.py b/tests/api_resources/test_embeddings.py index ffe758eb..9aab6efd 100644 --- a/tests/api_resources/test_embeddings.py +++ b/tests/api_resources/test_embeddings.py @@ -21,7 +21,7 @@ class TestEmbeddings: def test_method_create(self, client: Mixedbread) -> None: embedding = client.embeddings.create( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) @@ -29,7 +29,7 @@ def test_method_create(self, client: Mixedbread) -> None: def test_method_create_with_all_params(self, client: Mixedbread) -> None: embedding = client.embeddings.create( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", dimensions=768, prompt="Provide a detailed summary of the following text.", normalized=True, @@ -41,7 +41,7 @@ def test_method_create_with_all_params(self, client: Mixedbread) -> None: def test_raw_response_create(self, client: Mixedbread) -> None: response = client.embeddings.with_raw_response.create( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) assert response.is_closed is True @@ -53,7 +53,7 @@ def test_raw_response_create(self, client: Mixedbread) -> None: def test_streaming_response_create(self, client: Mixedbread) -> None: with client.embeddings.with_streaming_response.create( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -71,7 +71,7 @@ class TestAsyncEmbeddings: async def test_method_create(self, async_client: AsyncMixedbread) -> None: embedding = await async_client.embeddings.create( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) @@ -79,7 +79,7 @@ async def test_method_create(self, async_client: AsyncMixedbread) -> None: async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None: embedding = await async_client.embeddings.create( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", dimensions=768, prompt="Provide a detailed summary of the following text.", normalized=True, @@ -91,7 +91,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncMixedbread async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None: response = await async_client.embeddings.with_raw_response.create( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) assert response.is_closed is True @@ -103,7 +103,7 @@ async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None: async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None: async with async_client.embeddings.with_streaming_response.create( model="mixedbread-ai/mxbai-embed-large-v1", - input=["string"], + input="x", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python"