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: bfb0b19d1094dc80774c752f9b84185e
config_hash: 52e7472faf7b81b5fda98bd67bd7d0d9
config_hash: 3fa8ca8b7bc0d9e1997e20d7a2e4d22c
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It is generated with [Stainless](https://www.stainless.com/).

## Documentation

The REST API documentation can be found on [mixedbread.ai](https://mixedbread.ai/docs). The full API of this library can be found in [api.md](api.md).
The REST API documentation can be found on [mixedbread.com](https://mixedbread.com/docs). The full API of this library can be found in [api.md](api.md).

## Installation

Expand All @@ -28,7 +28,7 @@ import os
from mixedbread import Mixedbread

client = Mixedbread(
api_key=os.environ.get("MXBAI_API_KEY"), # This is the default and can be omitted
api_key=os.environ.get("MIXEDBREAD_API_KEY"), # This is the default and can be omitted
# defaults to "production".
environment="local",
)
Expand All @@ -39,7 +39,7 @@ print(vector_store.id)

While you can provide an `api_key` keyword argument,
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
to add `MXBAI_API_KEY="My API Key"` to your `.env` file
to add `MIXEDBREAD_API_KEY="My API Key"` to your `.env` file
so that your API Key is not stored in source control.

## Async usage
Expand All @@ -52,7 +52,7 @@ import asyncio
from mixedbread import AsyncMixedbread

client = AsyncMixedbread(
api_key=os.environ.get("MXBAI_API_KEY"), # This is the default and can be omitted
api_key=os.environ.get("MIXEDBREAD_API_KEY"), # This is the default and can be omitted
# defaults to "production".
environment="local",
)
Expand Down
14 changes: 7 additions & 7 deletions src/mixedbread/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
]

ENVIRONMENTS: Dict[str, str] = {
"production": "https://api.mixedbread.ai",
"production": "https://api.mixedbread.com",
"local": "http://127.0.0.1:8000",
}

Expand Down Expand Up @@ -110,13 +110,13 @@ def __init__(
) -> None:
"""Construct a new synchronous Mixedbread client instance.

This automatically infers the `api_key` argument from the `MXBAI_API_KEY` environment variable if it is not provided.
This automatically infers the `api_key` argument from the `MIXEDBREAD_API_KEY` environment variable if it is not provided.
"""
if api_key is None:
api_key = os.environ.get("MXBAI_API_KEY")
api_key = os.environ.get("MIXEDBREAD_API_KEY")
if api_key is None:
raise MixedbreadError(
"The api_key client option must be set either by passing api_key to the client or by setting the MXBAI_API_KEY environment variable"
"The api_key client option must be set either by passing api_key to the client or by setting the MIXEDBREAD_API_KEY environment variable"
)
self.api_key = api_key

Expand Down Expand Up @@ -467,13 +467,13 @@ def __init__(
) -> None:
"""Construct a new async AsyncMixedbread client instance.

This automatically infers the `api_key` argument from the `MXBAI_API_KEY` environment variable if it is not provided.
This automatically infers the `api_key` argument from the `MIXEDBREAD_API_KEY` environment variable if it is not provided.
"""
if api_key is None:
api_key = os.environ.get("MXBAI_API_KEY")
api_key = os.environ.get("MIXEDBREAD_API_KEY")
if api_key is None:
raise MixedbreadError(
"The api_key client option must be set either by passing api_key to the client or by setting the MXBAI_API_KEY environment variable"
"The api_key client option must be set either by passing api_key to the client or by setting the MIXEDBREAD_API_KEY environment variable"
)
self.api_key = api_key

Expand Down
8 changes: 4 additions & 4 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def test_validate_headers(self) -> None:
assert request.headers.get("Authorization") == f"Bearer {api_key}"

with pytest.raises(MixedbreadError):
with update_env(**{"MXBAI_API_KEY": Omit()}):
with update_env(**{"MIXEDBREAD_API_KEY": Omit()}):
client2 = Mixedbread(base_url=base_url, api_key=None, _strict_response_validation=True)
_ = client2

Expand Down Expand Up @@ -568,7 +568,7 @@ def test_base_url_env(self) -> None:
client = Mixedbread(
base_url=None, api_key=api_key, _strict_response_validation=True, environment="production"
)
assert str(client.base_url).startswith("https://api.mixedbread.ai")
assert str(client.base_url).startswith("https://api.mixedbread.com")

@pytest.mark.parametrize(
"client",
Expand Down Expand Up @@ -1122,7 +1122,7 @@ def test_validate_headers(self) -> None:
assert request.headers.get("Authorization") == f"Bearer {api_key}"

with pytest.raises(MixedbreadError):
with update_env(**{"MXBAI_API_KEY": Omit()}):
with update_env(**{"MIXEDBREAD_API_KEY": Omit()}):
client2 = AsyncMixedbread(base_url=base_url, api_key=None, _strict_response_validation=True)
_ = client2

Expand Down Expand Up @@ -1350,7 +1350,7 @@ def test_base_url_env(self) -> None:
client = AsyncMixedbread(
base_url=None, api_key=api_key, _strict_response_validation=True, environment="production"
)
assert str(client.base_url).startswith("https://api.mixedbread.ai")
assert str(client.base_url).startswith("https://api.mixedbread.com")

@pytest.mark.parametrize(
"client",
Expand Down