diff --git a/.stats.yml b/.stats.yml index 2b4d8892..4e673ffb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 20 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-3f27546e184f5e59dc9cd5d81108c5e19ea3a81d628db9da2b3613123afdd3ac.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-c170defce134806965283050e465f10a479c7910a05f17f638f3a0080e47b4c9.yml diff --git a/README.md b/README.md index 596bc1d9..ea6ca8b0 100644 --- a/README.md +++ b/README.md @@ -32,17 +32,13 @@ from mixedbread import Mixedbread client = Mixedbread( # defaults to "production". environment="local", + api_key="My API Key", ) vector_store = client.vector_stores.create() 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 -so that your API Key is not stored in source control. - ## Async usage Simply import `AsyncMixedbread` instead of `Mixedbread` and use `await` with each API call: @@ -54,6 +50,7 @@ from mixedbread import AsyncMixedbread client = AsyncMixedbread( # defaults to "production". environment="local", + api_key="My API Key", ) @@ -85,7 +82,9 @@ This library provides auto-paginating iterators with each list response, so you ```python from mixedbread import Mixedbread -client = Mixedbread() +client = Mixedbread( + api_key="My API Key", +) all_vector_stores = [] # Automatically fetches more pages as needed. @@ -101,7 +100,9 @@ Or, asynchronously: import asyncio from mixedbread import AsyncMixedbread -client = AsyncMixedbread() +client = AsyncMixedbread( + api_key="My API Key", +) async def main() -> None: @@ -154,7 +155,9 @@ All errors inherit from `mixedbread.APIError`. import mixedbread from mixedbread import Mixedbread -client = Mixedbread() +client = Mixedbread( + api_key="My API Key", +) try: client.vector_stores.create() @@ -197,6 +200,7 @@ from mixedbread import Mixedbread client = Mixedbread( # default is 2 max_retries=0, + api_key="My API Key", ) # Or, configure per-request: @@ -215,11 +219,13 @@ from mixedbread import Mixedbread client = Mixedbread( # 20 seconds (default is 1 minute) timeout=20.0, + api_key="My API Key", ) # More granular control: client = Mixedbread( timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0), + api_key="My API Key", ) # Override per-request: @@ -263,7 +269,9 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to ```py from mixedbread import Mixedbread -client = Mixedbread() +client = Mixedbread( + api_key="My API Key", +) response = client.vector_stores.with_raw_response.create() print(response.headers.get('X-My-Header')) @@ -345,6 +353,7 @@ client = Mixedbread( proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0"), ), + api_key="My API Key", ) ``` @@ -361,7 +370,9 @@ By default the library closes underlying HTTP connections whenever the client is ```py from mixedbread import Mixedbread -with Mixedbread() as client: +with Mixedbread( + api_key="My API Key", +) as client: # make requests here ... diff --git a/src/mixedbread/_client.py b/src/mixedbread/_client.py index 62538d99..537e672c 100644 --- a/src/mixedbread/_client.py +++ b/src/mixedbread/_client.py @@ -164,12 +164,6 @@ def __init__( def qs(self) -> Querystring: return Querystring(array_format="comma") - @property - @override - def auth_headers(self) -> dict[str, str]: - api_key = self.api_key - return {"Authorization": api_key} - @property @override def default_headers(self) -> dict[str, str | Omit]: @@ -389,12 +383,6 @@ def __init__( def qs(self) -> Querystring: return Querystring(array_format="comma") - @property - @override - def auth_headers(self) -> dict[str, str]: - api_key = self.api_key - return {"Authorization": api_key} - @property @override def default_headers(self) -> dict[str, str | Omit]: