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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions src/mixedbread/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/mixedbread/resources/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/mixedbread/types/client_embed_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/mixedbread/types/embedding_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
40 changes: 20 additions & 20 deletions tests/api_resources/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ 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"])

@parametrize
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,
Expand All @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -95,18 +95,18 @@ 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"])

@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,
)
Expand All @@ -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"],
)

Expand All @@ -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
Expand All @@ -146,15 +146,15 @@ 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"])

@parametrize
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,
Expand All @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -216,18 +216,18 @@ 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"])

@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,
)
Expand All @@ -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"],
)

Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions tests/api_resources/test_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ 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"])

@parametrize
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,
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -71,15 +71,15 @@ 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"])

@parametrize
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,
Expand All @@ -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
Expand All @@ -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"
Expand Down