From 360dea48d1c7d36ddb7e1a932d9a9ec759441a57 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 15 May 2025 04:58:03 +0000
Subject: [PATCH 1/6] chore(ci): upload sdks to package manager
---
.github/workflows/ci.yml | 24 ++++++++++++++++++++++++
scripts/utils/upload-artifact.sh | 25 +++++++++++++++++++++++++
2 files changed, 49 insertions(+)
create mode 100755 scripts/utils/upload-artifact.sh
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bd8f9862..e42d2173 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -30,6 +30,30 @@ jobs:
- name: Run lints
run: ./scripts/lint
+ upload:
+ if: github.repository == 'stainless-sdks/mixedbread-python'
+ timeout-minutes: 10
+ name: upload
+ permissions:
+ contents: read
+ id-token: write
+ runs-on: depot-ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Get GitHub OIDC Token
+ id: github-oidc
+ uses: actions/github-script@v6
+ with:
+ script: core.setOutput('github_token', await core.getIDToken());
+
+ - name: Upload tarball
+ env:
+ URL: https://pkg.stainless.com/s
+ AUTH: ${{ steps.github-oidc.outputs.github_token }}
+ SHA: ${{ github.sha }}
+ run: ./scripts/utils/upload-artifact.sh
+
test:
timeout-minutes: 10
name: test
diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh
new file mode 100755
index 00000000..4df1bf8c
--- /dev/null
+++ b/scripts/utils/upload-artifact.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+set -exuo pipefail
+
+RESPONSE=$(curl -X POST "$URL" \
+ -H "Authorization: Bearer $AUTH" \
+ -H "Content-Type: application/json")
+
+SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url')
+
+if [[ "$SIGNED_URL" == "null" ]]; then
+ echo -e "\033[31mFailed to get signed URL.\033[0m"
+ exit 1
+fi
+
+UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \
+ -H "Content-Type: application/gzip" \
+ --data-binary @- "$SIGNED_URL" 2>&1)
+
+if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
+ echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
+ echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/mixedbread-python/$SHA'\033[0m"
+else
+ echo -e "\033[31mFailed to upload artifact.\033[0m"
+ exit 1
+fi
From 3b8060de754d0b46c4aed0fb7a1f2fc20584d53d Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 16 May 2025 03:47:59 +0000
Subject: [PATCH 2/6] chore(ci): fix installation instructions
---
scripts/utils/upload-artifact.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh
index 4df1bf8c..e9b57e7c 100755
--- a/scripts/utils/upload-artifact.sh
+++ b/scripts/utils/upload-artifact.sh
@@ -18,7 +18,7 @@ UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
- echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/mixedbread-python/$SHA'\033[0m"
+ echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/mixedbread-python/$SHA'\033[0m"
else
echo -e "\033[31mFailed to upload artifact.\033[0m"
exit 1
From e3faf933f1278eec744ffdbe59202388c756791b Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 22 May 2025 02:36:17 +0000
Subject: [PATCH 3/6] chore(docs): grammar improvements
---
SECURITY.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/SECURITY.md b/SECURITY.md
index 7a1bc651..9485d544 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -16,13 +16,13 @@ before making any information public.
## Reporting Non-SDK Related Security Issues
If you encounter security issues that are not directly related to SDKs but pertain to the services
-or products provided by Mixedbread please follow the respective company's security reporting guidelines.
+or products provided by Mixedbread, please follow the respective company's security reporting guidelines.
### Mixedbread Terms and Policies
Our Security Policy can be found at [Security Policy URL](https://mixedbread.com/pages/privacy).
-Please contact support@mixedbread.com for any questions or concerns regarding security of our services.
+Please contact support@mixedbread.com for any questions or concerns regarding the security of our services.
---
From 19da79023946597097d740650d1ff3af76839201 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 26 May 2025 12:30:05 +0000
Subject: [PATCH 4/6] feat(api): update via SDK Studio
---
.stats.yml | 4 +-
api.md | 56 ++
src/mixedbread/_client.py | 19 +-
src/mixedbread/resources/__init__.py | 28 +
src/mixedbread/resources/chat.py | 164 ++++
.../resources/data_sources/__init__.py | 33 +
.../resources/data_sources/connectors.py | 712 ++++++++++++++++++
.../resources/data_sources/data_sources.py | 663 ++++++++++++++++
src/mixedbread/types/__init__.py | 8 +
.../types/data_source_create_params.py | 56 ++
.../types/data_source_create_response.py | 66 ++
.../types/data_source_delete_response.py | 19 +
.../types/data_source_list_params.py | 15 +
.../types/data_source_list_response.py | 66 ++
.../types/data_source_retrieve_response.py | 66 ++
.../types/data_source_update_params.py | 53 ++
.../types/data_source_update_response.py | 66 ++
src/mixedbread/types/data_sources/__init__.py | 12 +
.../data_sources/connector_create_params.py | 25 +
.../data_sources/connector_create_response.py | 53 ++
.../data_sources/connector_delete_response.py | 19 +
.../data_sources/connector_list_params.py | 15 +
.../data_sources/connector_list_response.py | 53 ++
.../connector_retrieve_response.py | 53 ++
.../data_sources/connector_update_params.py | 25 +
.../data_sources/connector_update_response.py | 53 ++
tests/api_resources/data_sources/__init__.py | 1 +
.../data_sources/test_connectors.py | 543 +++++++++++++
tests/api_resources/test_chat.py | 71 ++
tests/api_resources/test_data_sources.py | 476 ++++++++++++
30 files changed, 3490 insertions(+), 3 deletions(-)
create mode 100644 src/mixedbread/resources/chat.py
create mode 100644 src/mixedbread/resources/data_sources/__init__.py
create mode 100644 src/mixedbread/resources/data_sources/connectors.py
create mode 100644 src/mixedbread/resources/data_sources/data_sources.py
create mode 100644 src/mixedbread/types/data_source_create_params.py
create mode 100644 src/mixedbread/types/data_source_create_response.py
create mode 100644 src/mixedbread/types/data_source_delete_response.py
create mode 100644 src/mixedbread/types/data_source_list_params.py
create mode 100644 src/mixedbread/types/data_source_list_response.py
create mode 100644 src/mixedbread/types/data_source_retrieve_response.py
create mode 100644 src/mixedbread/types/data_source_update_params.py
create mode 100644 src/mixedbread/types/data_source_update_response.py
create mode 100644 src/mixedbread/types/data_sources/__init__.py
create mode 100644 src/mixedbread/types/data_sources/connector_create_params.py
create mode 100644 src/mixedbread/types/data_sources/connector_create_response.py
create mode 100644 src/mixedbread/types/data_sources/connector_delete_response.py
create mode 100644 src/mixedbread/types/data_sources/connector_list_params.py
create mode 100644 src/mixedbread/types/data_sources/connector_list_response.py
create mode 100644 src/mixedbread/types/data_sources/connector_retrieve_response.py
create mode 100644 src/mixedbread/types/data_sources/connector_update_params.py
create mode 100644 src/mixedbread/types/data_sources/connector_update_response.py
create mode 100644 tests/api_resources/data_sources/__init__.py
create mode 100644 tests/api_resources/data_sources/test_connectors.py
create mode 100644 tests/api_resources/test_chat.py
create mode 100644 tests/api_resources/test_data_sources.py
diff --git a/.stats.yml b/.stats.yml
index dc5b9a3b..2aac0f69 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 32
+configured_endpoints: 43
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-82c2c1c322149cd73b2e8e45f475919b941752a89e74464ccecd1aee9352e9be.yml
openapi_spec_hash: f6661e9fafda26e7e9f3fc06739a33ad
-config_hash: 6a7c1faa96b022a6959d720d7957eade
+config_hash: 70d47aa4a1dd8327383138a26d47d21a
diff --git a/api.md b/api.md
index 2844a12f..141e338e 100644
--- a/api.md
+++ b/api.md
@@ -154,3 +154,59 @@ Methods:
Methods:
- client.embeddings.create(\*\*params) -> EmbeddingCreateResponse
+
+# Chat
+
+Types:
+
+```python
+from mixedbread.types import ChatCreateCompletionResponse
+```
+
+Methods:
+
+- client.chat.create_completion() -> object
+
+# DataSources
+
+Types:
+
+```python
+from mixedbread.types import (
+ DataSourceCreateResponse,
+ DataSourceRetrieveResponse,
+ DataSourceUpdateResponse,
+ DataSourceListResponse,
+ DataSourceDeleteResponse,
+)
+```
+
+Methods:
+
+- client.data_sources.create(\*\*params) -> DataSourceCreateResponse
+- client.data_sources.retrieve(data_source_id) -> DataSourceRetrieveResponse
+- client.data_sources.update(data_source_id, \*\*params) -> DataSourceUpdateResponse
+- client.data_sources.list(\*\*params) -> SyncLimitOffset[DataSourceListResponse]
+- client.data_sources.delete(data_source_id) -> DataSourceDeleteResponse
+
+## Connectors
+
+Types:
+
+```python
+from mixedbread.types.data_sources import (
+ ConnectorCreateResponse,
+ ConnectorRetrieveResponse,
+ ConnectorUpdateResponse,
+ ConnectorListResponse,
+ ConnectorDeleteResponse,
+)
+```
+
+Methods:
+
+- client.data_sources.connectors.create(data_source_id, \*\*params) -> ConnectorCreateResponse
+- client.data_sources.connectors.retrieve(connector_id, \*, data_source_id) -> ConnectorRetrieveResponse
+- client.data_sources.connectors.update(connector_id, \*, data_source_id, \*\*params) -> ConnectorUpdateResponse
+- client.data_sources.connectors.list(data_source_id, \*\*params) -> SyncLimitOffset[ConnectorListResponse]
+- client.data_sources.connectors.delete(connector_id, \*, data_source_id) -> ConnectorDeleteResponse
diff --git a/src/mixedbread/_client.py b/src/mixedbread/_client.py
index efe87763..082f61ef 100644
--- a/src/mixedbread/_client.py
+++ b/src/mixedbread/_client.py
@@ -36,7 +36,7 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
-from .resources import files, embeddings
+from .resources import chat, files, embeddings
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import APIStatusError, MixedbreadError
from ._base_client import (
@@ -49,6 +49,7 @@
from .types.info_response import InfoResponse
from .resources.extractions import extractions
from .types.rerank_response import RerankResponse
+from .resources.data_sources import data_sources
from .resources.vector_stores import vector_stores
from .types.embedding_create_response import EmbeddingCreateResponse
@@ -76,6 +77,8 @@ class Mixedbread(SyncAPIClient):
files: files.FilesResource
extractions: extractions.ExtractionsResource
embeddings: embeddings.EmbeddingsResource
+ chat: chat.ChatResource
+ data_sources: data_sources.DataSourcesResource
with_raw_response: MixedbreadWithRawResponse
with_streaming_response: MixedbreadWithStreamedResponse
@@ -162,6 +165,8 @@ def __init__(
self.files = files.FilesResource(self)
self.extractions = extractions.ExtractionsResource(self)
self.embeddings = embeddings.EmbeddingsResource(self)
+ self.chat = chat.ChatResource(self)
+ self.data_sources = data_sources.DataSourcesResource(self)
self.with_raw_response = MixedbreadWithRawResponse(self)
self.with_streaming_response = MixedbreadWithStreamedResponse(self)
@@ -437,6 +442,8 @@ class AsyncMixedbread(AsyncAPIClient):
files: files.AsyncFilesResource
extractions: extractions.AsyncExtractionsResource
embeddings: embeddings.AsyncEmbeddingsResource
+ chat: chat.AsyncChatResource
+ data_sources: data_sources.AsyncDataSourcesResource
with_raw_response: AsyncMixedbreadWithRawResponse
with_streaming_response: AsyncMixedbreadWithStreamedResponse
@@ -523,6 +530,8 @@ def __init__(
self.files = files.AsyncFilesResource(self)
self.extractions = extractions.AsyncExtractionsResource(self)
self.embeddings = embeddings.AsyncEmbeddingsResource(self)
+ self.chat = chat.AsyncChatResource(self)
+ self.data_sources = data_sources.AsyncDataSourcesResource(self)
self.with_raw_response = AsyncMixedbreadWithRawResponse(self)
self.with_streaming_response = AsyncMixedbreadWithStreamedResponse(self)
@@ -799,6 +808,8 @@ def __init__(self, client: Mixedbread) -> None:
self.files = files.FilesResourceWithRawResponse(client.files)
self.extractions = extractions.ExtractionsResourceWithRawResponse(client.extractions)
self.embeddings = embeddings.EmbeddingsResourceWithRawResponse(client.embeddings)
+ self.chat = chat.ChatResourceWithRawResponse(client.chat)
+ self.data_sources = data_sources.DataSourcesResourceWithRawResponse(client.data_sources)
self.embed = to_raw_response_wrapper(
client.embed,
@@ -818,6 +829,8 @@ def __init__(self, client: AsyncMixedbread) -> None:
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
self.extractions = extractions.AsyncExtractionsResourceWithRawResponse(client.extractions)
self.embeddings = embeddings.AsyncEmbeddingsResourceWithRawResponse(client.embeddings)
+ self.chat = chat.AsyncChatResourceWithRawResponse(client.chat)
+ self.data_sources = data_sources.AsyncDataSourcesResourceWithRawResponse(client.data_sources)
self.embed = async_to_raw_response_wrapper(
client.embed,
@@ -837,6 +850,8 @@ def __init__(self, client: Mixedbread) -> None:
self.files = files.FilesResourceWithStreamingResponse(client.files)
self.extractions = extractions.ExtractionsResourceWithStreamingResponse(client.extractions)
self.embeddings = embeddings.EmbeddingsResourceWithStreamingResponse(client.embeddings)
+ self.chat = chat.ChatResourceWithStreamingResponse(client.chat)
+ self.data_sources = data_sources.DataSourcesResourceWithStreamingResponse(client.data_sources)
self.embed = to_streamed_response_wrapper(
client.embed,
@@ -856,6 +871,8 @@ def __init__(self, client: AsyncMixedbread) -> None:
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
self.extractions = extractions.AsyncExtractionsResourceWithStreamingResponse(client.extractions)
self.embeddings = embeddings.AsyncEmbeddingsResourceWithStreamingResponse(client.embeddings)
+ self.chat = chat.AsyncChatResourceWithStreamingResponse(client.chat)
+ self.data_sources = data_sources.AsyncDataSourcesResourceWithStreamingResponse(client.data_sources)
self.embed = async_to_streamed_response_wrapper(
client.embed,
diff --git a/src/mixedbread/resources/__init__.py b/src/mixedbread/resources/__init__.py
index 7df49504..21f67148 100644
--- a/src/mixedbread/resources/__init__.py
+++ b/src/mixedbread/resources/__init__.py
@@ -1,5 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+from .chat import (
+ ChatResource,
+ AsyncChatResource,
+ ChatResourceWithRawResponse,
+ AsyncChatResourceWithRawResponse,
+ ChatResourceWithStreamingResponse,
+ AsyncChatResourceWithStreamingResponse,
+)
from .files import (
FilesResource,
AsyncFilesResource,
@@ -32,6 +40,14 @@
ExtractionsResourceWithStreamingResponse,
AsyncExtractionsResourceWithStreamingResponse,
)
+from .data_sources import (
+ DataSourcesResource,
+ AsyncDataSourcesResource,
+ DataSourcesResourceWithRawResponse,
+ AsyncDataSourcesResourceWithRawResponse,
+ DataSourcesResourceWithStreamingResponse,
+ AsyncDataSourcesResourceWithStreamingResponse,
+)
from .vector_stores import (
VectorStoresResource,
AsyncVectorStoresResource,
@@ -72,4 +88,16 @@
"AsyncEmbeddingsResourceWithRawResponse",
"EmbeddingsResourceWithStreamingResponse",
"AsyncEmbeddingsResourceWithStreamingResponse",
+ "ChatResource",
+ "AsyncChatResource",
+ "ChatResourceWithRawResponse",
+ "AsyncChatResourceWithRawResponse",
+ "ChatResourceWithStreamingResponse",
+ "AsyncChatResourceWithStreamingResponse",
+ "DataSourcesResource",
+ "AsyncDataSourcesResource",
+ "DataSourcesResourceWithRawResponse",
+ "AsyncDataSourcesResourceWithRawResponse",
+ "DataSourcesResourceWithStreamingResponse",
+ "AsyncDataSourcesResourceWithStreamingResponse",
]
diff --git a/src/mixedbread/resources/chat.py b/src/mixedbread/resources/chat.py
new file mode 100644
index 00000000..f9b1b0ce
--- /dev/null
+++ b/src/mixedbread/resources/chat.py
@@ -0,0 +1,164 @@
+# 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__ = ["ChatResource", "AsyncChatResource"]
+
+
+class ChatResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> ChatResourceWithRawResponse:
+ """
+ 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 ChatResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> ChatResourceWithStreamingResponse:
+ """
+ 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 ChatResourceWithStreamingResponse(self)
+
+ def create_completion(
+ 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 AsyncChatResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncChatResourceWithRawResponse:
+ """
+ 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 AsyncChatResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncChatResourceWithStreamingResponse:
+ """
+ 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 AsyncChatResourceWithStreamingResponse(self)
+
+ async def create_completion(
+ 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 ChatResourceWithRawResponse:
+ def __init__(self, chat: ChatResource) -> None:
+ self._chat = chat
+
+ self.create_completion = to_raw_response_wrapper(
+ chat.create_completion,
+ )
+
+
+class AsyncChatResourceWithRawResponse:
+ def __init__(self, chat: AsyncChatResource) -> None:
+ self._chat = chat
+
+ self.create_completion = async_to_raw_response_wrapper(
+ chat.create_completion,
+ )
+
+
+class ChatResourceWithStreamingResponse:
+ def __init__(self, chat: ChatResource) -> None:
+ self._chat = chat
+
+ self.create_completion = to_streamed_response_wrapper(
+ chat.create_completion,
+ )
+
+
+class AsyncChatResourceWithStreamingResponse:
+ def __init__(self, chat: AsyncChatResource) -> None:
+ self._chat = chat
+
+ self.create_completion = async_to_streamed_response_wrapper(
+ chat.create_completion,
+ )
diff --git a/src/mixedbread/resources/data_sources/__init__.py b/src/mixedbread/resources/data_sources/__init__.py
new file mode 100644
index 00000000..6e04f6ec
--- /dev/null
+++ b/src/mixedbread/resources/data_sources/__init__.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .connectors import (
+ ConnectorsResource,
+ AsyncConnectorsResource,
+ ConnectorsResourceWithRawResponse,
+ AsyncConnectorsResourceWithRawResponse,
+ ConnectorsResourceWithStreamingResponse,
+ AsyncConnectorsResourceWithStreamingResponse,
+)
+from .data_sources import (
+ DataSourcesResource,
+ AsyncDataSourcesResource,
+ DataSourcesResourceWithRawResponse,
+ AsyncDataSourcesResourceWithRawResponse,
+ DataSourcesResourceWithStreamingResponse,
+ AsyncDataSourcesResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "ConnectorsResource",
+ "AsyncConnectorsResource",
+ "ConnectorsResourceWithRawResponse",
+ "AsyncConnectorsResourceWithRawResponse",
+ "ConnectorsResourceWithStreamingResponse",
+ "AsyncConnectorsResourceWithStreamingResponse",
+ "DataSourcesResource",
+ "AsyncDataSourcesResource",
+ "DataSourcesResourceWithRawResponse",
+ "AsyncDataSourcesResourceWithRawResponse",
+ "DataSourcesResourceWithStreamingResponse",
+ "AsyncDataSourcesResourceWithStreamingResponse",
+]
diff --git a/src/mixedbread/resources/data_sources/connectors.py b/src/mixedbread/resources/data_sources/connectors.py
new file mode 100644
index 00000000..f05318ee
--- /dev/null
+++ b/src/mixedbread/resources/data_sources/connectors.py
@@ -0,0 +1,712 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Dict, Optional
+
+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 ...pagination import SyncLimitOffset, AsyncLimitOffset
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.data_sources import connector_list_params, connector_create_params, connector_update_params
+from ...types.data_sources.connector_list_response import ConnectorListResponse
+from ...types.data_sources.connector_create_response import ConnectorCreateResponse
+from ...types.data_sources.connector_delete_response import ConnectorDeleteResponse
+from ...types.data_sources.connector_update_response import ConnectorUpdateResponse
+from ...types.data_sources.connector_retrieve_response import ConnectorRetrieveResponse
+
+__all__ = ["ConnectorsResource", "AsyncConnectorsResource"]
+
+
+class ConnectorsResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> ConnectorsResourceWithRawResponse:
+ """
+ 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 ConnectorsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> ConnectorsResourceWithStreamingResponse:
+ """
+ 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 ConnectorsResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ data_source_id: str,
+ *,
+ vector_store_id: str,
+ name: str | NotGiven = NOT_GIVEN,
+ trigger_sync: bool | NotGiven = NOT_GIVEN,
+ metadata: object | NotGiven = NOT_GIVEN,
+ polling_interval: 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,
+ ) -> ConnectorCreateResponse:
+ """
+ Create a new connector.
+
+ Args: data_source_id: The ID of the data source to create a connector for.
+ params: The connector to create.
+
+ Returns: The created connector.
+
+ Args:
+ data_source_id: The ID of the data source to create a connector for
+
+ vector_store_id: The ID of the vector store
+
+ name: The name of the connector
+
+ trigger_sync: Whether the connector should be synced after creation
+
+ metadata: The metadata of the connector
+
+ polling_interval: The polling interval of the connector
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ return self._post(
+ f"/v1/data_sources/{data_source_id}/connectors",
+ body=maybe_transform(
+ {
+ "vector_store_id": vector_store_id,
+ "name": name,
+ "trigger_sync": trigger_sync,
+ "metadata": metadata,
+ "polling_interval": polling_interval,
+ },
+ connector_create_params.ConnectorCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=ConnectorCreateResponse,
+ )
+
+ def retrieve(
+ self,
+ connector_id: str,
+ *,
+ data_source_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,
+ ) -> ConnectorRetrieveResponse:
+ """
+ Get a connector by ID.
+
+ Args: data_source_id: The ID of the data source to get a connector for.
+ connector_id: The ID of the connector to get.
+
+ Returns: The connector.
+
+ Args:
+ data_source_id: The ID of the data source to get a connector for
+
+ connector_id: The ID of the connector to get
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ if not connector_id:
+ raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
+ return self._get(
+ f"/v1/data_sources/{data_source_id}/connectors/{connector_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=ConnectorRetrieveResponse,
+ )
+
+ def update(
+ self,
+ connector_id: str,
+ *,
+ data_source_id: str,
+ name: Optional[str] | NotGiven = NOT_GIVEN,
+ metadata: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
+ trigger_sync: Optional[bool] | NotGiven = NOT_GIVEN,
+ polling_interval: 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,
+ ) -> ConnectorUpdateResponse:
+ """
+ Update a connector.
+
+ Args: data_source_id: The ID of the data source to update a connector for.
+ connector_id: The ID of the connector to update. params: The connector to
+ update.
+
+ Returns: The updated connector.
+
+ Args:
+ data_source_id: The ID of the data source to update a connector for
+
+ connector_id: The ID of the connector to update
+
+ name: The name of the connector
+
+ metadata: The metadata of the connector
+
+ trigger_sync: Whether the connector should be synced after update
+
+ polling_interval: The polling interval of the connector
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ if not connector_id:
+ raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
+ return self._put(
+ f"/v1/data_sources/{data_source_id}/connectors/{connector_id}",
+ body=maybe_transform(
+ {
+ "name": name,
+ "metadata": metadata,
+ "trigger_sync": trigger_sync,
+ "polling_interval": polling_interval,
+ },
+ connector_update_params.ConnectorUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=ConnectorUpdateResponse,
+ )
+
+ def list(
+ self,
+ data_source_id: str,
+ *,
+ limit: int | NotGiven = NOT_GIVEN,
+ offset: 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,
+ ) -> SyncLimitOffset[ConnectorListResponse]:
+ """
+ Get all connectors for a data source.
+
+ Args: data_source_id: The ID of the data source to get connectors for.
+ pagination: The pagination options.
+
+ Returns: The list of connectors.
+
+ Args:
+ data_source_id: The ID of the data source to get connectors for
+
+ limit: Maximum number of items to return per page
+
+ offset: Offset of the first item 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
+ """
+ if not data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ return self._get_api_list(
+ f"/v1/data_sources/{data_source_id}/connectors",
+ page=SyncLimitOffset[ConnectorListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "limit": limit,
+ "offset": offset,
+ },
+ connector_list_params.ConnectorListParams,
+ ),
+ ),
+ model=ConnectorListResponse,
+ )
+
+ def delete(
+ self,
+ connector_id: str,
+ *,
+ data_source_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,
+ ) -> ConnectorDeleteResponse:
+ """
+ Delete a connector.
+
+ Args: data_source_id: The ID of the data source to delete a connector for.
+ connector_id: The ID of the connector to delete.
+
+ Returns: The deleted connector.
+
+ Args:
+ data_source_id: The ID of the data source to delete a connector for
+
+ connector_id: The ID of the connector to delete
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ if not connector_id:
+ raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
+ return self._delete(
+ f"/v1/data_sources/{data_source_id}/connectors/{connector_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=ConnectorDeleteResponse,
+ )
+
+
+class AsyncConnectorsResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncConnectorsResourceWithRawResponse:
+ """
+ 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 AsyncConnectorsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncConnectorsResourceWithStreamingResponse:
+ """
+ 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 AsyncConnectorsResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ data_source_id: str,
+ *,
+ vector_store_id: str,
+ name: str | NotGiven = NOT_GIVEN,
+ trigger_sync: bool | NotGiven = NOT_GIVEN,
+ metadata: object | NotGiven = NOT_GIVEN,
+ polling_interval: 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,
+ ) -> ConnectorCreateResponse:
+ """
+ Create a new connector.
+
+ Args: data_source_id: The ID of the data source to create a connector for.
+ params: The connector to create.
+
+ Returns: The created connector.
+
+ Args:
+ data_source_id: The ID of the data source to create a connector for
+
+ vector_store_id: The ID of the vector store
+
+ name: The name of the connector
+
+ trigger_sync: Whether the connector should be synced after creation
+
+ metadata: The metadata of the connector
+
+ polling_interval: The polling interval of the connector
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ return await self._post(
+ f"/v1/data_sources/{data_source_id}/connectors",
+ body=await async_maybe_transform(
+ {
+ "vector_store_id": vector_store_id,
+ "name": name,
+ "trigger_sync": trigger_sync,
+ "metadata": metadata,
+ "polling_interval": polling_interval,
+ },
+ connector_create_params.ConnectorCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=ConnectorCreateResponse,
+ )
+
+ async def retrieve(
+ self,
+ connector_id: str,
+ *,
+ data_source_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,
+ ) -> ConnectorRetrieveResponse:
+ """
+ Get a connector by ID.
+
+ Args: data_source_id: The ID of the data source to get a connector for.
+ connector_id: The ID of the connector to get.
+
+ Returns: The connector.
+
+ Args:
+ data_source_id: The ID of the data source to get a connector for
+
+ connector_id: The ID of the connector to get
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ if not connector_id:
+ raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
+ return await self._get(
+ f"/v1/data_sources/{data_source_id}/connectors/{connector_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=ConnectorRetrieveResponse,
+ )
+
+ async def update(
+ self,
+ connector_id: str,
+ *,
+ data_source_id: str,
+ name: Optional[str] | NotGiven = NOT_GIVEN,
+ metadata: Optional[Dict[str, object]] | NotGiven = NOT_GIVEN,
+ trigger_sync: Optional[bool] | NotGiven = NOT_GIVEN,
+ polling_interval: 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,
+ ) -> ConnectorUpdateResponse:
+ """
+ Update a connector.
+
+ Args: data_source_id: The ID of the data source to update a connector for.
+ connector_id: The ID of the connector to update. params: The connector to
+ update.
+
+ Returns: The updated connector.
+
+ Args:
+ data_source_id: The ID of the data source to update a connector for
+
+ connector_id: The ID of the connector to update
+
+ name: The name of the connector
+
+ metadata: The metadata of the connector
+
+ trigger_sync: Whether the connector should be synced after update
+
+ polling_interval: The polling interval of the connector
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ if not connector_id:
+ raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
+ return await self._put(
+ f"/v1/data_sources/{data_source_id}/connectors/{connector_id}",
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "metadata": metadata,
+ "trigger_sync": trigger_sync,
+ "polling_interval": polling_interval,
+ },
+ connector_update_params.ConnectorUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=ConnectorUpdateResponse,
+ )
+
+ def list(
+ self,
+ data_source_id: str,
+ *,
+ limit: int | NotGiven = NOT_GIVEN,
+ offset: 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,
+ ) -> AsyncPaginator[ConnectorListResponse, AsyncLimitOffset[ConnectorListResponse]]:
+ """
+ Get all connectors for a data source.
+
+ Args: data_source_id: The ID of the data source to get connectors for.
+ pagination: The pagination options.
+
+ Returns: The list of connectors.
+
+ Args:
+ data_source_id: The ID of the data source to get connectors for
+
+ limit: Maximum number of items to return per page
+
+ offset: Offset of the first item 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
+ """
+ if not data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ return self._get_api_list(
+ f"/v1/data_sources/{data_source_id}/connectors",
+ page=AsyncLimitOffset[ConnectorListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "limit": limit,
+ "offset": offset,
+ },
+ connector_list_params.ConnectorListParams,
+ ),
+ ),
+ model=ConnectorListResponse,
+ )
+
+ async def delete(
+ self,
+ connector_id: str,
+ *,
+ data_source_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,
+ ) -> ConnectorDeleteResponse:
+ """
+ Delete a connector.
+
+ Args: data_source_id: The ID of the data source to delete a connector for.
+ connector_id: The ID of the connector to delete.
+
+ Returns: The deleted connector.
+
+ Args:
+ data_source_id: The ID of the data source to delete a connector for
+
+ connector_id: The ID of the connector to delete
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ if not connector_id:
+ raise ValueError(f"Expected a non-empty value for `connector_id` but received {connector_id!r}")
+ return await self._delete(
+ f"/v1/data_sources/{data_source_id}/connectors/{connector_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=ConnectorDeleteResponse,
+ )
+
+
+class ConnectorsResourceWithRawResponse:
+ def __init__(self, connectors: ConnectorsResource) -> None:
+ self._connectors = connectors
+
+ self.create = to_raw_response_wrapper(
+ connectors.create,
+ )
+ self.retrieve = to_raw_response_wrapper(
+ connectors.retrieve,
+ )
+ self.update = to_raw_response_wrapper(
+ connectors.update,
+ )
+ self.list = to_raw_response_wrapper(
+ connectors.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ connectors.delete,
+ )
+
+
+class AsyncConnectorsResourceWithRawResponse:
+ def __init__(self, connectors: AsyncConnectorsResource) -> None:
+ self._connectors = connectors
+
+ self.create = async_to_raw_response_wrapper(
+ connectors.create,
+ )
+ self.retrieve = async_to_raw_response_wrapper(
+ connectors.retrieve,
+ )
+ self.update = async_to_raw_response_wrapper(
+ connectors.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ connectors.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ connectors.delete,
+ )
+
+
+class ConnectorsResourceWithStreamingResponse:
+ def __init__(self, connectors: ConnectorsResource) -> None:
+ self._connectors = connectors
+
+ self.create = to_streamed_response_wrapper(
+ connectors.create,
+ )
+ self.retrieve = to_streamed_response_wrapper(
+ connectors.retrieve,
+ )
+ self.update = to_streamed_response_wrapper(
+ connectors.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ connectors.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ connectors.delete,
+ )
+
+
+class AsyncConnectorsResourceWithStreamingResponse:
+ def __init__(self, connectors: AsyncConnectorsResource) -> None:
+ self._connectors = connectors
+
+ self.create = async_to_streamed_response_wrapper(
+ connectors.create,
+ )
+ self.retrieve = async_to_streamed_response_wrapper(
+ connectors.retrieve,
+ )
+ self.update = async_to_streamed_response_wrapper(
+ connectors.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ connectors.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ connectors.delete,
+ )
diff --git a/src/mixedbread/resources/data_sources/data_sources.py b/src/mixedbread/resources/data_sources/data_sources.py
new file mode 100644
index 00000000..e0a0d125
--- /dev/null
+++ b/src/mixedbread/resources/data_sources/data_sources.py
@@ -0,0 +1,663 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Optional
+from typing_extensions import Literal
+
+import httpx
+
+from ...types import data_source_list_params, data_source_create_params, data_source_update_params
+from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._utils import maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from .connectors import (
+ ConnectorsResource,
+ AsyncConnectorsResource,
+ ConnectorsResourceWithRawResponse,
+ AsyncConnectorsResourceWithRawResponse,
+ ConnectorsResourceWithStreamingResponse,
+ AsyncConnectorsResourceWithStreamingResponse,
+)
+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 ...pagination import SyncLimitOffset, AsyncLimitOffset
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.data_source_list_response import DataSourceListResponse
+from ...types.data_source_create_response import DataSourceCreateResponse
+from ...types.data_source_delete_response import DataSourceDeleteResponse
+from ...types.data_source_update_response import DataSourceUpdateResponse
+from ...types.data_source_retrieve_response import DataSourceRetrieveResponse
+
+__all__ = ["DataSourcesResource", "AsyncDataSourcesResource"]
+
+
+class DataSourcesResource(SyncAPIResource):
+ @cached_property
+ def connectors(self) -> ConnectorsResource:
+ return ConnectorsResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> DataSourcesResourceWithRawResponse:
+ """
+ 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 DataSourcesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> DataSourcesResourceWithStreamingResponse:
+ """
+ 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 DataSourcesResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ type: Literal["notion", "linear"],
+ name: str,
+ metadata: object | NotGiven = NOT_GIVEN,
+ auth_params: Optional[data_source_create_params.AuthParams] | 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,
+ ) -> DataSourceCreateResponse:
+ """
+ Create a new data source.
+
+ Args: params: The data source to create.
+
+ Returns: The created data source.
+
+ Args:
+ type: The type of data source to create
+
+ name: The name of the data source
+
+ metadata: The metadata of the data source
+
+ auth_params: Authentication parameters for a OAuth data source.
+
+ 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/data_sources/",
+ body=maybe_transform(
+ {
+ "type": type,
+ "name": name,
+ "metadata": metadata,
+ "auth_params": auth_params,
+ },
+ data_source_create_params.DataSourceCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DataSourceCreateResponse,
+ )
+
+ def retrieve(
+ self,
+ data_source_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,
+ ) -> DataSourceRetrieveResponse:
+ """
+ Get a data source by ID.
+
+ Args: data_source_id: The ID of the data source to fetch.
+
+ Returns: The data source.
+
+ Args:
+ data_source_id: The ID of the data source to fetch
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ return self._get(
+ f"/v1/data_sources/{data_source_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DataSourceRetrieveResponse,
+ )
+
+ def update(
+ self,
+ data_source_id: str,
+ *,
+ name: Optional[str] | NotGiven = NOT_GIVEN,
+ metadata: object | NotGiven = NOT_GIVEN,
+ auth_params: Optional[data_source_update_params.AuthParams] | 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,
+ ) -> DataSourceUpdateResponse:
+ """Update a data source.
+
+ Args: data_source_id: The ID of the data source to update.
+
+ params: The data
+ source to update.
+
+ Returns: The updated data source.
+
+ Args:
+ data_source_id: The ID of the data source to update
+
+ name: The name of the data source
+
+ metadata: The metadata of the data source
+
+ auth_params: Authentication parameters for a OAuth data source.
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ return self._put(
+ f"/v1/data_sources/{data_source_id}",
+ body=maybe_transform(
+ {
+ "name": name,
+ "metadata": metadata,
+ "auth_params": auth_params,
+ },
+ data_source_update_params.DataSourceUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DataSourceUpdateResponse,
+ )
+
+ def list(
+ self,
+ *,
+ limit: int | NotGiven = NOT_GIVEN,
+ offset: 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,
+ ) -> SyncLimitOffset[DataSourceListResponse]:
+ """
+ Get all data sources.
+
+ Returns: The list of data sources.
+
+ Args:
+ limit: Maximum number of items to return per page
+
+ offset: Offset of the first item 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._get_api_list(
+ "/v1/data_sources/",
+ page=SyncLimitOffset[DataSourceListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "limit": limit,
+ "offset": offset,
+ },
+ data_source_list_params.DataSourceListParams,
+ ),
+ ),
+ model=DataSourceListResponse,
+ )
+
+ def delete(
+ self,
+ data_source_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,
+ ) -> DataSourceDeleteResponse:
+ """
+ Delete a data source.
+
+ Args: data_source_id: The ID of the data source to delete.
+
+ Args:
+ data_source_id: The ID of the data source to delete
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ return self._delete(
+ f"/v1/data_sources/{data_source_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DataSourceDeleteResponse,
+ )
+
+
+class AsyncDataSourcesResource(AsyncAPIResource):
+ @cached_property
+ def connectors(self) -> AsyncConnectorsResource:
+ return AsyncConnectorsResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncDataSourcesResourceWithRawResponse:
+ """
+ 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 AsyncDataSourcesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncDataSourcesResourceWithStreamingResponse:
+ """
+ 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 AsyncDataSourcesResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ type: Literal["notion", "linear"],
+ name: str,
+ metadata: object | NotGiven = NOT_GIVEN,
+ auth_params: Optional[data_source_create_params.AuthParams] | 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,
+ ) -> DataSourceCreateResponse:
+ """
+ Create a new data source.
+
+ Args: params: The data source to create.
+
+ Returns: The created data source.
+
+ Args:
+ type: The type of data source to create
+
+ name: The name of the data source
+
+ metadata: The metadata of the data source
+
+ auth_params: Authentication parameters for a OAuth data source.
+
+ 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/data_sources/",
+ body=await async_maybe_transform(
+ {
+ "type": type,
+ "name": name,
+ "metadata": metadata,
+ "auth_params": auth_params,
+ },
+ data_source_create_params.DataSourceCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DataSourceCreateResponse,
+ )
+
+ async def retrieve(
+ self,
+ data_source_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,
+ ) -> DataSourceRetrieveResponse:
+ """
+ Get a data source by ID.
+
+ Args: data_source_id: The ID of the data source to fetch.
+
+ Returns: The data source.
+
+ Args:
+ data_source_id: The ID of the data source to fetch
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ return await self._get(
+ f"/v1/data_sources/{data_source_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DataSourceRetrieveResponse,
+ )
+
+ async def update(
+ self,
+ data_source_id: str,
+ *,
+ name: Optional[str] | NotGiven = NOT_GIVEN,
+ metadata: object | NotGiven = NOT_GIVEN,
+ auth_params: Optional[data_source_update_params.AuthParams] | 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,
+ ) -> DataSourceUpdateResponse:
+ """Update a data source.
+
+ Args: data_source_id: The ID of the data source to update.
+
+ params: The data
+ source to update.
+
+ Returns: The updated data source.
+
+ Args:
+ data_source_id: The ID of the data source to update
+
+ name: The name of the data source
+
+ metadata: The metadata of the data source
+
+ auth_params: Authentication parameters for a OAuth data source.
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ return await self._put(
+ f"/v1/data_sources/{data_source_id}",
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "metadata": metadata,
+ "auth_params": auth_params,
+ },
+ data_source_update_params.DataSourceUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DataSourceUpdateResponse,
+ )
+
+ def list(
+ self,
+ *,
+ limit: int | NotGiven = NOT_GIVEN,
+ offset: 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,
+ ) -> AsyncPaginator[DataSourceListResponse, AsyncLimitOffset[DataSourceListResponse]]:
+ """
+ Get all data sources.
+
+ Returns: The list of data sources.
+
+ Args:
+ limit: Maximum number of items to return per page
+
+ offset: Offset of the first item 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._get_api_list(
+ "/v1/data_sources/",
+ page=AsyncLimitOffset[DataSourceListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "limit": limit,
+ "offset": offset,
+ },
+ data_source_list_params.DataSourceListParams,
+ ),
+ ),
+ model=DataSourceListResponse,
+ )
+
+ async def delete(
+ self,
+ data_source_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,
+ ) -> DataSourceDeleteResponse:
+ """
+ Delete a data source.
+
+ Args: data_source_id: The ID of the data source to delete.
+
+ Args:
+ data_source_id: The ID of the data source to delete
+
+ 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 data_source_id:
+ raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
+ return await self._delete(
+ f"/v1/data_sources/{data_source_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DataSourceDeleteResponse,
+ )
+
+
+class DataSourcesResourceWithRawResponse:
+ def __init__(self, data_sources: DataSourcesResource) -> None:
+ self._data_sources = data_sources
+
+ self.create = to_raw_response_wrapper(
+ data_sources.create,
+ )
+ self.retrieve = to_raw_response_wrapper(
+ data_sources.retrieve,
+ )
+ self.update = to_raw_response_wrapper(
+ data_sources.update,
+ )
+ self.list = to_raw_response_wrapper(
+ data_sources.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ data_sources.delete,
+ )
+
+ @cached_property
+ def connectors(self) -> ConnectorsResourceWithRawResponse:
+ return ConnectorsResourceWithRawResponse(self._data_sources.connectors)
+
+
+class AsyncDataSourcesResourceWithRawResponse:
+ def __init__(self, data_sources: AsyncDataSourcesResource) -> None:
+ self._data_sources = data_sources
+
+ self.create = async_to_raw_response_wrapper(
+ data_sources.create,
+ )
+ self.retrieve = async_to_raw_response_wrapper(
+ data_sources.retrieve,
+ )
+ self.update = async_to_raw_response_wrapper(
+ data_sources.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ data_sources.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ data_sources.delete,
+ )
+
+ @cached_property
+ def connectors(self) -> AsyncConnectorsResourceWithRawResponse:
+ return AsyncConnectorsResourceWithRawResponse(self._data_sources.connectors)
+
+
+class DataSourcesResourceWithStreamingResponse:
+ def __init__(self, data_sources: DataSourcesResource) -> None:
+ self._data_sources = data_sources
+
+ self.create = to_streamed_response_wrapper(
+ data_sources.create,
+ )
+ self.retrieve = to_streamed_response_wrapper(
+ data_sources.retrieve,
+ )
+ self.update = to_streamed_response_wrapper(
+ data_sources.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ data_sources.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ data_sources.delete,
+ )
+
+ @cached_property
+ def connectors(self) -> ConnectorsResourceWithStreamingResponse:
+ return ConnectorsResourceWithStreamingResponse(self._data_sources.connectors)
+
+
+class AsyncDataSourcesResourceWithStreamingResponse:
+ def __init__(self, data_sources: AsyncDataSourcesResource) -> None:
+ self._data_sources = data_sources
+
+ self.create = async_to_streamed_response_wrapper(
+ data_sources.create,
+ )
+ self.retrieve = async_to_streamed_response_wrapper(
+ data_sources.retrieve,
+ )
+ self.update = async_to_streamed_response_wrapper(
+ data_sources.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ data_sources.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ data_sources.delete,
+ )
+
+ @cached_property
+ def connectors(self) -> AsyncConnectorsResourceWithStreamingResponse:
+ return AsyncConnectorsResourceWithStreamingResponse(self._data_sources.connectors)
diff --git a/src/mixedbread/types/__init__.py b/src/mixedbread/types/__init__.py
index a8ab8119..31efbe4f 100644
--- a/src/mixedbread/types/__init__.py
+++ b/src/mixedbread/types/__init__.py
@@ -17,16 +17,24 @@
from .expires_after_param import ExpiresAfterParam as ExpiresAfterParam
from .client_rerank_params import ClientRerankParams as ClientRerankParams
from .file_delete_response import FileDeleteResponse as FileDeleteResponse
+from .data_source_list_params import DataSourceListParams as DataSourceListParams
from .embedding_create_params import EmbeddingCreateParams as EmbeddingCreateParams
from .multi_encoding_embedding import MultiEncodingEmbedding as MultiEncodingEmbedding
from .vector_store_list_params import VectorStoreListParams as VectorStoreListParams
+from .data_source_create_params import DataSourceCreateParams as DataSourceCreateParams
+from .data_source_list_response import DataSourceListResponse as DataSourceListResponse
+from .data_source_update_params import DataSourceUpdateParams as DataSourceUpdateParams
from .embedding_create_response import EmbeddingCreateResponse as EmbeddingCreateResponse
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
from .vector_store_update_params import VectorStoreUpdateParams as VectorStoreUpdateParams
+from .data_source_create_response import DataSourceCreateResponse as DataSourceCreateResponse
+from .data_source_delete_response import DataSourceDeleteResponse as DataSourceDeleteResponse
+from .data_source_update_response import DataSourceUpdateResponse as DataSourceUpdateResponse
from .vector_store_delete_response import VectorStoreDeleteResponse as VectorStoreDeleteResponse
from .vector_store_search_response import VectorStoreSearchResponse as VectorStoreSearchResponse
+from .data_source_retrieve_response import DataSourceRetrieveResponse as DataSourceRetrieveResponse
from .vector_store_file_search_options_param import (
VectorStoreFileSearchOptionsParam as VectorStoreFileSearchOptionsParam,
)
diff --git a/src/mixedbread/types/data_source_create_params.py b/src/mixedbread/types/data_source_create_params.py
new file mode 100644
index 00000000..6483d336
--- /dev/null
+++ b/src/mixedbread/types/data_source_create_params.py
@@ -0,0 +1,56 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union, Optional
+from datetime import datetime
+from typing_extensions import Literal, Required, Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["DataSourceCreateParams", "AuthParams"]
+
+
+class DataSourceCreateParams(TypedDict, total=False):
+ type: Required[Literal["notion", "linear"]]
+ """The type of data source to create"""
+
+ name: Required[str]
+ """The name of the data source"""
+
+ metadata: object
+ """The metadata of the data source"""
+
+ auth_params: Optional[AuthParams]
+ """Authentication parameters for a OAuth data source."""
+
+
+class AuthParams(TypedDict, total=False):
+ type: Literal["oauth2"]
+
+ created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
+ """The timestamp when the OAuth2 credentials were created"""
+
+ client_id: Required[str]
+ """The OAuth2 client ID"""
+
+ client_secret: Required[str]
+ """The OAuth2 client secret"""
+
+ redirect_uri: Required[str]
+ """The OAuth2 redirect URI"""
+
+ scope: Required[str]
+ """The OAuth2 scope"""
+
+ access_token: Optional[str]
+ """The OAuth2 access token"""
+
+ refresh_token: Optional[str]
+ """The OAuth2 refresh token"""
+
+ token_type: Optional[str]
+ """The OAuth2 token type"""
+
+ expires_on: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
+ """The OAuth2 token expiration timestamp"""
diff --git a/src/mixedbread/types/data_source_create_response.py b/src/mixedbread/types/data_source_create_response.py
new file mode 100644
index 00000000..c8ff098e
--- /dev/null
+++ b/src/mixedbread/types/data_source_create_response.py
@@ -0,0 +1,66 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["DataSourceCreateResponse", "AuthParams"]
+
+
+class AuthParams(BaseModel):
+ type: Optional[Literal["oauth2"]] = None
+
+ created_at: Optional[datetime] = None
+ """The timestamp when the OAuth2 credentials were created"""
+
+ client_id: str
+ """The OAuth2 client ID"""
+
+ client_secret: str
+ """The OAuth2 client secret"""
+
+ redirect_uri: str
+ """The OAuth2 redirect URI"""
+
+ scope: str
+ """The OAuth2 scope"""
+
+ access_token: Optional[str] = None
+ """The OAuth2 access token"""
+
+ refresh_token: Optional[str] = None
+ """The OAuth2 refresh token"""
+
+ token_type: Optional[str] = None
+ """The OAuth2 token type"""
+
+ expires_on: Optional[datetime] = None
+ """The OAuth2 token expiration timestamp"""
+
+
+class DataSourceCreateResponse(BaseModel):
+ id: str
+ """The ID of the data source"""
+
+ created_at: datetime
+ """The creation time of the data source"""
+
+ updated_at: datetime
+ """The last update time of the data source"""
+
+ type: Literal["notion", "linear"]
+ """The type of data source"""
+
+ name: str
+ """The name of the data source"""
+
+ metadata: object
+ """The metadata of the data source"""
+
+ auth_params: Optional[AuthParams] = None
+ """Authentication parameters for a OAuth data source."""
+
+ object: Optional[Literal["data_source"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/data_source_delete_response.py b/src/mixedbread/types/data_source_delete_response.py
new file mode 100644
index 00000000..6fe26744
--- /dev/null
+++ b/src/mixedbread/types/data_source_delete_response.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["DataSourceDeleteResponse"]
+
+
+class DataSourceDeleteResponse(BaseModel):
+ id: str
+ """The ID of the data source"""
+
+ deleted: Optional[bool] = None
+ """Whether the data source was deleted"""
+
+ object: Optional[Literal["data_source"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/data_source_list_params.py b/src/mixedbread/types/data_source_list_params.py
new file mode 100644
index 00000000..d6026d5d
--- /dev/null
+++ b/src/mixedbread/types/data_source_list_params.py
@@ -0,0 +1,15 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import TypedDict
+
+__all__ = ["DataSourceListParams"]
+
+
+class DataSourceListParams(TypedDict, total=False):
+ limit: int
+ """Maximum number of items to return per page"""
+
+ offset: int
+ """Offset of the first item to return"""
diff --git a/src/mixedbread/types/data_source_list_response.py b/src/mixedbread/types/data_source_list_response.py
new file mode 100644
index 00000000..afe40837
--- /dev/null
+++ b/src/mixedbread/types/data_source_list_response.py
@@ -0,0 +1,66 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["DataSourceListResponse", "AuthParams"]
+
+
+class AuthParams(BaseModel):
+ type: Optional[Literal["oauth2"]] = None
+
+ created_at: Optional[datetime] = None
+ """The timestamp when the OAuth2 credentials were created"""
+
+ client_id: str
+ """The OAuth2 client ID"""
+
+ client_secret: str
+ """The OAuth2 client secret"""
+
+ redirect_uri: str
+ """The OAuth2 redirect URI"""
+
+ scope: str
+ """The OAuth2 scope"""
+
+ access_token: Optional[str] = None
+ """The OAuth2 access token"""
+
+ refresh_token: Optional[str] = None
+ """The OAuth2 refresh token"""
+
+ token_type: Optional[str] = None
+ """The OAuth2 token type"""
+
+ expires_on: Optional[datetime] = None
+ """The OAuth2 token expiration timestamp"""
+
+
+class DataSourceListResponse(BaseModel):
+ id: str
+ """The ID of the data source"""
+
+ created_at: datetime
+ """The creation time of the data source"""
+
+ updated_at: datetime
+ """The last update time of the data source"""
+
+ type: Literal["notion", "linear"]
+ """The type of data source"""
+
+ name: str
+ """The name of the data source"""
+
+ metadata: object
+ """The metadata of the data source"""
+
+ auth_params: Optional[AuthParams] = None
+ """Authentication parameters for a OAuth data source."""
+
+ object: Optional[Literal["data_source"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/data_source_retrieve_response.py b/src/mixedbread/types/data_source_retrieve_response.py
new file mode 100644
index 00000000..e6eda38d
--- /dev/null
+++ b/src/mixedbread/types/data_source_retrieve_response.py
@@ -0,0 +1,66 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["DataSourceRetrieveResponse", "AuthParams"]
+
+
+class AuthParams(BaseModel):
+ type: Optional[Literal["oauth2"]] = None
+
+ created_at: Optional[datetime] = None
+ """The timestamp when the OAuth2 credentials were created"""
+
+ client_id: str
+ """The OAuth2 client ID"""
+
+ client_secret: str
+ """The OAuth2 client secret"""
+
+ redirect_uri: str
+ """The OAuth2 redirect URI"""
+
+ scope: str
+ """The OAuth2 scope"""
+
+ access_token: Optional[str] = None
+ """The OAuth2 access token"""
+
+ refresh_token: Optional[str] = None
+ """The OAuth2 refresh token"""
+
+ token_type: Optional[str] = None
+ """The OAuth2 token type"""
+
+ expires_on: Optional[datetime] = None
+ """The OAuth2 token expiration timestamp"""
+
+
+class DataSourceRetrieveResponse(BaseModel):
+ id: str
+ """The ID of the data source"""
+
+ created_at: datetime
+ """The creation time of the data source"""
+
+ updated_at: datetime
+ """The last update time of the data source"""
+
+ type: Literal["notion", "linear"]
+ """The type of data source"""
+
+ name: str
+ """The name of the data source"""
+
+ metadata: object
+ """The metadata of the data source"""
+
+ auth_params: Optional[AuthParams] = None
+ """Authentication parameters for a OAuth data source."""
+
+ object: Optional[Literal["data_source"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/data_source_update_params.py b/src/mixedbread/types/data_source_update_params.py
new file mode 100644
index 00000000..d5bc1c00
--- /dev/null
+++ b/src/mixedbread/types/data_source_update_params.py
@@ -0,0 +1,53 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union, Optional
+from datetime import datetime
+from typing_extensions import Literal, Required, Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["DataSourceUpdateParams", "AuthParams"]
+
+
+class DataSourceUpdateParams(TypedDict, total=False):
+ name: Optional[str]
+ """The name of the data source"""
+
+ metadata: object
+ """The metadata of the data source"""
+
+ auth_params: Optional[AuthParams]
+ """Authentication parameters for a OAuth data source."""
+
+
+class AuthParams(TypedDict, total=False):
+ type: Literal["oauth2"]
+
+ created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
+ """The timestamp when the OAuth2 credentials were created"""
+
+ client_id: Required[str]
+ """The OAuth2 client ID"""
+
+ client_secret: Required[str]
+ """The OAuth2 client secret"""
+
+ redirect_uri: Required[str]
+ """The OAuth2 redirect URI"""
+
+ scope: Required[str]
+ """The OAuth2 scope"""
+
+ access_token: Optional[str]
+ """The OAuth2 access token"""
+
+ refresh_token: Optional[str]
+ """The OAuth2 refresh token"""
+
+ token_type: Optional[str]
+ """The OAuth2 token type"""
+
+ expires_on: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
+ """The OAuth2 token expiration timestamp"""
diff --git a/src/mixedbread/types/data_source_update_response.py b/src/mixedbread/types/data_source_update_response.py
new file mode 100644
index 00000000..8820151e
--- /dev/null
+++ b/src/mixedbread/types/data_source_update_response.py
@@ -0,0 +1,66 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["DataSourceUpdateResponse", "AuthParams"]
+
+
+class AuthParams(BaseModel):
+ type: Optional[Literal["oauth2"]] = None
+
+ created_at: Optional[datetime] = None
+ """The timestamp when the OAuth2 credentials were created"""
+
+ client_id: str
+ """The OAuth2 client ID"""
+
+ client_secret: str
+ """The OAuth2 client secret"""
+
+ redirect_uri: str
+ """The OAuth2 redirect URI"""
+
+ scope: str
+ """The OAuth2 scope"""
+
+ access_token: Optional[str] = None
+ """The OAuth2 access token"""
+
+ refresh_token: Optional[str] = None
+ """The OAuth2 refresh token"""
+
+ token_type: Optional[str] = None
+ """The OAuth2 token type"""
+
+ expires_on: Optional[datetime] = None
+ """The OAuth2 token expiration timestamp"""
+
+
+class DataSourceUpdateResponse(BaseModel):
+ id: str
+ """The ID of the data source"""
+
+ created_at: datetime
+ """The creation time of the data source"""
+
+ updated_at: datetime
+ """The last update time of the data source"""
+
+ type: Literal["notion", "linear"]
+ """The type of data source"""
+
+ name: str
+ """The name of the data source"""
+
+ metadata: object
+ """The metadata of the data source"""
+
+ auth_params: Optional[AuthParams] = None
+ """Authentication parameters for a OAuth data source."""
+
+ object: Optional[Literal["data_source"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/data_sources/__init__.py b/src/mixedbread/types/data_sources/__init__.py
new file mode 100644
index 00000000..e02119c0
--- /dev/null
+++ b/src/mixedbread/types/data_sources/__init__.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .connector_list_params import ConnectorListParams as ConnectorListParams
+from .connector_create_params import ConnectorCreateParams as ConnectorCreateParams
+from .connector_list_response import ConnectorListResponse as ConnectorListResponse
+from .connector_update_params import ConnectorUpdateParams as ConnectorUpdateParams
+from .connector_create_response import ConnectorCreateResponse as ConnectorCreateResponse
+from .connector_delete_response import ConnectorDeleteResponse as ConnectorDeleteResponse
+from .connector_update_response import ConnectorUpdateResponse as ConnectorUpdateResponse
+from .connector_retrieve_response import ConnectorRetrieveResponse as ConnectorRetrieveResponse
diff --git a/src/mixedbread/types/data_sources/connector_create_params.py b/src/mixedbread/types/data_sources/connector_create_params.py
new file mode 100644
index 00000000..6b1f8ed4
--- /dev/null
+++ b/src/mixedbread/types/data_sources/connector_create_params.py
@@ -0,0 +1,25 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Optional
+from typing_extensions import Required, TypedDict
+
+__all__ = ["ConnectorCreateParams"]
+
+
+class ConnectorCreateParams(TypedDict, total=False):
+ vector_store_id: Required[str]
+ """The ID of the vector store"""
+
+ name: str
+ """The name of the connector"""
+
+ trigger_sync: bool
+ """Whether the connector should be synced after creation"""
+
+ metadata: object
+ """The metadata of the connector"""
+
+ polling_interval: Optional[str]
+ """The polling interval of the connector"""
diff --git a/src/mixedbread/types/data_sources/connector_create_response.py b/src/mixedbread/types/data_sources/connector_create_response.py
new file mode 100644
index 00000000..583b3866
--- /dev/null
+++ b/src/mixedbread/types/data_sources/connector_create_response.py
@@ -0,0 +1,53 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["ConnectorCreateResponse"]
+
+
+class ConnectorCreateResponse(BaseModel):
+ id: str
+ """The ID of the connector"""
+
+ created_at: datetime
+ """The creation time of the connector"""
+
+ updated_at: datetime
+ """The last update time of the connector"""
+
+ vector_store_id: str
+ """The ID of the vector store"""
+
+ data_source_id: str
+ """The ID of the data source"""
+
+ name: Optional[str] = None
+ """The name of the connector"""
+
+ metadata: object
+ """The metadata of the connector"""
+
+ polling_interval: str
+ """The polling interval of the connector"""
+
+ started_at: Optional[datetime] = None
+ """The start time of the connector"""
+
+ finished_at: Optional[datetime] = None
+ """The finish time of the connector"""
+
+ last_synced_at: Optional[datetime] = None
+ """The last sync time of the connector"""
+
+ status: Literal["idle", "pending", "in_progress", "cancelled", "completed", "failed"]
+ """The sync status of the connector"""
+
+ error: Optional[str] = None
+ """The sync error of the connector"""
+
+ object: Optional[Literal["data_source.connector"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/data_sources/connector_delete_response.py b/src/mixedbread/types/data_sources/connector_delete_response.py
new file mode 100644
index 00000000..1f320d3e
--- /dev/null
+++ b/src/mixedbread/types/data_sources/connector_delete_response.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["ConnectorDeleteResponse"]
+
+
+class ConnectorDeleteResponse(BaseModel):
+ id: str
+ """The ID of the connector"""
+
+ deleted: Optional[bool] = None
+ """Whether the connector was deleted"""
+
+ object: Optional[Literal["data_source.connector"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/data_sources/connector_list_params.py b/src/mixedbread/types/data_sources/connector_list_params.py
new file mode 100644
index 00000000..deda9f22
--- /dev/null
+++ b/src/mixedbread/types/data_sources/connector_list_params.py
@@ -0,0 +1,15 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import TypedDict
+
+__all__ = ["ConnectorListParams"]
+
+
+class ConnectorListParams(TypedDict, total=False):
+ limit: int
+ """Maximum number of items to return per page"""
+
+ offset: int
+ """Offset of the first item to return"""
diff --git a/src/mixedbread/types/data_sources/connector_list_response.py b/src/mixedbread/types/data_sources/connector_list_response.py
new file mode 100644
index 00000000..4a508789
--- /dev/null
+++ b/src/mixedbread/types/data_sources/connector_list_response.py
@@ -0,0 +1,53 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["ConnectorListResponse"]
+
+
+class ConnectorListResponse(BaseModel):
+ id: str
+ """The ID of the connector"""
+
+ created_at: datetime
+ """The creation time of the connector"""
+
+ updated_at: datetime
+ """The last update time of the connector"""
+
+ vector_store_id: str
+ """The ID of the vector store"""
+
+ data_source_id: str
+ """The ID of the data source"""
+
+ name: Optional[str] = None
+ """The name of the connector"""
+
+ metadata: object
+ """The metadata of the connector"""
+
+ polling_interval: str
+ """The polling interval of the connector"""
+
+ started_at: Optional[datetime] = None
+ """The start time of the connector"""
+
+ finished_at: Optional[datetime] = None
+ """The finish time of the connector"""
+
+ last_synced_at: Optional[datetime] = None
+ """The last sync time of the connector"""
+
+ status: Literal["idle", "pending", "in_progress", "cancelled", "completed", "failed"]
+ """The sync status of the connector"""
+
+ error: Optional[str] = None
+ """The sync error of the connector"""
+
+ object: Optional[Literal["data_source.connector"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/data_sources/connector_retrieve_response.py b/src/mixedbread/types/data_sources/connector_retrieve_response.py
new file mode 100644
index 00000000..db2f80c5
--- /dev/null
+++ b/src/mixedbread/types/data_sources/connector_retrieve_response.py
@@ -0,0 +1,53 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["ConnectorRetrieveResponse"]
+
+
+class ConnectorRetrieveResponse(BaseModel):
+ id: str
+ """The ID of the connector"""
+
+ created_at: datetime
+ """The creation time of the connector"""
+
+ updated_at: datetime
+ """The last update time of the connector"""
+
+ vector_store_id: str
+ """The ID of the vector store"""
+
+ data_source_id: str
+ """The ID of the data source"""
+
+ name: Optional[str] = None
+ """The name of the connector"""
+
+ metadata: object
+ """The metadata of the connector"""
+
+ polling_interval: str
+ """The polling interval of the connector"""
+
+ started_at: Optional[datetime] = None
+ """The start time of the connector"""
+
+ finished_at: Optional[datetime] = None
+ """The finish time of the connector"""
+
+ last_synced_at: Optional[datetime] = None
+ """The last sync time of the connector"""
+
+ status: Literal["idle", "pending", "in_progress", "cancelled", "completed", "failed"]
+ """The sync status of the connector"""
+
+ error: Optional[str] = None
+ """The sync error of the connector"""
+
+ object: Optional[Literal["data_source.connector"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/data_sources/connector_update_params.py b/src/mixedbread/types/data_sources/connector_update_params.py
new file mode 100644
index 00000000..80434be2
--- /dev/null
+++ b/src/mixedbread/types/data_sources/connector_update_params.py
@@ -0,0 +1,25 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Dict, Optional
+from typing_extensions import Required, TypedDict
+
+__all__ = ["ConnectorUpdateParams"]
+
+
+class ConnectorUpdateParams(TypedDict, total=False):
+ data_source_id: Required[str]
+ """The ID of the data source to update a connector for"""
+
+ name: Optional[str]
+ """The name of the connector"""
+
+ metadata: Optional[Dict[str, object]]
+ """The metadata of the connector"""
+
+ trigger_sync: Optional[bool]
+ """Whether the connector should be synced after update"""
+
+ polling_interval: Optional[str]
+ """The polling interval of the connector"""
diff --git a/src/mixedbread/types/data_sources/connector_update_response.py b/src/mixedbread/types/data_sources/connector_update_response.py
new file mode 100644
index 00000000..4055a322
--- /dev/null
+++ b/src/mixedbread/types/data_sources/connector_update_response.py
@@ -0,0 +1,53 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["ConnectorUpdateResponse"]
+
+
+class ConnectorUpdateResponse(BaseModel):
+ id: str
+ """The ID of the connector"""
+
+ created_at: datetime
+ """The creation time of the connector"""
+
+ updated_at: datetime
+ """The last update time of the connector"""
+
+ vector_store_id: str
+ """The ID of the vector store"""
+
+ data_source_id: str
+ """The ID of the data source"""
+
+ name: Optional[str] = None
+ """The name of the connector"""
+
+ metadata: object
+ """The metadata of the connector"""
+
+ polling_interval: str
+ """The polling interval of the connector"""
+
+ started_at: Optional[datetime] = None
+ """The start time of the connector"""
+
+ finished_at: Optional[datetime] = None
+ """The finish time of the connector"""
+
+ last_synced_at: Optional[datetime] = None
+ """The last sync time of the connector"""
+
+ status: Literal["idle", "pending", "in_progress", "cancelled", "completed", "failed"]
+ """The sync status of the connector"""
+
+ error: Optional[str] = None
+ """The sync error of the connector"""
+
+ object: Optional[Literal["data_source.connector"]] = None
+ """The type of the object"""
diff --git a/tests/api_resources/data_sources/__init__.py b/tests/api_resources/data_sources/__init__.py
new file mode 100644
index 00000000..fd8019a9
--- /dev/null
+++ b/tests/api_resources/data_sources/__init__.py
@@ -0,0 +1 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
diff --git a/tests/api_resources/data_sources/test_connectors.py b/tests/api_resources/data_sources/test_connectors.py
new file mode 100644
index 00000000..f18a20d8
--- /dev/null
+++ b/tests/api_resources/data_sources/test_connectors.py
@@ -0,0 +1,543 @@
+# 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.pagination import SyncLimitOffset, AsyncLimitOffset
+from mixedbread.types.data_sources import (
+ ConnectorListResponse,
+ ConnectorCreateResponse,
+ ConnectorDeleteResponse,
+ ConnectorUpdateResponse,
+ ConnectorRetrieveResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestConnectors:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Mixedbread) -> None:
+ connector = client.data_sources.connectors.create(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ vector_store_id="vector_store_id",
+ )
+ assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Mixedbread) -> None:
+ connector = client.data_sources.connectors.create(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ vector_store_id="vector_store_id",
+ name="name",
+ trigger_sync=True,
+ metadata={},
+ polling_interval="polling_interval",
+ )
+ assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Mixedbread) -> None:
+ response = client.data_sources.connectors.with_raw_response.create(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ vector_store_id="vector_store_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ connector = response.parse()
+ assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Mixedbread) -> None:
+ with client.data_sources.connectors.with_streaming_response.create(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ vector_store_id="vector_store_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ connector = response.parse()
+ assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_create(self, client: Mixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ client.data_sources.connectors.with_raw_response.create(
+ data_source_id="",
+ vector_store_id="vector_store_id",
+ )
+
+ @parametrize
+ def test_method_retrieve(self, client: Mixedbread) -> None:
+ connector = client.data_sources.connectors.retrieve(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(ConnectorRetrieveResponse, connector, path=["response"])
+
+ @parametrize
+ def test_raw_response_retrieve(self, client: Mixedbread) -> None:
+ response = client.data_sources.connectors.with_raw_response.retrieve(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ connector = response.parse()
+ assert_matches_type(ConnectorRetrieveResponse, connector, path=["response"])
+
+ @parametrize
+ def test_streaming_response_retrieve(self, client: Mixedbread) -> None:
+ with client.data_sources.connectors.with_streaming_response.retrieve(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ connector = response.parse()
+ assert_matches_type(ConnectorRetrieveResponse, connector, 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 `data_source_id` but received ''"):
+ client.data_sources.connectors.with_raw_response.retrieve(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"):
+ client.data_sources.connectors.with_raw_response.retrieve(
+ connector_id="",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ @parametrize
+ def test_method_update(self, client: Mixedbread) -> None:
+ connector = client.data_sources.connectors.update(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+
+ @parametrize
+ def test_method_update_with_all_params(self, client: Mixedbread) -> None:
+ connector = client.data_sources.connectors.update(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ name="name",
+ metadata={"foo": "bar"},
+ trigger_sync=True,
+ polling_interval="polling_interval",
+ )
+ assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+
+ @parametrize
+ def test_raw_response_update(self, client: Mixedbread) -> None:
+ response = client.data_sources.connectors.with_raw_response.update(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ connector = response.parse()
+ assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+
+ @parametrize
+ def test_streaming_response_update(self, client: Mixedbread) -> None:
+ with client.data_sources.connectors.with_streaming_response.update(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ connector = response.parse()
+ assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_update(self, client: Mixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ client.data_sources.connectors.with_raw_response.update(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"):
+ client.data_sources.connectors.with_raw_response.update(
+ connector_id="",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ @parametrize
+ def test_method_list(self, client: Mixedbread) -> None:
+ connector = client.data_sources.connectors.list(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(SyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+
+ @parametrize
+ def test_method_list_with_all_params(self, client: Mixedbread) -> None:
+ connector = client.data_sources.connectors.list(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ limit=1000,
+ offset=0,
+ )
+ assert_matches_type(SyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Mixedbread) -> None:
+ response = client.data_sources.connectors.with_raw_response.list(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ connector = response.parse()
+ assert_matches_type(SyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Mixedbread) -> None:
+ with client.data_sources.connectors.with_streaming_response.list(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ connector = response.parse()
+ assert_matches_type(SyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_list(self, client: Mixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ client.data_sources.connectors.with_raw_response.list(
+ data_source_id="",
+ )
+
+ @parametrize
+ def test_method_delete(self, client: Mixedbread) -> None:
+ connector = client.data_sources.connectors.delete(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(ConnectorDeleteResponse, connector, path=["response"])
+
+ @parametrize
+ def test_raw_response_delete(self, client: Mixedbread) -> None:
+ response = client.data_sources.connectors.with_raw_response.delete(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ connector = response.parse()
+ assert_matches_type(ConnectorDeleteResponse, connector, path=["response"])
+
+ @parametrize
+ def test_streaming_response_delete(self, client: Mixedbread) -> None:
+ with client.data_sources.connectors.with_streaming_response.delete(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ connector = response.parse()
+ assert_matches_type(ConnectorDeleteResponse, connector, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_delete(self, client: Mixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ client.data_sources.connectors.with_raw_response.delete(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"):
+ client.data_sources.connectors.with_raw_response.delete(
+ connector_id="",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+
+class TestAsyncConnectors:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncMixedbread) -> None:
+ connector = await async_client.data_sources.connectors.create(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ vector_store_id="vector_store_id",
+ )
+ assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None:
+ connector = await async_client.data_sources.connectors.create(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ vector_store_id="vector_store_id",
+ name="name",
+ trigger_sync=True,
+ metadata={},
+ polling_interval="polling_interval",
+ )
+ assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.data_sources.connectors.with_raw_response.create(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ vector_store_id="vector_store_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ connector = await response.parse()
+ assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.data_sources.connectors.with_streaming_response.create(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ vector_store_id="vector_store_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ connector = await response.parse()
+ assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_create(self, async_client: AsyncMixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ await async_client.data_sources.connectors.with_raw_response.create(
+ data_source_id="",
+ vector_store_id="vector_store_id",
+ )
+
+ @parametrize
+ async def test_method_retrieve(self, async_client: AsyncMixedbread) -> None:
+ connector = await async_client.data_sources.connectors.retrieve(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(ConnectorRetrieveResponse, connector, path=["response"])
+
+ @parametrize
+ async def test_raw_response_retrieve(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.data_sources.connectors.with_raw_response.retrieve(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ connector = await response.parse()
+ assert_matches_type(ConnectorRetrieveResponse, connector, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_retrieve(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.data_sources.connectors.with_streaming_response.retrieve(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ connector = await response.parse()
+ assert_matches_type(ConnectorRetrieveResponse, connector, 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 `data_source_id` but received ''"):
+ await async_client.data_sources.connectors.with_raw_response.retrieve(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"):
+ await async_client.data_sources.connectors.with_raw_response.retrieve(
+ connector_id="",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ @parametrize
+ async def test_method_update(self, async_client: AsyncMixedbread) -> None:
+ connector = await async_client.data_sources.connectors.update(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+
+ @parametrize
+ async def test_method_update_with_all_params(self, async_client: AsyncMixedbread) -> None:
+ connector = await async_client.data_sources.connectors.update(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ name="name",
+ metadata={"foo": "bar"},
+ trigger_sync=True,
+ polling_interval="polling_interval",
+ )
+ assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+
+ @parametrize
+ async def test_raw_response_update(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.data_sources.connectors.with_raw_response.update(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ connector = await response.parse()
+ assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_update(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.data_sources.connectors.with_streaming_response.update(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ connector = await response.parse()
+ assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_update(self, async_client: AsyncMixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ await async_client.data_sources.connectors.with_raw_response.update(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"):
+ await async_client.data_sources.connectors.with_raw_response.update(
+ connector_id="",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncMixedbread) -> None:
+ connector = await async_client.data_sources.connectors.list(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(AsyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+
+ @parametrize
+ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None:
+ connector = await async_client.data_sources.connectors.list(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ limit=1000,
+ offset=0,
+ )
+ assert_matches_type(AsyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.data_sources.connectors.with_raw_response.list(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ connector = await response.parse()
+ assert_matches_type(AsyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.data_sources.connectors.with_streaming_response.list(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ connector = await response.parse()
+ assert_matches_type(AsyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_list(self, async_client: AsyncMixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ await async_client.data_sources.connectors.with_raw_response.list(
+ data_source_id="",
+ )
+
+ @parametrize
+ async def test_method_delete(self, async_client: AsyncMixedbread) -> None:
+ connector = await async_client.data_sources.connectors.delete(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(ConnectorDeleteResponse, connector, path=["response"])
+
+ @parametrize
+ async def test_raw_response_delete(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.data_sources.connectors.with_raw_response.delete(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ connector = await response.parse()
+ assert_matches_type(ConnectorDeleteResponse, connector, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_delete(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.data_sources.connectors.with_streaming_response.delete(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ connector = await response.parse()
+ assert_matches_type(ConnectorDeleteResponse, connector, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_delete(self, async_client: AsyncMixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ await async_client.data_sources.connectors.with_raw_response.delete(
+ connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ data_source_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `connector_id` but received ''"):
+ await async_client.data_sources.connectors.with_raw_response.delete(
+ connector_id="",
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
diff --git a/tests/api_resources/test_chat.py b/tests/api_resources/test_chat.py
new file mode 100644
index 00000000..65341369
--- /dev/null
+++ b/tests/api_resources/test_chat.py
@@ -0,0 +1,71 @@
+# 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 TestChat:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create_completion(self, client: Mixedbread) -> None:
+ chat = client.chat.create_completion()
+ assert_matches_type(object, chat, path=["response"])
+
+ @parametrize
+ def test_raw_response_create_completion(self, client: Mixedbread) -> None:
+ response = client.chat.with_raw_response.create_completion()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ chat = response.parse()
+ assert_matches_type(object, chat, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create_completion(self, client: Mixedbread) -> None:
+ with client.chat.with_streaming_response.create_completion() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ chat = response.parse()
+ assert_matches_type(object, chat, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncChat:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create_completion(self, async_client: AsyncMixedbread) -> None:
+ chat = await async_client.chat.create_completion()
+ assert_matches_type(object, chat, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create_completion(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.chat.with_raw_response.create_completion()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ chat = await response.parse()
+ assert_matches_type(object, chat, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create_completion(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.chat.with_streaming_response.create_completion() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ chat = await response.parse()
+ assert_matches_type(object, chat, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_data_sources.py b/tests/api_resources/test_data_sources.py
new file mode 100644
index 00000000..4d9ea104
--- /dev/null
+++ b/tests/api_resources/test_data_sources.py
@@ -0,0 +1,476 @@
+# 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 (
+ DataSourceListResponse,
+ DataSourceCreateResponse,
+ DataSourceDeleteResponse,
+ DataSourceUpdateResponse,
+ DataSourceRetrieveResponse,
+)
+from mixedbread._utils import parse_datetime
+from mixedbread.pagination import SyncLimitOffset, AsyncLimitOffset
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestDataSources:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Mixedbread) -> None:
+ data_source = client.data_sources.create(
+ type="notion",
+ name="name",
+ )
+ assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Mixedbread) -> None:
+ data_source = client.data_sources.create(
+ type="notion",
+ name="name",
+ metadata={},
+ auth_params={
+ "type": "oauth2",
+ "created_at": parse_datetime("2019-12-27T18:11:19.117Z"),
+ "client_id": "client_id",
+ "client_secret": "client_secret",
+ "redirect_uri": "redirect_uri",
+ "scope": "scope",
+ "access_token": "access_token",
+ "refresh_token": "refresh_token",
+ "token_type": "token_type",
+ "expires_on": parse_datetime("2019-12-27T18:11:19.117Z"),
+ },
+ )
+ assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Mixedbread) -> None:
+ response = client.data_sources.with_raw_response.create(
+ type="notion",
+ name="name",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ data_source = response.parse()
+ assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Mixedbread) -> None:
+ with client.data_sources.with_streaming_response.create(
+ type="notion",
+ name="name",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ data_source = response.parse()
+ assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_method_retrieve(self, client: Mixedbread) -> None:
+ data_source = client.data_sources.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(DataSourceRetrieveResponse, data_source, path=["response"])
+
+ @parametrize
+ def test_raw_response_retrieve(self, client: Mixedbread) -> None:
+ response = client.data_sources.with_raw_response.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ data_source = response.parse()
+ assert_matches_type(DataSourceRetrieveResponse, data_source, path=["response"])
+
+ @parametrize
+ def test_streaming_response_retrieve(self, client: Mixedbread) -> None:
+ with client.data_sources.with_streaming_response.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ data_source = response.parse()
+ assert_matches_type(DataSourceRetrieveResponse, data_source, 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 `data_source_id` but received ''"):
+ client.data_sources.with_raw_response.retrieve(
+ "",
+ )
+
+ @parametrize
+ def test_method_update(self, client: Mixedbread) -> None:
+ data_source = client.data_sources.update(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+
+ @parametrize
+ def test_method_update_with_all_params(self, client: Mixedbread) -> None:
+ data_source = client.data_sources.update(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ name="name",
+ metadata={},
+ auth_params={
+ "type": "oauth2",
+ "created_at": parse_datetime("2019-12-27T18:11:19.117Z"),
+ "client_id": "client_id",
+ "client_secret": "client_secret",
+ "redirect_uri": "redirect_uri",
+ "scope": "scope",
+ "access_token": "access_token",
+ "refresh_token": "refresh_token",
+ "token_type": "token_type",
+ "expires_on": parse_datetime("2019-12-27T18:11:19.117Z"),
+ },
+ )
+ assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+
+ @parametrize
+ def test_raw_response_update(self, client: Mixedbread) -> None:
+ response = client.data_sources.with_raw_response.update(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ data_source = response.parse()
+ assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+
+ @parametrize
+ def test_streaming_response_update(self, client: Mixedbread) -> None:
+ with client.data_sources.with_streaming_response.update(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ data_source = response.parse()
+ assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_update(self, client: Mixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ client.data_sources.with_raw_response.update(
+ data_source_id="",
+ )
+
+ @parametrize
+ def test_method_list(self, client: Mixedbread) -> None:
+ data_source = client.data_sources.list()
+ assert_matches_type(SyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+
+ @parametrize
+ def test_method_list_with_all_params(self, client: Mixedbread) -> None:
+ data_source = client.data_sources.list(
+ limit=1000,
+ offset=0,
+ )
+ assert_matches_type(SyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Mixedbread) -> None:
+ response = client.data_sources.with_raw_response.list()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ data_source = response.parse()
+ assert_matches_type(SyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Mixedbread) -> None:
+ with client.data_sources.with_streaming_response.list() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ data_source = response.parse()
+ assert_matches_type(SyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_method_delete(self, client: Mixedbread) -> None:
+ data_source = client.data_sources.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(DataSourceDeleteResponse, data_source, path=["response"])
+
+ @parametrize
+ def test_raw_response_delete(self, client: Mixedbread) -> None:
+ response = client.data_sources.with_raw_response.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ data_source = response.parse()
+ assert_matches_type(DataSourceDeleteResponse, data_source, path=["response"])
+
+ @parametrize
+ def test_streaming_response_delete(self, client: Mixedbread) -> None:
+ with client.data_sources.with_streaming_response.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ data_source = response.parse()
+ assert_matches_type(DataSourceDeleteResponse, data_source, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_delete(self, client: Mixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ client.data_sources.with_raw_response.delete(
+ "",
+ )
+
+
+class TestAsyncDataSources:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncMixedbread) -> None:
+ data_source = await async_client.data_sources.create(
+ type="notion",
+ name="name",
+ )
+ assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None:
+ data_source = await async_client.data_sources.create(
+ type="notion",
+ name="name",
+ metadata={},
+ auth_params={
+ "type": "oauth2",
+ "created_at": parse_datetime("2019-12-27T18:11:19.117Z"),
+ "client_id": "client_id",
+ "client_secret": "client_secret",
+ "redirect_uri": "redirect_uri",
+ "scope": "scope",
+ "access_token": "access_token",
+ "refresh_token": "refresh_token",
+ "token_type": "token_type",
+ "expires_on": parse_datetime("2019-12-27T18:11:19.117Z"),
+ },
+ )
+ assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.data_sources.with_raw_response.create(
+ type="notion",
+ name="name",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ data_source = await response.parse()
+ assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.data_sources.with_streaming_response.create(
+ type="notion",
+ name="name",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ data_source = await response.parse()
+ assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_method_retrieve(self, async_client: AsyncMixedbread) -> None:
+ data_source = await async_client.data_sources.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(DataSourceRetrieveResponse, data_source, path=["response"])
+
+ @parametrize
+ async def test_raw_response_retrieve(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.data_sources.with_raw_response.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ data_source = await response.parse()
+ assert_matches_type(DataSourceRetrieveResponse, data_source, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_retrieve(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.data_sources.with_streaming_response.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ data_source = await response.parse()
+ assert_matches_type(DataSourceRetrieveResponse, data_source, 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 `data_source_id` but received ''"):
+ await async_client.data_sources.with_raw_response.retrieve(
+ "",
+ )
+
+ @parametrize
+ async def test_method_update(self, async_client: AsyncMixedbread) -> None:
+ data_source = await async_client.data_sources.update(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+
+ @parametrize
+ async def test_method_update_with_all_params(self, async_client: AsyncMixedbread) -> None:
+ data_source = await async_client.data_sources.update(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ name="name",
+ metadata={},
+ auth_params={
+ "type": "oauth2",
+ "created_at": parse_datetime("2019-12-27T18:11:19.117Z"),
+ "client_id": "client_id",
+ "client_secret": "client_secret",
+ "redirect_uri": "redirect_uri",
+ "scope": "scope",
+ "access_token": "access_token",
+ "refresh_token": "refresh_token",
+ "token_type": "token_type",
+ "expires_on": parse_datetime("2019-12-27T18:11:19.117Z"),
+ },
+ )
+ assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+
+ @parametrize
+ async def test_raw_response_update(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.data_sources.with_raw_response.update(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ data_source = await response.parse()
+ assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_update(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.data_sources.with_streaming_response.update(
+ data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ data_source = await response.parse()
+ assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_update(self, async_client: AsyncMixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ await async_client.data_sources.with_raw_response.update(
+ data_source_id="",
+ )
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncMixedbread) -> None:
+ data_source = await async_client.data_sources.list()
+ assert_matches_type(AsyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+
+ @parametrize
+ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None:
+ data_source = await async_client.data_sources.list(
+ limit=1000,
+ offset=0,
+ )
+ assert_matches_type(AsyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.data_sources.with_raw_response.list()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ data_source = await response.parse()
+ assert_matches_type(AsyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.data_sources.with_streaming_response.list() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ data_source = await response.parse()
+ assert_matches_type(AsyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_method_delete(self, async_client: AsyncMixedbread) -> None:
+ data_source = await async_client.data_sources.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(DataSourceDeleteResponse, data_source, path=["response"])
+
+ @parametrize
+ async def test_raw_response_delete(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.data_sources.with_raw_response.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ data_source = await response.parse()
+ assert_matches_type(DataSourceDeleteResponse, data_source, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_delete(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.data_sources.with_streaming_response.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ data_source = await response.parse()
+ assert_matches_type(DataSourceDeleteResponse, data_source, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_delete(self, async_client: AsyncMixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `data_source_id` but received ''"):
+ await async_client.data_sources.with_raw_response.delete(
+ "",
+ )
From c504aa4e20404af5c2f66f21ee55ef04af7092c8 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 26 May 2025 12:32:00 +0000
Subject: [PATCH 5/6] feat(api): update via SDK Studio
---
.stats.yml | 4 +-
api.md | 68 +-
src/mixedbread/_client.py | 23 +-
src/mixedbread/resources/__init__.py | 14 +
src/mixedbread/resources/api_keys.py | 683 ++++++++++++++++++
.../resources/data_sources/connectors.py | 41 +-
.../resources/data_sources/data_sources.py | 63 +-
src/mixedbread/resources/embeddings.py | 14 +-
src/mixedbread/resources/parsing/jobs.py | 51 +-
src/mixedbread/types/__init__.py | 16 +-
src/mixedbread/types/api_key.py | 35 +
src/mixedbread/types/api_key_create_params.py | 19 +
src/mixedbread/types/api_key_created.py | 38 +
.../types/api_key_delete_response.py | 19 +
src/mixedbread/types/api_key_list_params.py | 15 +
src/mixedbread/types/client_embed_params.py | 9 +-
src/mixedbread/types/data_source.py | 37 +
.../types/data_source_create_params.py | 45 +-
.../types/data_source_create_response.py | 66 --
...sponse.py => data_source_oauth2_params.py} | 30 +-
.../types/data_source_oauth2_params_param.py | 42 ++
.../types/data_source_retrieve_response.py | 66 --
src/mixedbread/types/data_source_type.py | 7 +
.../types/data_source_update_params.py | 42 +-
.../types/data_source_update_response.py | 66 --
src/mixedbread/types/data_sources/__init__.py | 5 +-
.../data_sources/connector_create_response.py | 53 --
.../connector_retrieve_response.py | 53 --
.../data_sources/connector_update_response.py | 53 --
...t_response.py => data_source_connector.py} | 4 +-
.../types/embedding_create_params.py | 9 +-
.../types/embedding_create_response.py | 25 +-
src/mixedbread/types/encoding_format.py | 7 +
src/mixedbread/types/extractions/__init__.py | 4 +
.../extractions/content_create_params.py | 36 +-
.../types/extractions/extraction_job.py | 4 +-
.../types/extractions/image_url_input.py | 21 +
.../extractions/image_url_input_param.py | 20 +
.../types/extractions/text_input.py | 16 +
.../types/extractions/text_input_param.py | 15 +
src/mixedbread/types/object_type.py | 20 +
src/mixedbread/types/pagination_with_total.py | 18 +
src/mixedbread/types/parsing/__init__.py | 4 +
.../types/parsing/chunking_strategy.py | 7 +
src/mixedbread/types/parsing/element_type.py | 19 +
.../types/parsing/job_create_params.py | 26 +-
.../types/parsing/job_list_response.py | 3 +-
src/mixedbread/types/parsing/parsing_job.py | 40 +-
.../types/parsing/parsing_job_status.py | 7 +
src/mixedbread/types/parsing/return_format.py | 7 +
src/mixedbread/types/rerank_response.py | 18 +-
.../types/scored_vector_store_chunk.py | 30 +-
.../data_sources/test_connectors.py | 65 +-
tests/api_resources/parsing/test_jobs.py | 6 +-
tests/api_resources/test_api_keys.py | 460 ++++++++++++
tests/api_resources/test_data_sources.py | 65 +-
56 files changed, 1800 insertions(+), 833 deletions(-)
create mode 100644 src/mixedbread/resources/api_keys.py
create mode 100644 src/mixedbread/types/api_key.py
create mode 100644 src/mixedbread/types/api_key_create_params.py
create mode 100644 src/mixedbread/types/api_key_created.py
create mode 100644 src/mixedbread/types/api_key_delete_response.py
create mode 100644 src/mixedbread/types/api_key_list_params.py
create mode 100644 src/mixedbread/types/data_source.py
delete mode 100644 src/mixedbread/types/data_source_create_response.py
rename src/mixedbread/types/{data_source_list_response.py => data_source_oauth2_params.py} (55%)
create mode 100644 src/mixedbread/types/data_source_oauth2_params_param.py
delete mode 100644 src/mixedbread/types/data_source_retrieve_response.py
create mode 100644 src/mixedbread/types/data_source_type.py
delete mode 100644 src/mixedbread/types/data_source_update_response.py
delete mode 100644 src/mixedbread/types/data_sources/connector_create_response.py
delete mode 100644 src/mixedbread/types/data_sources/connector_retrieve_response.py
delete mode 100644 src/mixedbread/types/data_sources/connector_update_response.py
rename src/mixedbread/types/data_sources/{connector_list_response.py => data_source_connector.py} (94%)
create mode 100644 src/mixedbread/types/encoding_format.py
create mode 100644 src/mixedbread/types/extractions/image_url_input.py
create mode 100644 src/mixedbread/types/extractions/image_url_input_param.py
create mode 100644 src/mixedbread/types/extractions/text_input.py
create mode 100644 src/mixedbread/types/extractions/text_input_param.py
create mode 100644 src/mixedbread/types/object_type.py
create mode 100644 src/mixedbread/types/pagination_with_total.py
create mode 100644 src/mixedbread/types/parsing/chunking_strategy.py
create mode 100644 src/mixedbread/types/parsing/element_type.py
create mode 100644 src/mixedbread/types/parsing/parsing_job_status.py
create mode 100644 src/mixedbread/types/parsing/return_format.py
create mode 100644 tests/api_resources/test_api_keys.py
diff --git a/.stats.yml b/.stats.yml
index 2aac0f69..78883d24 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 43
+configured_endpoints: 49
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/mixedbread%2Fmixedbread-82c2c1c322149cd73b2e8e45f475919b941752a89e74464ccecd1aee9352e9be.yml
openapi_spec_hash: f6661e9fafda26e7e9f3fc06739a33ad
-config_hash: 70d47aa4a1dd8327383138a26d47d21a
+config_hash: 0619498f633d6a0d92ae15b21fd06d89
diff --git a/api.md b/api.md
index 141e338e..52d628b1 100644
--- a/api.md
+++ b/api.md
@@ -80,7 +80,15 @@ Methods:
Types:
```python
-from mixedbread.types.parsing import ParsingJob, JobListResponse, JobDeleteResponse
+from mixedbread.types.parsing import (
+ ChunkingStrategy,
+ ElementType,
+ ParsingJobStatus,
+ ParsingJob,
+ ReturnFormat,
+ JobListResponse,
+ JobDeleteResponse,
+)
```
Methods:
@@ -96,7 +104,7 @@ Methods:
Types:
```python
-from mixedbread.types import FileObject, FileDeleteResponse
+from mixedbread.types import FileObject, PaginationWithTotal, FileDeleteResponse
```
Methods:
@@ -142,7 +150,7 @@ Methods:
Types:
```python
-from mixedbread.types.extractions import ExtractionResult
+from mixedbread.types.extractions import ExtractionResult, ImageURLInput, TextInput
```
Methods:
@@ -151,6 +159,12 @@ Methods:
# Embeddings
+Types:
+
+```python
+from mixedbread.types import EncodingFormat, ObjectType
+```
+
Methods:
- client.embeddings.create(\*\*params) -> EmbeddingCreateResponse
@@ -173,20 +187,19 @@ Types:
```python
from mixedbread.types import (
- DataSourceCreateResponse,
- DataSourceRetrieveResponse,
- DataSourceUpdateResponse,
- DataSourceListResponse,
+ DataSource,
+ DataSourceOauth2Params,
+ DataSourceType,
DataSourceDeleteResponse,
)
```
Methods:
-- client.data_sources.create(\*\*params) -> DataSourceCreateResponse
-- client.data_sources.retrieve(data_source_id) -> DataSourceRetrieveResponse
-- client.data_sources.update(data_source_id, \*\*params) -> DataSourceUpdateResponse
-- client.data_sources.list(\*\*params) -> SyncLimitOffset[DataSourceListResponse]
+- client.data_sources.create(\*\*params) -> DataSource
+- client.data_sources.retrieve(data_source_id) -> DataSource
+- client.data_sources.update(data_source_id, \*\*params) -> DataSource
+- client.data_sources.list(\*\*params) -> SyncLimitOffset[DataSource]
- client.data_sources.delete(data_source_id) -> DataSourceDeleteResponse
## Connectors
@@ -194,19 +207,30 @@ Methods:
Types:
```python
-from mixedbread.types.data_sources import (
- ConnectorCreateResponse,
- ConnectorRetrieveResponse,
- ConnectorUpdateResponse,
- ConnectorListResponse,
- ConnectorDeleteResponse,
-)
+from mixedbread.types.data_sources import DataSourceConnector, ConnectorDeleteResponse
```
Methods:
-- client.data_sources.connectors.create(data_source_id, \*\*params) -> ConnectorCreateResponse
-- client.data_sources.connectors.retrieve(connector_id, \*, data_source_id) -> ConnectorRetrieveResponse
-- client.data_sources.connectors.update(connector_id, \*, data_source_id, \*\*params) -> ConnectorUpdateResponse
-- client.data_sources.connectors.list(data_source_id, \*\*params) -> SyncLimitOffset[ConnectorListResponse]
+- client.data_sources.connectors.create(data_source_id, \*\*params) -> DataSourceConnector
+- client.data_sources.connectors.retrieve(connector_id, \*, data_source_id) -> DataSourceConnector
+- client.data_sources.connectors.update(connector_id, \*, data_source_id, \*\*params) -> DataSourceConnector
+- client.data_sources.connectors.list(data_source_id, \*\*params) -> SyncLimitOffset[DataSourceConnector]
- client.data_sources.connectors.delete(connector_id, \*, data_source_id) -> ConnectorDeleteResponse
+
+# APIKeys
+
+Types:
+
+```python
+from mixedbread.types import APIKey, APIKeyCreated, APIKeyDeleteResponse
+```
+
+Methods:
+
+- client.api_keys.create(\*\*params) -> APIKeyCreated
+- client.api_keys.retrieve(api_key_id) -> APIKey
+- client.api_keys.list(\*\*params) -> SyncLimitOffset[APIKey]
+- client.api_keys.delete(api_key_id) -> APIKeyDeleteResponse
+- client.api_keys.reroll(api_key_id) -> APIKeyCreated
+- client.api_keys.revoke(api_key_id) -> APIKey
diff --git a/src/mixedbread/_client.py b/src/mixedbread/_client.py
index 082f61ef..87e724e0 100644
--- a/src/mixedbread/_client.py
+++ b/src/mixedbread/_client.py
@@ -36,7 +36,7 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
-from .resources import chat, files, embeddings
+from .resources import chat, files, api_keys, embeddings
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import APIStatusError, MixedbreadError
from ._base_client import (
@@ -48,6 +48,7 @@
from .resources.parsing import parsing
from .types.info_response import InfoResponse
from .resources.extractions import extractions
+from .types.encoding_format import EncodingFormat
from .types.rerank_response import RerankResponse
from .resources.data_sources import data_sources
from .resources.vector_stores import vector_stores
@@ -79,6 +80,7 @@ class Mixedbread(SyncAPIClient):
embeddings: embeddings.EmbeddingsResource
chat: chat.ChatResource
data_sources: data_sources.DataSourcesResource
+ api_keys: api_keys.APIKeysResource
with_raw_response: MixedbreadWithRawResponse
with_streaming_response: MixedbreadWithStreamedResponse
@@ -167,6 +169,7 @@ def __init__(
self.embeddings = embeddings.EmbeddingsResource(self)
self.chat = chat.ChatResource(self)
self.data_sources = data_sources.DataSourcesResource(self)
+ self.api_keys = api_keys.APIKeysResource(self)
self.with_raw_response = MixedbreadWithRawResponse(self)
self.with_streaming_response = MixedbreadWithStreamedResponse(self)
@@ -251,11 +254,7 @@ def embed(
dimensions: Optional[int] | NotGiven = NOT_GIVEN,
prompt: Optional[str] | NotGiven = NOT_GIVEN,
normalized: bool | 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,
+ encoding_format: Union[EncodingFormat, List[EncodingFormat]] | 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,
@@ -444,6 +443,7 @@ class AsyncMixedbread(AsyncAPIClient):
embeddings: embeddings.AsyncEmbeddingsResource
chat: chat.AsyncChatResource
data_sources: data_sources.AsyncDataSourcesResource
+ api_keys: api_keys.AsyncAPIKeysResource
with_raw_response: AsyncMixedbreadWithRawResponse
with_streaming_response: AsyncMixedbreadWithStreamedResponse
@@ -532,6 +532,7 @@ def __init__(
self.embeddings = embeddings.AsyncEmbeddingsResource(self)
self.chat = chat.AsyncChatResource(self)
self.data_sources = data_sources.AsyncDataSourcesResource(self)
+ self.api_keys = api_keys.AsyncAPIKeysResource(self)
self.with_raw_response = AsyncMixedbreadWithRawResponse(self)
self.with_streaming_response = AsyncMixedbreadWithStreamedResponse(self)
@@ -616,11 +617,7 @@ async def embed(
dimensions: Optional[int] | NotGiven = NOT_GIVEN,
prompt: Optional[str] | NotGiven = NOT_GIVEN,
normalized: bool | 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,
+ encoding_format: Union[EncodingFormat, List[EncodingFormat]] | 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,
@@ -810,6 +807,7 @@ def __init__(self, client: Mixedbread) -> None:
self.embeddings = embeddings.EmbeddingsResourceWithRawResponse(client.embeddings)
self.chat = chat.ChatResourceWithRawResponse(client.chat)
self.data_sources = data_sources.DataSourcesResourceWithRawResponse(client.data_sources)
+ self.api_keys = api_keys.APIKeysResourceWithRawResponse(client.api_keys)
self.embed = to_raw_response_wrapper(
client.embed,
@@ -831,6 +829,7 @@ def __init__(self, client: AsyncMixedbread) -> None:
self.embeddings = embeddings.AsyncEmbeddingsResourceWithRawResponse(client.embeddings)
self.chat = chat.AsyncChatResourceWithRawResponse(client.chat)
self.data_sources = data_sources.AsyncDataSourcesResourceWithRawResponse(client.data_sources)
+ self.api_keys = api_keys.AsyncAPIKeysResourceWithRawResponse(client.api_keys)
self.embed = async_to_raw_response_wrapper(
client.embed,
@@ -852,6 +851,7 @@ def __init__(self, client: Mixedbread) -> None:
self.embeddings = embeddings.EmbeddingsResourceWithStreamingResponse(client.embeddings)
self.chat = chat.ChatResourceWithStreamingResponse(client.chat)
self.data_sources = data_sources.DataSourcesResourceWithStreamingResponse(client.data_sources)
+ self.api_keys = api_keys.APIKeysResourceWithStreamingResponse(client.api_keys)
self.embed = to_streamed_response_wrapper(
client.embed,
@@ -873,6 +873,7 @@ def __init__(self, client: AsyncMixedbread) -> None:
self.embeddings = embeddings.AsyncEmbeddingsResourceWithStreamingResponse(client.embeddings)
self.chat = chat.AsyncChatResourceWithStreamingResponse(client.chat)
self.data_sources = data_sources.AsyncDataSourcesResourceWithStreamingResponse(client.data_sources)
+ self.api_keys = api_keys.AsyncAPIKeysResourceWithStreamingResponse(client.api_keys)
self.embed = async_to_streamed_response_wrapper(
client.embed,
diff --git a/src/mixedbread/resources/__init__.py b/src/mixedbread/resources/__init__.py
index 21f67148..241510a2 100644
--- a/src/mixedbread/resources/__init__.py
+++ b/src/mixedbread/resources/__init__.py
@@ -24,6 +24,14 @@
ParsingResourceWithStreamingResponse,
AsyncParsingResourceWithStreamingResponse,
)
+from .api_keys import (
+ APIKeysResource,
+ AsyncAPIKeysResource,
+ APIKeysResourceWithRawResponse,
+ AsyncAPIKeysResourceWithRawResponse,
+ APIKeysResourceWithStreamingResponse,
+ AsyncAPIKeysResourceWithStreamingResponse,
+)
from .embeddings import (
EmbeddingsResource,
AsyncEmbeddingsResource,
@@ -100,4 +108,10 @@
"AsyncDataSourcesResourceWithRawResponse",
"DataSourcesResourceWithStreamingResponse",
"AsyncDataSourcesResourceWithStreamingResponse",
+ "APIKeysResource",
+ "AsyncAPIKeysResource",
+ "APIKeysResourceWithRawResponse",
+ "AsyncAPIKeysResourceWithRawResponse",
+ "APIKeysResourceWithStreamingResponse",
+ "AsyncAPIKeysResourceWithStreamingResponse",
]
diff --git a/src/mixedbread/resources/api_keys.py b/src/mixedbread/resources/api_keys.py
new file mode 100644
index 00000000..9de4c7fe
--- /dev/null
+++ b/src/mixedbread/resources/api_keys.py
@@ -0,0 +1,683 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union
+from datetime import datetime
+
+import httpx
+
+from ..types import api_key_list_params, api_key_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 ..pagination import SyncLimitOffset, AsyncLimitOffset
+from .._base_client import AsyncPaginator, make_request_options
+from ..types.api_key import APIKey
+from ..types.api_key_created import APIKeyCreated
+from ..types.api_key_delete_response import APIKeyDeleteResponse
+
+__all__ = ["APIKeysResource", "AsyncAPIKeysResource"]
+
+
+class APIKeysResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> APIKeysResourceWithRawResponse:
+ """
+ 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 APIKeysResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> APIKeysResourceWithStreamingResponse:
+ """
+ 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 APIKeysResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ name: str | NotGiven = NOT_GIVEN,
+ expires_at: Union[str, datetime, None] | 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,
+ ) -> APIKeyCreated:
+ """
+ Create a new API key.
+
+ Args: params: The parameters for creating the API key.
+
+ Returns: ApiKeyCreated: The response containing the details of the created API
+ key.
+
+ Args:
+ name: A name/description for the API key
+
+ expires_at: Optional expiration datetime
+
+ 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/api-keys",
+ body=maybe_transform(
+ {
+ "name": name,
+ "expires_at": expires_at,
+ },
+ api_key_create_params.APIKeyCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=APIKeyCreated,
+ )
+
+ def retrieve(
+ self,
+ api_key_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,
+ ) -> APIKey:
+ """
+ Retrieve details of a specific API key by its ID.
+
+ Args: api_key_id: The ID of the API key to retrieve.
+
+ Returns: ApiKey: The response containing the API key details.
+
+ Args:
+ api_key_id: The ID of the API key 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 api_key_id:
+ raise ValueError(f"Expected a non-empty value for `api_key_id` but received {api_key_id!r}")
+ return self._get(
+ f"/v1/api-keys/{api_key_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=APIKey,
+ )
+
+ def list(
+ self,
+ *,
+ limit: int | NotGiven = NOT_GIVEN,
+ offset: 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,
+ ) -> SyncLimitOffset[APIKey]:
+ """
+ List all API keys for the authenticated user.
+
+ Args: pagination: The pagination options
+
+ Returns: A list of API keys belonging to the user.
+
+ Args:
+ limit: Maximum number of items to return per page
+
+ offset: Offset of the first item 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._get_api_list(
+ "/v1/api-keys",
+ page=SyncLimitOffset[APIKey],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "limit": limit,
+ "offset": offset,
+ },
+ api_key_list_params.APIKeyListParams,
+ ),
+ ),
+ model=APIKey,
+ )
+
+ def delete(
+ self,
+ api_key_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,
+ ) -> APIKeyDeleteResponse:
+ """
+ Delete a specific API key by its ID.
+
+ Args: api_key_id: The ID of the API key to delete.
+
+ Returns: ApiKeyDeleted: The response containing the details of the deleted API
+ key.
+
+ Args:
+ api_key_id: The ID of the API key to delete
+
+ 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 api_key_id:
+ raise ValueError(f"Expected a non-empty value for `api_key_id` but received {api_key_id!r}")
+ return self._delete(
+ f"/v1/api-keys/{api_key_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=APIKeyDeleteResponse,
+ )
+
+ def reroll(
+ self,
+ api_key_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,
+ ) -> APIKeyCreated:
+ """
+ Reroll the secret for a specific API key by its ID.
+
+ This generates a new secret key, invalidating the old one.
+
+ Args: api_key_id: The ID of the API key to reroll.
+
+ Returns: ApiKeyCreated: The response containing the API key details with the new
+ secret key.
+
+ Args:
+ api_key_id: The ID of the API key to reroll
+
+ 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 api_key_id:
+ raise ValueError(f"Expected a non-empty value for `api_key_id` but received {api_key_id!r}")
+ return self._post(
+ f"/v1/api-keys/{api_key_id}/reroll",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=APIKeyCreated,
+ )
+
+ def revoke(
+ self,
+ api_key_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,
+ ) -> APIKey:
+ """
+ Revoke a specific API key by its ID.
+
+ Args: api_key_id: The ID of the API key to revoke.
+
+ Returns: ApiKey: The response containing the details of the revoked API key.
+
+ Args:
+ api_key_id: The ID of the API key to revoke
+
+ 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 api_key_id:
+ raise ValueError(f"Expected a non-empty value for `api_key_id` but received {api_key_id!r}")
+ return self._post(
+ f"/v1/api-keys/{api_key_id}/revoke",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=APIKey,
+ )
+
+
+class AsyncAPIKeysResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncAPIKeysResourceWithRawResponse:
+ """
+ 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 AsyncAPIKeysResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncAPIKeysResourceWithStreamingResponse:
+ """
+ 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 AsyncAPIKeysResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ name: str | NotGiven = NOT_GIVEN,
+ expires_at: Union[str, datetime, None] | 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,
+ ) -> APIKeyCreated:
+ """
+ Create a new API key.
+
+ Args: params: The parameters for creating the API key.
+
+ Returns: ApiKeyCreated: The response containing the details of the created API
+ key.
+
+ Args:
+ name: A name/description for the API key
+
+ expires_at: Optional expiration datetime
+
+ 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/api-keys",
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "expires_at": expires_at,
+ },
+ api_key_create_params.APIKeyCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=APIKeyCreated,
+ )
+
+ async def retrieve(
+ self,
+ api_key_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,
+ ) -> APIKey:
+ """
+ Retrieve details of a specific API key by its ID.
+
+ Args: api_key_id: The ID of the API key to retrieve.
+
+ Returns: ApiKey: The response containing the API key details.
+
+ Args:
+ api_key_id: The ID of the API key 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 api_key_id:
+ raise ValueError(f"Expected a non-empty value for `api_key_id` but received {api_key_id!r}")
+ return await self._get(
+ f"/v1/api-keys/{api_key_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=APIKey,
+ )
+
+ def list(
+ self,
+ *,
+ limit: int | NotGiven = NOT_GIVEN,
+ offset: 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,
+ ) -> AsyncPaginator[APIKey, AsyncLimitOffset[APIKey]]:
+ """
+ List all API keys for the authenticated user.
+
+ Args: pagination: The pagination options
+
+ Returns: A list of API keys belonging to the user.
+
+ Args:
+ limit: Maximum number of items to return per page
+
+ offset: Offset of the first item 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._get_api_list(
+ "/v1/api-keys",
+ page=AsyncLimitOffset[APIKey],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "limit": limit,
+ "offset": offset,
+ },
+ api_key_list_params.APIKeyListParams,
+ ),
+ ),
+ model=APIKey,
+ )
+
+ async def delete(
+ self,
+ api_key_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,
+ ) -> APIKeyDeleteResponse:
+ """
+ Delete a specific API key by its ID.
+
+ Args: api_key_id: The ID of the API key to delete.
+
+ Returns: ApiKeyDeleted: The response containing the details of the deleted API
+ key.
+
+ Args:
+ api_key_id: The ID of the API key to delete
+
+ 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 api_key_id:
+ raise ValueError(f"Expected a non-empty value for `api_key_id` but received {api_key_id!r}")
+ return await self._delete(
+ f"/v1/api-keys/{api_key_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=APIKeyDeleteResponse,
+ )
+
+ async def reroll(
+ self,
+ api_key_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,
+ ) -> APIKeyCreated:
+ """
+ Reroll the secret for a specific API key by its ID.
+
+ This generates a new secret key, invalidating the old one.
+
+ Args: api_key_id: The ID of the API key to reroll.
+
+ Returns: ApiKeyCreated: The response containing the API key details with the new
+ secret key.
+
+ Args:
+ api_key_id: The ID of the API key to reroll
+
+ 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 api_key_id:
+ raise ValueError(f"Expected a non-empty value for `api_key_id` but received {api_key_id!r}")
+ return await self._post(
+ f"/v1/api-keys/{api_key_id}/reroll",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=APIKeyCreated,
+ )
+
+ async def revoke(
+ self,
+ api_key_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,
+ ) -> APIKey:
+ """
+ Revoke a specific API key by its ID.
+
+ Args: api_key_id: The ID of the API key to revoke.
+
+ Returns: ApiKey: The response containing the details of the revoked API key.
+
+ Args:
+ api_key_id: The ID of the API key to revoke
+
+ 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 api_key_id:
+ raise ValueError(f"Expected a non-empty value for `api_key_id` but received {api_key_id!r}")
+ return await self._post(
+ f"/v1/api-keys/{api_key_id}/revoke",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=APIKey,
+ )
+
+
+class APIKeysResourceWithRawResponse:
+ def __init__(self, api_keys: APIKeysResource) -> None:
+ self._api_keys = api_keys
+
+ self.create = to_raw_response_wrapper(
+ api_keys.create,
+ )
+ self.retrieve = to_raw_response_wrapper(
+ api_keys.retrieve,
+ )
+ self.list = to_raw_response_wrapper(
+ api_keys.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ api_keys.delete,
+ )
+ self.reroll = to_raw_response_wrapper(
+ api_keys.reroll,
+ )
+ self.revoke = to_raw_response_wrapper(
+ api_keys.revoke,
+ )
+
+
+class AsyncAPIKeysResourceWithRawResponse:
+ def __init__(self, api_keys: AsyncAPIKeysResource) -> None:
+ self._api_keys = api_keys
+
+ self.create = async_to_raw_response_wrapper(
+ api_keys.create,
+ )
+ self.retrieve = async_to_raw_response_wrapper(
+ api_keys.retrieve,
+ )
+ self.list = async_to_raw_response_wrapper(
+ api_keys.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ api_keys.delete,
+ )
+ self.reroll = async_to_raw_response_wrapper(
+ api_keys.reroll,
+ )
+ self.revoke = async_to_raw_response_wrapper(
+ api_keys.revoke,
+ )
+
+
+class APIKeysResourceWithStreamingResponse:
+ def __init__(self, api_keys: APIKeysResource) -> None:
+ self._api_keys = api_keys
+
+ self.create = to_streamed_response_wrapper(
+ api_keys.create,
+ )
+ self.retrieve = to_streamed_response_wrapper(
+ api_keys.retrieve,
+ )
+ self.list = to_streamed_response_wrapper(
+ api_keys.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ api_keys.delete,
+ )
+ self.reroll = to_streamed_response_wrapper(
+ api_keys.reroll,
+ )
+ self.revoke = to_streamed_response_wrapper(
+ api_keys.revoke,
+ )
+
+
+class AsyncAPIKeysResourceWithStreamingResponse:
+ def __init__(self, api_keys: AsyncAPIKeysResource) -> None:
+ self._api_keys = api_keys
+
+ self.create = async_to_streamed_response_wrapper(
+ api_keys.create,
+ )
+ self.retrieve = async_to_streamed_response_wrapper(
+ api_keys.retrieve,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ api_keys.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ api_keys.delete,
+ )
+ self.reroll = async_to_streamed_response_wrapper(
+ api_keys.reroll,
+ )
+ self.revoke = async_to_streamed_response_wrapper(
+ api_keys.revoke,
+ )
diff --git a/src/mixedbread/resources/data_sources/connectors.py b/src/mixedbread/resources/data_sources/connectors.py
index f05318ee..435ca0e1 100644
--- a/src/mixedbread/resources/data_sources/connectors.py
+++ b/src/mixedbread/resources/data_sources/connectors.py
@@ -19,11 +19,8 @@
from ...pagination import SyncLimitOffset, AsyncLimitOffset
from ..._base_client import AsyncPaginator, make_request_options
from ...types.data_sources import connector_list_params, connector_create_params, connector_update_params
-from ...types.data_sources.connector_list_response import ConnectorListResponse
-from ...types.data_sources.connector_create_response import ConnectorCreateResponse
+from ...types.data_sources.data_source_connector import DataSourceConnector
from ...types.data_sources.connector_delete_response import ConnectorDeleteResponse
-from ...types.data_sources.connector_update_response import ConnectorUpdateResponse
-from ...types.data_sources.connector_retrieve_response import ConnectorRetrieveResponse
__all__ = ["ConnectorsResource", "AsyncConnectorsResource"]
@@ -63,7 +60,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> ConnectorCreateResponse:
+ ) -> DataSourceConnector:
"""
Create a new connector.
@@ -110,7 +107,7 @@ def create(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=ConnectorCreateResponse,
+ cast_to=DataSourceConnector,
)
def retrieve(
@@ -124,7 +121,7 @@ def retrieve(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> ConnectorRetrieveResponse:
+ ) -> DataSourceConnector:
"""
Get a connector by ID.
@@ -155,7 +152,7 @@ def retrieve(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=ConnectorRetrieveResponse,
+ cast_to=DataSourceConnector,
)
def update(
@@ -173,7 +170,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> ConnectorUpdateResponse:
+ ) -> DataSourceConnector:
"""
Update a connector.
@@ -222,7 +219,7 @@ def update(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=ConnectorUpdateResponse,
+ cast_to=DataSourceConnector,
)
def list(
@@ -237,7 +234,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> SyncLimitOffset[ConnectorListResponse]:
+ ) -> SyncLimitOffset[DataSourceConnector]:
"""
Get all connectors for a data source.
@@ -265,7 +262,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
return self._get_api_list(
f"/v1/data_sources/{data_source_id}/connectors",
- page=SyncLimitOffset[ConnectorListResponse],
+ page=SyncLimitOffset[DataSourceConnector],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -279,7 +276,7 @@ def list(
connector_list_params.ConnectorListParams,
),
),
- model=ConnectorListResponse,
+ model=DataSourceConnector,
)
def delete(
@@ -363,7 +360,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> ConnectorCreateResponse:
+ ) -> DataSourceConnector:
"""
Create a new connector.
@@ -410,7 +407,7 @@ async def create(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=ConnectorCreateResponse,
+ cast_to=DataSourceConnector,
)
async def retrieve(
@@ -424,7 +421,7 @@ async def retrieve(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> ConnectorRetrieveResponse:
+ ) -> DataSourceConnector:
"""
Get a connector by ID.
@@ -455,7 +452,7 @@ async def retrieve(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=ConnectorRetrieveResponse,
+ cast_to=DataSourceConnector,
)
async def update(
@@ -473,7 +470,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> ConnectorUpdateResponse:
+ ) -> DataSourceConnector:
"""
Update a connector.
@@ -522,7 +519,7 @@ async def update(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=ConnectorUpdateResponse,
+ cast_to=DataSourceConnector,
)
def list(
@@ -537,7 +534,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AsyncPaginator[ConnectorListResponse, AsyncLimitOffset[ConnectorListResponse]]:
+ ) -> AsyncPaginator[DataSourceConnector, AsyncLimitOffset[DataSourceConnector]]:
"""
Get all connectors for a data source.
@@ -565,7 +562,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `data_source_id` but received {data_source_id!r}")
return self._get_api_list(
f"/v1/data_sources/{data_source_id}/connectors",
- page=AsyncLimitOffset[ConnectorListResponse],
+ page=AsyncLimitOffset[DataSourceConnector],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -579,7 +576,7 @@ def list(
connector_list_params.ConnectorListParams,
),
),
- model=ConnectorListResponse,
+ model=DataSourceConnector,
)
async def delete(
diff --git a/src/mixedbread/resources/data_sources/data_sources.py b/src/mixedbread/resources/data_sources/data_sources.py
index e0a0d125..a579c6ac 100644
--- a/src/mixedbread/resources/data_sources/data_sources.py
+++ b/src/mixedbread/resources/data_sources/data_sources.py
@@ -3,11 +3,15 @@
from __future__ import annotations
from typing import Optional
-from typing_extensions import Literal
import httpx
-from ...types import data_source_list_params, data_source_create_params, data_source_update_params
+from ...types import (
+ DataSourceType,
+ data_source_list_params,
+ data_source_create_params,
+ data_source_update_params,
+)
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
@@ -28,11 +32,10 @@
)
from ...pagination import SyncLimitOffset, AsyncLimitOffset
from ..._base_client import AsyncPaginator, make_request_options
-from ...types.data_source_list_response import DataSourceListResponse
-from ...types.data_source_create_response import DataSourceCreateResponse
+from ...types.data_source import DataSource
+from ...types.data_source_type import DataSourceType
from ...types.data_source_delete_response import DataSourceDeleteResponse
-from ...types.data_source_update_response import DataSourceUpdateResponse
-from ...types.data_source_retrieve_response import DataSourceRetrieveResponse
+from ...types.data_source_oauth2_params_param import DataSourceOauth2ParamsParam
__all__ = ["DataSourcesResource", "AsyncDataSourcesResource"]
@@ -64,17 +67,17 @@ def with_streaming_response(self) -> DataSourcesResourceWithStreamingResponse:
def create(
self,
*,
- type: Literal["notion", "linear"],
+ type: DataSourceType,
name: str,
metadata: object | NotGiven = NOT_GIVEN,
- auth_params: Optional[data_source_create_params.AuthParams] | NotGiven = NOT_GIVEN,
+ auth_params: Optional[DataSourceOauth2ParamsParam] | 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,
- ) -> DataSourceCreateResponse:
+ ) -> DataSource:
"""
Create a new data source.
@@ -113,7 +116,7 @@ def create(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=DataSourceCreateResponse,
+ cast_to=DataSource,
)
def retrieve(
@@ -126,7 +129,7 @@ def retrieve(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> DataSourceRetrieveResponse:
+ ) -> DataSource:
"""
Get a data source by ID.
@@ -152,7 +155,7 @@ def retrieve(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=DataSourceRetrieveResponse,
+ cast_to=DataSource,
)
def update(
@@ -161,14 +164,14 @@ def update(
*,
name: Optional[str] | NotGiven = NOT_GIVEN,
metadata: object | NotGiven = NOT_GIVEN,
- auth_params: Optional[data_source_update_params.AuthParams] | NotGiven = NOT_GIVEN,
+ auth_params: Optional[DataSourceOauth2ParamsParam] | 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,
- ) -> DataSourceUpdateResponse:
+ ) -> DataSource:
"""Update a data source.
Args: data_source_id: The ID of the data source to update.
@@ -210,7 +213,7 @@ def update(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=DataSourceUpdateResponse,
+ cast_to=DataSource,
)
def list(
@@ -224,7 +227,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> SyncLimitOffset[DataSourceListResponse]:
+ ) -> SyncLimitOffset[DataSource]:
"""
Get all data sources.
@@ -245,7 +248,7 @@ def list(
"""
return self._get_api_list(
"/v1/data_sources/",
- page=SyncLimitOffset[DataSourceListResponse],
+ page=SyncLimitOffset[DataSource],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -259,7 +262,7 @@ def list(
data_source_list_params.DataSourceListParams,
),
),
- model=DataSourceListResponse,
+ model=DataSource,
)
def delete(
@@ -327,17 +330,17 @@ def with_streaming_response(self) -> AsyncDataSourcesResourceWithStreamingRespon
async def create(
self,
*,
- type: Literal["notion", "linear"],
+ type: DataSourceType,
name: str,
metadata: object | NotGiven = NOT_GIVEN,
- auth_params: Optional[data_source_create_params.AuthParams] | NotGiven = NOT_GIVEN,
+ auth_params: Optional[DataSourceOauth2ParamsParam] | 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,
- ) -> DataSourceCreateResponse:
+ ) -> DataSource:
"""
Create a new data source.
@@ -376,7 +379,7 @@ async def create(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=DataSourceCreateResponse,
+ cast_to=DataSource,
)
async def retrieve(
@@ -389,7 +392,7 @@ async def retrieve(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> DataSourceRetrieveResponse:
+ ) -> DataSource:
"""
Get a data source by ID.
@@ -415,7 +418,7 @@ async def retrieve(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=DataSourceRetrieveResponse,
+ cast_to=DataSource,
)
async def update(
@@ -424,14 +427,14 @@ async def update(
*,
name: Optional[str] | NotGiven = NOT_GIVEN,
metadata: object | NotGiven = NOT_GIVEN,
- auth_params: Optional[data_source_update_params.AuthParams] | NotGiven = NOT_GIVEN,
+ auth_params: Optional[DataSourceOauth2ParamsParam] | 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,
- ) -> DataSourceUpdateResponse:
+ ) -> DataSource:
"""Update a data source.
Args: data_source_id: The ID of the data source to update.
@@ -473,7 +476,7 @@ async def update(
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=DataSourceUpdateResponse,
+ cast_to=DataSource,
)
def list(
@@ -487,7 +490,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AsyncPaginator[DataSourceListResponse, AsyncLimitOffset[DataSourceListResponse]]:
+ ) -> AsyncPaginator[DataSource, AsyncLimitOffset[DataSource]]:
"""
Get all data sources.
@@ -508,7 +511,7 @@ def list(
"""
return self._get_api_list(
"/v1/data_sources/",
- page=AsyncLimitOffset[DataSourceListResponse],
+ page=AsyncLimitOffset[DataSource],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -522,7 +525,7 @@ def list(
data_source_list_params.DataSourceListParams,
),
),
- model=DataSourceListResponse,
+ model=DataSource,
)
async def delete(
diff --git a/src/mixedbread/resources/embeddings.py b/src/mixedbread/resources/embeddings.py
index 72e10c5d..84d90cce 100644
--- a/src/mixedbread/resources/embeddings.py
+++ b/src/mixedbread/resources/embeddings.py
@@ -3,7 +3,6 @@
from __future__ import annotations
from typing import List, Union, Optional
-from typing_extensions import Literal
import httpx
@@ -19,6 +18,7 @@
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
+from ..types.encoding_format import EncodingFormat
from ..types.embedding_create_response import EmbeddingCreateResponse
__all__ = ["EmbeddingsResource", "AsyncEmbeddingsResource"]
@@ -52,11 +52,7 @@ def create(
dimensions: Optional[int] | NotGiven = NOT_GIVEN,
prompt: Optional[str] | NotGiven = NOT_GIVEN,
normalized: bool | 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,
+ encoding_format: Union[EncodingFormat, List[EncodingFormat]] | 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,
@@ -142,11 +138,7 @@ async def create(
dimensions: Optional[int] | NotGiven = NOT_GIVEN,
prompt: Optional[str] | NotGiven = NOT_GIVEN,
normalized: bool | 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,
+ encoding_format: Union[EncodingFormat, List[EncodingFormat]] | 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,
diff --git a/src/mixedbread/resources/parsing/jobs.py b/src/mixedbread/resources/parsing/jobs.py
index 61b050ff..d0b9f77a 100644
--- a/src/mixedbread/resources/parsing/jobs.py
+++ b/src/mixedbread/resources/parsing/jobs.py
@@ -21,8 +21,11 @@
)
from ...pagination import SyncLimitOffset, AsyncLimitOffset
from ..._base_client import AsyncPaginator, make_request_options
-from ...types.parsing import job_list_params, job_create_params
+from ...types.parsing import ReturnFormat, ChunkingStrategy, job_list_params, job_create_params
from ...types.parsing.parsing_job import ParsingJob
+from ...types.parsing.element_type import ElementType
+from ...types.parsing.return_format import ReturnFormat
+from ...types.parsing.chunking_strategy import ChunkingStrategy
from ...types.parsing.job_list_response import JobListResponse
from ...types.parsing.job_delete_response import JobDeleteResponse
@@ -53,26 +56,9 @@ def create(
self,
*,
file_id: str,
- element_types: Optional[
- List[
- Literal[
- "caption",
- "footnote",
- "formula",
- "list-item",
- "page-footer",
- "page-header",
- "picture",
- "section-header",
- "table",
- "text",
- "title",
- ]
- ]
- ]
- | NotGiven = NOT_GIVEN,
- chunking_strategy: Literal["page"] | NotGiven = NOT_GIVEN,
- return_format: Literal["html", "markdown", "plain"] | NotGiven = NOT_GIVEN,
+ element_types: Optional[List[ElementType]] | NotGiven = NOT_GIVEN,
+ chunking_strategy: ChunkingStrategy | NotGiven = NOT_GIVEN,
+ return_format: ReturnFormat | NotGiven = NOT_GIVEN,
mode: Literal["fast", "high_quality"] | 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.
@@ -476,26 +462,9 @@ async def create(
self,
*,
file_id: str,
- element_types: Optional[
- List[
- Literal[
- "caption",
- "footnote",
- "formula",
- "list-item",
- "page-footer",
- "page-header",
- "picture",
- "section-header",
- "table",
- "text",
- "title",
- ]
- ]
- ]
- | NotGiven = NOT_GIVEN,
- chunking_strategy: Literal["page"] | NotGiven = NOT_GIVEN,
- return_format: Literal["html", "markdown", "plain"] | NotGiven = NOT_GIVEN,
+ element_types: Optional[List[ElementType]] | NotGiven = NOT_GIVEN,
+ chunking_strategy: ChunkingStrategy | NotGiven = NOT_GIVEN,
+ return_format: ReturnFormat | NotGiven = NOT_GIVEN,
mode: Literal["fast", "high_quality"] | 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.
diff --git a/src/mixedbread/types/__init__.py b/src/mixedbread/types/__init__.py
index 31efbe4f..e7310fd0 100644
--- a/src/mixedbread/types/__init__.py
+++ b/src/mixedbread/types/__init__.py
@@ -3,38 +3,46 @@
from __future__ import annotations
from .shared import Usage as Usage, SearchFilter as SearchFilter, SearchFilterCondition as SearchFilterCondition
+from .api_key import APIKey as APIKey
from .embedding import Embedding as Embedding
+from .data_source import DataSource as DataSource
from .file_counts import FileCounts as FileCounts
from .file_object import FileObject as FileObject
+from .object_type import ObjectType as ObjectType
from .vector_store import VectorStore as VectorStore
from .expires_after import ExpiresAfter as ExpiresAfter
from .info_response import InfoResponse as InfoResponse
+from .api_key_created import APIKeyCreated as APIKeyCreated
+from .encoding_format import EncodingFormat as EncodingFormat
from .rerank_response import RerankResponse as RerankResponse
+from .data_source_type import DataSourceType as DataSourceType
from .file_list_params import FileListParams as FileListParams
from .file_create_params import FileCreateParams as FileCreateParams
from .file_update_params import FileUpdateParams as FileUpdateParams
+from .api_key_list_params import APIKeyListParams as APIKeyListParams
from .client_embed_params import ClientEmbedParams as ClientEmbedParams
from .expires_after_param import ExpiresAfterParam as ExpiresAfterParam
from .client_rerank_params import ClientRerankParams as ClientRerankParams
from .file_delete_response import FileDeleteResponse as FileDeleteResponse
+from .api_key_create_params import APIKeyCreateParams as APIKeyCreateParams
+from .pagination_with_total import PaginationWithTotal as PaginationWithTotal
+from .api_key_delete_response import APIKeyDeleteResponse as APIKeyDeleteResponse
from .data_source_list_params import DataSourceListParams as DataSourceListParams
from .embedding_create_params import EmbeddingCreateParams as EmbeddingCreateParams
from .multi_encoding_embedding import MultiEncodingEmbedding as MultiEncodingEmbedding
from .vector_store_list_params import VectorStoreListParams as VectorStoreListParams
from .data_source_create_params import DataSourceCreateParams as DataSourceCreateParams
-from .data_source_list_response import DataSourceListResponse as DataSourceListResponse
+from .data_source_oauth2_params import DataSourceOauth2Params as DataSourceOauth2Params
from .data_source_update_params import DataSourceUpdateParams as DataSourceUpdateParams
from .embedding_create_response import EmbeddingCreateResponse as EmbeddingCreateResponse
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
from .vector_store_update_params import VectorStoreUpdateParams as VectorStoreUpdateParams
-from .data_source_create_response import DataSourceCreateResponse as DataSourceCreateResponse
from .data_source_delete_response import DataSourceDeleteResponse as DataSourceDeleteResponse
-from .data_source_update_response import DataSourceUpdateResponse as DataSourceUpdateResponse
from .vector_store_delete_response import VectorStoreDeleteResponse as VectorStoreDeleteResponse
from .vector_store_search_response import VectorStoreSearchResponse as VectorStoreSearchResponse
-from .data_source_retrieve_response import DataSourceRetrieveResponse as DataSourceRetrieveResponse
+from .data_source_oauth2_params_param import DataSourceOauth2ParamsParam as DataSourceOauth2ParamsParam
from .vector_store_file_search_options_param import (
VectorStoreFileSearchOptionsParam as VectorStoreFileSearchOptionsParam,
)
diff --git a/src/mixedbread/types/api_key.py b/src/mixedbread/types/api_key.py
new file mode 100644
index 00000000..15e7cbc2
--- /dev/null
+++ b/src/mixedbread/types/api_key.py
@@ -0,0 +1,35 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["APIKey"]
+
+
+class APIKey(BaseModel):
+ id: str
+ """The ID of the API key"""
+
+ name: str
+ """The name of the API key"""
+
+ redacted_value: str
+ """The redacted value of the API key"""
+
+ expires_at: Optional[datetime] = None
+ """The expiration datetime of the API key"""
+
+ created_at: datetime
+ """The creation datetime of the API key"""
+
+ updated_at: datetime
+ """The last update datetime of the API key"""
+
+ last_active_at: Optional[datetime] = None
+ """The last active datetime of the API key"""
+
+ object: Optional[Literal["api_key"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/api_key_create_params.py b/src/mixedbread/types/api_key_create_params.py
new file mode 100644
index 00000000..074ae0e0
--- /dev/null
+++ b/src/mixedbread/types/api_key_create_params.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union
+from datetime import datetime
+from typing_extensions import Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["APIKeyCreateParams"]
+
+
+class APIKeyCreateParams(TypedDict, total=False):
+ name: str
+ """A name/description for the API key"""
+
+ expires_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
+ """Optional expiration datetime"""
diff --git a/src/mixedbread/types/api_key_created.py b/src/mixedbread/types/api_key_created.py
new file mode 100644
index 00000000..052910e8
--- /dev/null
+++ b/src/mixedbread/types/api_key_created.py
@@ -0,0 +1,38 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["APIKeyCreated"]
+
+
+class APIKeyCreated(BaseModel):
+ id: str
+ """The ID of the API key"""
+
+ name: str
+ """The name of the API key"""
+
+ redacted_value: str
+ """The redacted value of the API key"""
+
+ expires_at: Optional[datetime] = None
+ """The expiration datetime of the API key"""
+
+ created_at: datetime
+ """The creation datetime of the API key"""
+
+ updated_at: datetime
+ """The last update datetime of the API key"""
+
+ last_active_at: Optional[datetime] = None
+ """The last active datetime of the API key"""
+
+ object: Optional[Literal["api_key"]] = None
+ """The type of the object"""
+
+ value: str
+ """The value of the API key"""
diff --git a/src/mixedbread/types/api_key_delete_response.py b/src/mixedbread/types/api_key_delete_response.py
new file mode 100644
index 00000000..e3fc0590
--- /dev/null
+++ b/src/mixedbread/types/api_key_delete_response.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from .._models import BaseModel
+
+__all__ = ["APIKeyDeleteResponse"]
+
+
+class APIKeyDeleteResponse(BaseModel):
+ id: str
+ """The ID of the deleted API key"""
+
+ deleted: bool
+ """Whether the API key was deleted"""
+
+ object: Optional[Literal["api_key"]] = None
+ """The type of the object deleted"""
diff --git a/src/mixedbread/types/api_key_list_params.py b/src/mixedbread/types/api_key_list_params.py
new file mode 100644
index 00000000..748045a4
--- /dev/null
+++ b/src/mixedbread/types/api_key_list_params.py
@@ -0,0 +1,15 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import TypedDict
+
+__all__ = ["APIKeyListParams"]
+
+
+class APIKeyListParams(TypedDict, total=False):
+ limit: int
+ """Maximum number of items to return per page"""
+
+ offset: int
+ """Offset of the first item to return"""
diff --git a/src/mixedbread/types/client_embed_params.py b/src/mixedbread/types/client_embed_params.py
index 3f27c1a3..9636bb6a 100644
--- a/src/mixedbread/types/client_embed_params.py
+++ b/src/mixedbread/types/client_embed_params.py
@@ -3,7 +3,9 @@
from __future__ import annotations
from typing import List, Union, Optional
-from typing_extensions import Literal, Required, TypedDict
+from typing_extensions import Required, TypedDict
+
+from .encoding_format import EncodingFormat
__all__ = ["ClientEmbedParams"]
@@ -24,10 +26,7 @@ class ClientEmbedParams(TypedDict, total=False):
normalized: bool
"""Whether to normalize the embeddings."""
- encoding_format: Union[
- Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"],
- List[Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"]],
- ]
+ encoding_format: Union[EncodingFormat, List[EncodingFormat]]
"""The encoding format(s) of the embeddings.
Can be a single format or a list of formats.
diff --git a/src/mixedbread/types/data_source.py b/src/mixedbread/types/data_source.py
new file mode 100644
index 00000000..d02682e1
--- /dev/null
+++ b/src/mixedbread/types/data_source.py
@@ -0,0 +1,37 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from .._models import BaseModel
+from .data_source_type import DataSourceType
+from .data_source_oauth2_params import DataSourceOauth2Params
+
+__all__ = ["DataSource"]
+
+
+class DataSource(BaseModel):
+ id: str
+ """The ID of the data source"""
+
+ created_at: datetime
+ """The creation time of the data source"""
+
+ updated_at: datetime
+ """The last update time of the data source"""
+
+ type: DataSourceType
+ """The type of data source"""
+
+ name: str
+ """The name of the data source"""
+
+ metadata: object
+ """The metadata of the data source"""
+
+ auth_params: Optional[DataSourceOauth2Params] = None
+ """Authentication parameters for a OAuth data source."""
+
+ object: Optional[Literal["data_source"]] = None
+ """The type of the object"""
diff --git a/src/mixedbread/types/data_source_create_params.py b/src/mixedbread/types/data_source_create_params.py
index 6483d336..af01ebdd 100644
--- a/src/mixedbread/types/data_source_create_params.py
+++ b/src/mixedbread/types/data_source_create_params.py
@@ -2,17 +2,17 @@
from __future__ import annotations
-from typing import Union, Optional
-from datetime import datetime
-from typing_extensions import Literal, Required, Annotated, TypedDict
+from typing import Optional
+from typing_extensions import Required, TypedDict
-from .._utils import PropertyInfo
+from .data_source_type import DataSourceType
+from .data_source_oauth2_params_param import DataSourceOauth2ParamsParam
-__all__ = ["DataSourceCreateParams", "AuthParams"]
+__all__ = ["DataSourceCreateParams"]
class DataSourceCreateParams(TypedDict, total=False):
- type: Required[Literal["notion", "linear"]]
+ type: Required[DataSourceType]
"""The type of data source to create"""
name: Required[str]
@@ -21,36 +21,5 @@ class DataSourceCreateParams(TypedDict, total=False):
metadata: object
"""The metadata of the data source"""
- auth_params: Optional[AuthParams]
+ auth_params: Optional[DataSourceOauth2ParamsParam]
"""Authentication parameters for a OAuth data source."""
-
-
-class AuthParams(TypedDict, total=False):
- type: Literal["oauth2"]
-
- created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
- """The timestamp when the OAuth2 credentials were created"""
-
- client_id: Required[str]
- """The OAuth2 client ID"""
-
- client_secret: Required[str]
- """The OAuth2 client secret"""
-
- redirect_uri: Required[str]
- """The OAuth2 redirect URI"""
-
- scope: Required[str]
- """The OAuth2 scope"""
-
- access_token: Optional[str]
- """The OAuth2 access token"""
-
- refresh_token: Optional[str]
- """The OAuth2 refresh token"""
-
- token_type: Optional[str]
- """The OAuth2 token type"""
-
- expires_on: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
- """The OAuth2 token expiration timestamp"""
diff --git a/src/mixedbread/types/data_source_create_response.py b/src/mixedbread/types/data_source_create_response.py
deleted file mode 100644
index c8ff098e..00000000
--- a/src/mixedbread/types/data_source_create_response.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from .._models import BaseModel
-
-__all__ = ["DataSourceCreateResponse", "AuthParams"]
-
-
-class AuthParams(BaseModel):
- type: Optional[Literal["oauth2"]] = None
-
- created_at: Optional[datetime] = None
- """The timestamp when the OAuth2 credentials were created"""
-
- client_id: str
- """The OAuth2 client ID"""
-
- client_secret: str
- """The OAuth2 client secret"""
-
- redirect_uri: str
- """The OAuth2 redirect URI"""
-
- scope: str
- """The OAuth2 scope"""
-
- access_token: Optional[str] = None
- """The OAuth2 access token"""
-
- refresh_token: Optional[str] = None
- """The OAuth2 refresh token"""
-
- token_type: Optional[str] = None
- """The OAuth2 token type"""
-
- expires_on: Optional[datetime] = None
- """The OAuth2 token expiration timestamp"""
-
-
-class DataSourceCreateResponse(BaseModel):
- id: str
- """The ID of the data source"""
-
- created_at: datetime
- """The creation time of the data source"""
-
- updated_at: datetime
- """The last update time of the data source"""
-
- type: Literal["notion", "linear"]
- """The type of data source"""
-
- name: str
- """The name of the data source"""
-
- metadata: object
- """The metadata of the data source"""
-
- auth_params: Optional[AuthParams] = None
- """Authentication parameters for a OAuth data source."""
-
- object: Optional[Literal["data_source"]] = None
- """The type of the object"""
diff --git a/src/mixedbread/types/data_source_list_response.py b/src/mixedbread/types/data_source_oauth2_params.py
similarity index 55%
rename from src/mixedbread/types/data_source_list_response.py
rename to src/mixedbread/types/data_source_oauth2_params.py
index afe40837..5cda3db5 100644
--- a/src/mixedbread/types/data_source_list_response.py
+++ b/src/mixedbread/types/data_source_oauth2_params.py
@@ -6,10 +6,10 @@
from .._models import BaseModel
-__all__ = ["DataSourceListResponse", "AuthParams"]
+__all__ = ["DataSourceOauth2Params"]
-class AuthParams(BaseModel):
+class DataSourceOauth2Params(BaseModel):
type: Optional[Literal["oauth2"]] = None
created_at: Optional[datetime] = None
@@ -38,29 +38,3 @@ class AuthParams(BaseModel):
expires_on: Optional[datetime] = None
"""The OAuth2 token expiration timestamp"""
-
-
-class DataSourceListResponse(BaseModel):
- id: str
- """The ID of the data source"""
-
- created_at: datetime
- """The creation time of the data source"""
-
- updated_at: datetime
- """The last update time of the data source"""
-
- type: Literal["notion", "linear"]
- """The type of data source"""
-
- name: str
- """The name of the data source"""
-
- metadata: object
- """The metadata of the data source"""
-
- auth_params: Optional[AuthParams] = None
- """Authentication parameters for a OAuth data source."""
-
- object: Optional[Literal["data_source"]] = None
- """The type of the object"""
diff --git a/src/mixedbread/types/data_source_oauth2_params_param.py b/src/mixedbread/types/data_source_oauth2_params_param.py
new file mode 100644
index 00000000..72ff4b56
--- /dev/null
+++ b/src/mixedbread/types/data_source_oauth2_params_param.py
@@ -0,0 +1,42 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Union, Optional
+from datetime import datetime
+from typing_extensions import Literal, Required, Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["DataSourceOauth2ParamsParam"]
+
+
+class DataSourceOauth2ParamsParam(TypedDict, total=False):
+ type: Literal["oauth2"]
+
+ created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
+ """The timestamp when the OAuth2 credentials were created"""
+
+ client_id: Required[str]
+ """The OAuth2 client ID"""
+
+ client_secret: Required[str]
+ """The OAuth2 client secret"""
+
+ redirect_uri: Required[str]
+ """The OAuth2 redirect URI"""
+
+ scope: Required[str]
+ """The OAuth2 scope"""
+
+ access_token: Optional[str]
+ """The OAuth2 access token"""
+
+ refresh_token: Optional[str]
+ """The OAuth2 refresh token"""
+
+ token_type: Optional[str]
+ """The OAuth2 token type"""
+
+ expires_on: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
+ """The OAuth2 token expiration timestamp"""
diff --git a/src/mixedbread/types/data_source_retrieve_response.py b/src/mixedbread/types/data_source_retrieve_response.py
deleted file mode 100644
index e6eda38d..00000000
--- a/src/mixedbread/types/data_source_retrieve_response.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from .._models import BaseModel
-
-__all__ = ["DataSourceRetrieveResponse", "AuthParams"]
-
-
-class AuthParams(BaseModel):
- type: Optional[Literal["oauth2"]] = None
-
- created_at: Optional[datetime] = None
- """The timestamp when the OAuth2 credentials were created"""
-
- client_id: str
- """The OAuth2 client ID"""
-
- client_secret: str
- """The OAuth2 client secret"""
-
- redirect_uri: str
- """The OAuth2 redirect URI"""
-
- scope: str
- """The OAuth2 scope"""
-
- access_token: Optional[str] = None
- """The OAuth2 access token"""
-
- refresh_token: Optional[str] = None
- """The OAuth2 refresh token"""
-
- token_type: Optional[str] = None
- """The OAuth2 token type"""
-
- expires_on: Optional[datetime] = None
- """The OAuth2 token expiration timestamp"""
-
-
-class DataSourceRetrieveResponse(BaseModel):
- id: str
- """The ID of the data source"""
-
- created_at: datetime
- """The creation time of the data source"""
-
- updated_at: datetime
- """The last update time of the data source"""
-
- type: Literal["notion", "linear"]
- """The type of data source"""
-
- name: str
- """The name of the data source"""
-
- metadata: object
- """The metadata of the data source"""
-
- auth_params: Optional[AuthParams] = None
- """Authentication parameters for a OAuth data source."""
-
- object: Optional[Literal["data_source"]] = None
- """The type of the object"""
diff --git a/src/mixedbread/types/data_source_type.py b/src/mixedbread/types/data_source_type.py
new file mode 100644
index 00000000..0851808b
--- /dev/null
+++ b/src/mixedbread/types/data_source_type.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal, TypeAlias
+
+__all__ = ["DataSourceType"]
+
+DataSourceType: TypeAlias = Literal["notion", "linear"]
diff --git a/src/mixedbread/types/data_source_update_params.py b/src/mixedbread/types/data_source_update_params.py
index d5bc1c00..609704a0 100644
--- a/src/mixedbread/types/data_source_update_params.py
+++ b/src/mixedbread/types/data_source_update_params.py
@@ -2,13 +2,12 @@
from __future__ import annotations
-from typing import Union, Optional
-from datetime import datetime
-from typing_extensions import Literal, Required, Annotated, TypedDict
+from typing import Optional
+from typing_extensions import TypedDict
-from .._utils import PropertyInfo
+from .data_source_oauth2_params_param import DataSourceOauth2ParamsParam
-__all__ = ["DataSourceUpdateParams", "AuthParams"]
+__all__ = ["DataSourceUpdateParams"]
class DataSourceUpdateParams(TypedDict, total=False):
@@ -18,36 +17,5 @@ class DataSourceUpdateParams(TypedDict, total=False):
metadata: object
"""The metadata of the data source"""
- auth_params: Optional[AuthParams]
+ auth_params: Optional[DataSourceOauth2ParamsParam]
"""Authentication parameters for a OAuth data source."""
-
-
-class AuthParams(TypedDict, total=False):
- type: Literal["oauth2"]
-
- created_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]
- """The timestamp when the OAuth2 credentials were created"""
-
- client_id: Required[str]
- """The OAuth2 client ID"""
-
- client_secret: Required[str]
- """The OAuth2 client secret"""
-
- redirect_uri: Required[str]
- """The OAuth2 redirect URI"""
-
- scope: Required[str]
- """The OAuth2 scope"""
-
- access_token: Optional[str]
- """The OAuth2 access token"""
-
- refresh_token: Optional[str]
- """The OAuth2 refresh token"""
-
- token_type: Optional[str]
- """The OAuth2 token type"""
-
- expires_on: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
- """The OAuth2 token expiration timestamp"""
diff --git a/src/mixedbread/types/data_source_update_response.py b/src/mixedbread/types/data_source_update_response.py
deleted file mode 100644
index 8820151e..00000000
--- a/src/mixedbread/types/data_source_update_response.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from .._models import BaseModel
-
-__all__ = ["DataSourceUpdateResponse", "AuthParams"]
-
-
-class AuthParams(BaseModel):
- type: Optional[Literal["oauth2"]] = None
-
- created_at: Optional[datetime] = None
- """The timestamp when the OAuth2 credentials were created"""
-
- client_id: str
- """The OAuth2 client ID"""
-
- client_secret: str
- """The OAuth2 client secret"""
-
- redirect_uri: str
- """The OAuth2 redirect URI"""
-
- scope: str
- """The OAuth2 scope"""
-
- access_token: Optional[str] = None
- """The OAuth2 access token"""
-
- refresh_token: Optional[str] = None
- """The OAuth2 refresh token"""
-
- token_type: Optional[str] = None
- """The OAuth2 token type"""
-
- expires_on: Optional[datetime] = None
- """The OAuth2 token expiration timestamp"""
-
-
-class DataSourceUpdateResponse(BaseModel):
- id: str
- """The ID of the data source"""
-
- created_at: datetime
- """The creation time of the data source"""
-
- updated_at: datetime
- """The last update time of the data source"""
-
- type: Literal["notion", "linear"]
- """The type of data source"""
-
- name: str
- """The name of the data source"""
-
- metadata: object
- """The metadata of the data source"""
-
- auth_params: Optional[AuthParams] = None
- """Authentication parameters for a OAuth data source."""
-
- object: Optional[Literal["data_source"]] = None
- """The type of the object"""
diff --git a/src/mixedbread/types/data_sources/__init__.py b/src/mixedbread/types/data_sources/__init__.py
index e02119c0..c35b6f2e 100644
--- a/src/mixedbread/types/data_sources/__init__.py
+++ b/src/mixedbread/types/data_sources/__init__.py
@@ -3,10 +3,7 @@
from __future__ import annotations
from .connector_list_params import ConnectorListParams as ConnectorListParams
+from .data_source_connector import DataSourceConnector as DataSourceConnector
from .connector_create_params import ConnectorCreateParams as ConnectorCreateParams
-from .connector_list_response import ConnectorListResponse as ConnectorListResponse
from .connector_update_params import ConnectorUpdateParams as ConnectorUpdateParams
-from .connector_create_response import ConnectorCreateResponse as ConnectorCreateResponse
from .connector_delete_response import ConnectorDeleteResponse as ConnectorDeleteResponse
-from .connector_update_response import ConnectorUpdateResponse as ConnectorUpdateResponse
-from .connector_retrieve_response import ConnectorRetrieveResponse as ConnectorRetrieveResponse
diff --git a/src/mixedbread/types/data_sources/connector_create_response.py b/src/mixedbread/types/data_sources/connector_create_response.py
deleted file mode 100644
index 583b3866..00000000
--- a/src/mixedbread/types/data_sources/connector_create_response.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from ..._models import BaseModel
-
-__all__ = ["ConnectorCreateResponse"]
-
-
-class ConnectorCreateResponse(BaseModel):
- id: str
- """The ID of the connector"""
-
- created_at: datetime
- """The creation time of the connector"""
-
- updated_at: datetime
- """The last update time of the connector"""
-
- vector_store_id: str
- """The ID of the vector store"""
-
- data_source_id: str
- """The ID of the data source"""
-
- name: Optional[str] = None
- """The name of the connector"""
-
- metadata: object
- """The metadata of the connector"""
-
- polling_interval: str
- """The polling interval of the connector"""
-
- started_at: Optional[datetime] = None
- """The start time of the connector"""
-
- finished_at: Optional[datetime] = None
- """The finish time of the connector"""
-
- last_synced_at: Optional[datetime] = None
- """The last sync time of the connector"""
-
- status: Literal["idle", "pending", "in_progress", "cancelled", "completed", "failed"]
- """The sync status of the connector"""
-
- error: Optional[str] = None
- """The sync error of the connector"""
-
- object: Optional[Literal["data_source.connector"]] = None
- """The type of the object"""
diff --git a/src/mixedbread/types/data_sources/connector_retrieve_response.py b/src/mixedbread/types/data_sources/connector_retrieve_response.py
deleted file mode 100644
index db2f80c5..00000000
--- a/src/mixedbread/types/data_sources/connector_retrieve_response.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from ..._models import BaseModel
-
-__all__ = ["ConnectorRetrieveResponse"]
-
-
-class ConnectorRetrieveResponse(BaseModel):
- id: str
- """The ID of the connector"""
-
- created_at: datetime
- """The creation time of the connector"""
-
- updated_at: datetime
- """The last update time of the connector"""
-
- vector_store_id: str
- """The ID of the vector store"""
-
- data_source_id: str
- """The ID of the data source"""
-
- name: Optional[str] = None
- """The name of the connector"""
-
- metadata: object
- """The metadata of the connector"""
-
- polling_interval: str
- """The polling interval of the connector"""
-
- started_at: Optional[datetime] = None
- """The start time of the connector"""
-
- finished_at: Optional[datetime] = None
- """The finish time of the connector"""
-
- last_synced_at: Optional[datetime] = None
- """The last sync time of the connector"""
-
- status: Literal["idle", "pending", "in_progress", "cancelled", "completed", "failed"]
- """The sync status of the connector"""
-
- error: Optional[str] = None
- """The sync error of the connector"""
-
- object: Optional[Literal["data_source.connector"]] = None
- """The type of the object"""
diff --git a/src/mixedbread/types/data_sources/connector_update_response.py b/src/mixedbread/types/data_sources/connector_update_response.py
deleted file mode 100644
index 4055a322..00000000
--- a/src/mixedbread/types/data_sources/connector_update_response.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from ..._models import BaseModel
-
-__all__ = ["ConnectorUpdateResponse"]
-
-
-class ConnectorUpdateResponse(BaseModel):
- id: str
- """The ID of the connector"""
-
- created_at: datetime
- """The creation time of the connector"""
-
- updated_at: datetime
- """The last update time of the connector"""
-
- vector_store_id: str
- """The ID of the vector store"""
-
- data_source_id: str
- """The ID of the data source"""
-
- name: Optional[str] = None
- """The name of the connector"""
-
- metadata: object
- """The metadata of the connector"""
-
- polling_interval: str
- """The polling interval of the connector"""
-
- started_at: Optional[datetime] = None
- """The start time of the connector"""
-
- finished_at: Optional[datetime] = None
- """The finish time of the connector"""
-
- last_synced_at: Optional[datetime] = None
- """The last sync time of the connector"""
-
- status: Literal["idle", "pending", "in_progress", "cancelled", "completed", "failed"]
- """The sync status of the connector"""
-
- error: Optional[str] = None
- """The sync error of the connector"""
-
- object: Optional[Literal["data_source.connector"]] = None
- """The type of the object"""
diff --git a/src/mixedbread/types/data_sources/connector_list_response.py b/src/mixedbread/types/data_sources/data_source_connector.py
similarity index 94%
rename from src/mixedbread/types/data_sources/connector_list_response.py
rename to src/mixedbread/types/data_sources/data_source_connector.py
index 4a508789..d4276970 100644
--- a/src/mixedbread/types/data_sources/connector_list_response.py
+++ b/src/mixedbread/types/data_sources/data_source_connector.py
@@ -6,10 +6,10 @@
from ..._models import BaseModel
-__all__ = ["ConnectorListResponse"]
+__all__ = ["DataSourceConnector"]
-class ConnectorListResponse(BaseModel):
+class DataSourceConnector(BaseModel):
id: str
"""The ID of the connector"""
diff --git a/src/mixedbread/types/embedding_create_params.py b/src/mixedbread/types/embedding_create_params.py
index 6c9b29f6..e78f3b9a 100644
--- a/src/mixedbread/types/embedding_create_params.py
+++ b/src/mixedbread/types/embedding_create_params.py
@@ -3,7 +3,9 @@
from __future__ import annotations
from typing import List, Union, Optional
-from typing_extensions import Literal, Required, TypedDict
+from typing_extensions import Required, TypedDict
+
+from .encoding_format import EncodingFormat
__all__ = ["EmbeddingCreateParams"]
@@ -24,10 +26,7 @@ class EmbeddingCreateParams(TypedDict, total=False):
normalized: bool
"""Whether to normalize the embeddings."""
- encoding_format: Union[
- Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"],
- List[Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"]],
- ]
+ encoding_format: Union[EncodingFormat, List[EncodingFormat]]
"""The encoding format(s) of the embeddings.
Can be a single format or a list of formats.
diff --git a/src/mixedbread/types/embedding_create_response.py b/src/mixedbread/types/embedding_create_response.py
index 24f996e9..d7389135 100644
--- a/src/mixedbread/types/embedding_create_response.py
+++ b/src/mixedbread/types/embedding_create_response.py
@@ -1,11 +1,12 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import List, Union, Optional
-from typing_extensions import Literal
from .._models import BaseModel
from .embedding import Embedding
+from .object_type import ObjectType
from .shared.usage import Usage
+from .encoding_format import EncodingFormat
from .multi_encoding_embedding import MultiEncodingEmbedding
__all__ = ["EmbeddingCreateResponse"]
@@ -21,31 +22,13 @@ class EmbeddingCreateResponse(BaseModel):
data: Union[List[Embedding], List[MultiEncodingEmbedding]]
"""The created embeddings."""
- object: Optional[
- Literal[
- "list",
- "parsing_job",
- "extraction_job",
- "embedding",
- "embedding_dict",
- "rank_result",
- "file",
- "vector_store",
- "vector_store.file",
- "api_key",
- "data_source",
- "data_source.connector",
- ]
- ] = None
+ object: Optional[ObjectType] = None
"""The object type of the response"""
normalized: bool
"""Whether the embeddings are normalized."""
- encoding_format: Union[
- Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"],
- List[Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"]],
- ]
+ encoding_format: Union[EncodingFormat, List[EncodingFormat]]
"""The encoding formats of the embeddings."""
dimensions: Optional[int] = None
diff --git a/src/mixedbread/types/encoding_format.py b/src/mixedbread/types/encoding_format.py
new file mode 100644
index 00000000..74960945
--- /dev/null
+++ b/src/mixedbread/types/encoding_format.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal, TypeAlias
+
+__all__ = ["EncodingFormat"]
+
+EncodingFormat: TypeAlias = Literal["float", "float16", "base64", "binary", "ubinary", "int8", "uint8"]
diff --git a/src/mixedbread/types/extractions/__init__.py b/src/mixedbread/types/extractions/__init__.py
index 6457c670..22892cfe 100644
--- a/src/mixedbread/types/extractions/__init__.py
+++ b/src/mixedbread/types/extractions/__init__.py
@@ -2,13 +2,17 @@
from __future__ import annotations
+from .text_input import TextInput as TextInput
from .extraction_job import ExtractionJob as ExtractionJob
+from .image_url_input import ImageURLInput as ImageURLInput
+from .text_input_param import TextInputParam as TextInputParam
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 .image_url_input_param import ImageURLInputParam as ImageURLInputParam
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
index 4e3d3ef9..713deb65 100644
--- a/src/mixedbread/types/extractions/content_create_params.py
+++ b/src/mixedbread/types/extractions/content_create_params.py
@@ -3,15 +3,12 @@
from __future__ import annotations
from typing import Dict, List, Union, Iterable, Optional
-from typing_extensions import Literal, Required, TypeAlias, TypedDict
+from typing_extensions import Required, TypeAlias, TypedDict
-__all__ = [
- "ContentCreateParams",
- "ContentUnionMember2",
- "ContentUnionMember2TextInput",
- "ContentUnionMember2ImageURLInput",
- "ContentUnionMember2ImageURLInputImageURL",
-]
+from .text_input_param import TextInputParam
+from .image_url_input_param import ImageURLInputParam
+
+__all__ = ["ContentCreateParams", "ContentUnionMember2"]
class ContentCreateParams(TypedDict, total=False):
@@ -25,25 +22,4 @@ class ContentCreateParams(TypedDict, total=False):
"""Additional instructions for the extraction"""
-class ContentUnionMember2TextInput(TypedDict, total=False):
- type: Literal["text"]
- """Input type identifier"""
-
- text: Required[str]
- """Text content to process"""
-
-
-class ContentUnionMember2ImageURLInputImageURL(TypedDict, total=False):
- url: Required[str]
- """The image URL. Can be either a URL or a Data URI."""
-
-
-class ContentUnionMember2ImageURLInput(TypedDict, total=False):
- type: Literal["image_url"]
- """Input type identifier"""
-
- image_url: Required[ContentUnionMember2ImageURLInputImageURL]
- """The image input specification."""
-
-
-ContentUnionMember2: TypeAlias = Union[ContentUnionMember2TextInput, ContentUnionMember2ImageURLInput]
+ContentUnionMember2: TypeAlias = Union[TextInputParam, ImageURLInputParam]
diff --git a/src/mixedbread/types/extractions/extraction_job.py b/src/mixedbread/types/extractions/extraction_job.py
index d6430d4b..9c6114e3 100644
--- a/src/mixedbread/types/extractions/extraction_job.py
+++ b/src/mixedbread/types/extractions/extraction_job.py
@@ -2,10 +2,10 @@
from typing import Dict, Optional
from datetime import datetime
-from typing_extensions import Literal
from ..._models import BaseModel
from .extraction_result import ExtractionResult
+from ..parsing.parsing_job_status import ParsingJobStatus
__all__ = ["ExtractionJob"]
@@ -32,7 +32,7 @@ class ExtractionJob(BaseModel):
finished_at: Optional[datetime] = None
"""When the job finished processing"""
- status: Literal["pending", "in_progress", "cancelled", "completed", "failed"]
+ status: ParsingJobStatus
"""Current status of the job"""
result: Optional[ExtractionResult] = None
diff --git a/src/mixedbread/types/extractions/image_url_input.py b/src/mixedbread/types/extractions/image_url_input.py
new file mode 100644
index 00000000..90392503
--- /dev/null
+++ b/src/mixedbread/types/extractions/image_url_input.py
@@ -0,0 +1,21 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["ImageURLInput", "ImageURL"]
+
+
+class ImageURL(BaseModel):
+ url: str
+ """The image URL. Can be either a URL or a Data URI."""
+
+
+class ImageURLInput(BaseModel):
+ type: Optional[Literal["image_url"]] = None
+ """Input type identifier"""
+
+ image_url: ImageURL
+ """The image input specification."""
diff --git a/src/mixedbread/types/extractions/image_url_input_param.py b/src/mixedbread/types/extractions/image_url_input_param.py
new file mode 100644
index 00000000..6c361176
--- /dev/null
+++ b/src/mixedbread/types/extractions/image_url_input_param.py
@@ -0,0 +1,20 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["ImageURLInputParam", "ImageURL"]
+
+
+class ImageURL(TypedDict, total=False):
+ url: Required[str]
+ """The image URL. Can be either a URL or a Data URI."""
+
+
+class ImageURLInputParam(TypedDict, total=False):
+ type: Literal["image_url"]
+ """Input type identifier"""
+
+ image_url: Required[ImageURL]
+ """The image input specification."""
diff --git a/src/mixedbread/types/extractions/text_input.py b/src/mixedbread/types/extractions/text_input.py
new file mode 100644
index 00000000..dde3cee0
--- /dev/null
+++ b/src/mixedbread/types/extractions/text_input.py
@@ -0,0 +1,16 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from typing_extensions import Literal
+
+from ..._models import BaseModel
+
+__all__ = ["TextInput"]
+
+
+class TextInput(BaseModel):
+ type: Optional[Literal["text"]] = None
+ """Input type identifier"""
+
+ text: str
+ """Text content to process"""
diff --git a/src/mixedbread/types/extractions/text_input_param.py b/src/mixedbread/types/extractions/text_input_param.py
new file mode 100644
index 00000000..d8829079
--- /dev/null
+++ b/src/mixedbread/types/extractions/text_input_param.py
@@ -0,0 +1,15 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["TextInputParam"]
+
+
+class TextInputParam(TypedDict, total=False):
+ type: Literal["text"]
+ """Input type identifier"""
+
+ text: Required[str]
+ """Text content to process"""
diff --git a/src/mixedbread/types/object_type.py b/src/mixedbread/types/object_type.py
new file mode 100644
index 00000000..aecff986
--- /dev/null
+++ b/src/mixedbread/types/object_type.py
@@ -0,0 +1,20 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal, TypeAlias
+
+__all__ = ["ObjectType"]
+
+ObjectType: TypeAlias = Literal[
+ "list",
+ "parsing_job",
+ "extraction_job",
+ "embedding",
+ "embedding_dict",
+ "rank_result",
+ "file",
+ "vector_store",
+ "vector_store.file",
+ "api_key",
+ "data_source",
+ "data_source.connector",
+]
diff --git a/src/mixedbread/types/pagination_with_total.py b/src/mixedbread/types/pagination_with_total.py
new file mode 100644
index 00000000..2e6bd456
--- /dev/null
+++ b/src/mixedbread/types/pagination_with_total.py
@@ -0,0 +1,18 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from .._models import BaseModel
+
+__all__ = ["PaginationWithTotal"]
+
+
+class PaginationWithTotal(BaseModel):
+ limit: Optional[int] = None
+ """Maximum number of items to return per page"""
+
+ offset: Optional[int] = None
+ """Offset of the first item to return"""
+
+ total: Optional[int] = None
+ """Total number of items available"""
diff --git a/src/mixedbread/types/parsing/__init__.py b/src/mixedbread/types/parsing/__init__.py
index da250167..d3e38bbe 100644
--- a/src/mixedbread/types/parsing/__init__.py
+++ b/src/mixedbread/types/parsing/__init__.py
@@ -3,7 +3,11 @@
from __future__ import annotations
from .parsing_job import ParsingJob as ParsingJob
+from .element_type import ElementType as ElementType
+from .return_format import ReturnFormat as ReturnFormat
from .job_list_params import JobListParams as JobListParams
+from .chunking_strategy import ChunkingStrategy as ChunkingStrategy
from .job_create_params import JobCreateParams as JobCreateParams
from .job_list_response import JobListResponse as JobListResponse
+from .parsing_job_status import ParsingJobStatus as ParsingJobStatus
from .job_delete_response import JobDeleteResponse as JobDeleteResponse
diff --git a/src/mixedbread/types/parsing/chunking_strategy.py b/src/mixedbread/types/parsing/chunking_strategy.py
new file mode 100644
index 00000000..7848a25f
--- /dev/null
+++ b/src/mixedbread/types/parsing/chunking_strategy.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal, TypeAlias
+
+__all__ = ["ChunkingStrategy"]
+
+ChunkingStrategy: TypeAlias = Literal["page"]
diff --git a/src/mixedbread/types/parsing/element_type.py b/src/mixedbread/types/parsing/element_type.py
new file mode 100644
index 00000000..011208d8
--- /dev/null
+++ b/src/mixedbread/types/parsing/element_type.py
@@ -0,0 +1,19 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal, TypeAlias
+
+__all__ = ["ElementType"]
+
+ElementType: TypeAlias = Literal[
+ "caption",
+ "footnote",
+ "formula",
+ "list-item",
+ "page-footer",
+ "page-header",
+ "picture",
+ "section-header",
+ "table",
+ "text",
+ "title",
+]
diff --git a/src/mixedbread/types/parsing/job_create_params.py b/src/mixedbread/types/parsing/job_create_params.py
index a8e25307..7f624260 100644
--- a/src/mixedbread/types/parsing/job_create_params.py
+++ b/src/mixedbread/types/parsing/job_create_params.py
@@ -5,6 +5,10 @@
from typing import List, Optional
from typing_extensions import Literal, Required, TypedDict
+from .element_type import ElementType
+from .return_format import ReturnFormat
+from .chunking_strategy import ChunkingStrategy
+
__all__ = ["JobCreateParams"]
@@ -12,29 +16,13 @@ class JobCreateParams(TypedDict, total=False):
file_id: Required[str]
"""The ID of the file to parse"""
- element_types: Optional[
- List[
- Literal[
- "caption",
- "footnote",
- "formula",
- "list-item",
- "page-footer",
- "page-header",
- "picture",
- "section-header",
- "table",
- "text",
- "title",
- ]
- ]
- ]
+ element_types: Optional[List[ElementType]]
"""The elements to extract from the document"""
- chunking_strategy: Literal["page"]
+ chunking_strategy: ChunkingStrategy
"""The strategy to use for chunking the content"""
- return_format: Literal["html", "markdown", "plain"]
+ return_format: ReturnFormat
"""The format of the returned content"""
mode: Literal["fast", "high_quality"]
diff --git a/src/mixedbread/types/parsing/job_list_response.py b/src/mixedbread/types/parsing/job_list_response.py
index c9136d2f..509d1620 100644
--- a/src/mixedbread/types/parsing/job_list_response.py
+++ b/src/mixedbread/types/parsing/job_list_response.py
@@ -5,6 +5,7 @@
from typing_extensions import Literal
from ..._models import BaseModel
+from .parsing_job_status import ParsingJobStatus
__all__ = ["JobListResponse"]
@@ -16,7 +17,7 @@ class JobListResponse(BaseModel):
file_id: str
"""The ID of the file to parse"""
- status: Literal["pending", "in_progress", "cancelled", "completed", "failed"]
+ status: ParsingJobStatus
"""The status of the job"""
started_at: Optional[datetime] = None
diff --git a/src/mixedbread/types/parsing/parsing_job.py b/src/mixedbread/types/parsing/parsing_job.py
index 959a7ef8..026f0d7d 100644
--- a/src/mixedbread/types/parsing/parsing_job.py
+++ b/src/mixedbread/types/parsing/parsing_job.py
@@ -5,24 +5,16 @@
from typing_extensions import Literal
from ..._models import BaseModel
+from .element_type import ElementType
+from .return_format import ReturnFormat
+from .chunking_strategy import ChunkingStrategy
+from .parsing_job_status import ParsingJobStatus
__all__ = ["ParsingJob", "Result", "ResultChunk", "ResultChunkElement"]
class ResultChunkElement(BaseModel):
- type: Literal[
- "caption",
- "footnote",
- "formula",
- "list-item",
- "page-footer",
- "page-header",
- "picture",
- "section-header",
- "table",
- "text",
- "title",
- ]
+ type: ElementType
"""The type of the extracted element"""
confidence: float
@@ -53,27 +45,13 @@ class ResultChunk(BaseModel):
class Result(BaseModel):
- chunking_strategy: Literal["page"]
+ chunking_strategy: ChunkingStrategy
"""The strategy used for chunking the document"""
- return_format: Literal["html", "markdown", "plain"]
+ return_format: ReturnFormat
"""The format of the returned content"""
- element_types: List[
- Literal[
- "caption",
- "footnote",
- "formula",
- "list-item",
- "page-footer",
- "page-header",
- "picture",
- "section-header",
- "table",
- "text",
- "title",
- ]
- ]
+ element_types: List[ElementType]
"""The types of elements extracted"""
chunks: List[ResultChunk]
@@ -90,7 +68,7 @@ class ParsingJob(BaseModel):
file_id: str
"""The ID of the file to parse"""
- status: Literal["pending", "in_progress", "cancelled", "completed", "failed"]
+ status: ParsingJobStatus
"""The status of the job"""
error: Optional[object] = None
diff --git a/src/mixedbread/types/parsing/parsing_job_status.py b/src/mixedbread/types/parsing/parsing_job_status.py
new file mode 100644
index 00000000..03e03a48
--- /dev/null
+++ b/src/mixedbread/types/parsing/parsing_job_status.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal, TypeAlias
+
+__all__ = ["ParsingJobStatus"]
+
+ParsingJobStatus: TypeAlias = Literal["pending", "in_progress", "cancelled", "completed", "failed"]
diff --git a/src/mixedbread/types/parsing/return_format.py b/src/mixedbread/types/parsing/return_format.py
new file mode 100644
index 00000000..2b080722
--- /dev/null
+++ b/src/mixedbread/types/parsing/return_format.py
@@ -0,0 +1,7 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing_extensions import Literal, TypeAlias
+
+__all__ = ["ReturnFormat"]
+
+ReturnFormat: TypeAlias = Literal["html", "markdown", "plain"]
diff --git a/src/mixedbread/types/rerank_response.py b/src/mixedbread/types/rerank_response.py
index ef0d117d..af6d5ff2 100644
--- a/src/mixedbread/types/rerank_response.py
+++ b/src/mixedbread/types/rerank_response.py
@@ -4,6 +4,7 @@
from typing_extensions import Literal
from .._models import BaseModel
+from .object_type import ObjectType
from .shared.usage import Usage
__all__ = ["RerankResponse", "Data"]
@@ -33,22 +34,7 @@ class RerankResponse(BaseModel):
data: List[Data]
"""The ranked documents."""
- object: Optional[
- Literal[
- "list",
- "parsing_job",
- "extraction_job",
- "embedding",
- "embedding_dict",
- "rank_result",
- "file",
- "vector_store",
- "vector_store.file",
- "api_key",
- "data_source",
- "data_source.connector",
- ]
- ] = None
+ object: Optional[ObjectType] = None
"""The object type of the response"""
top_k: int
diff --git a/src/mixedbread/types/scored_vector_store_chunk.py b/src/mixedbread/types/scored_vector_store_chunk.py
index 87276ad7..98516a61 100644
--- a/src/mixedbread/types/scored_vector_store_chunk.py
+++ b/src/mixedbread/types/scored_vector_store_chunk.py
@@ -1,35 +1,15 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import Dict, Union, Optional
-from typing_extensions import Literal, TypeAlias
+from typing_extensions import TypeAlias
from .._models import BaseModel
+from .extractions.text_input import TextInput
+from .extractions.image_url_input import ImageURLInput
-__all__ = ["ScoredVectorStoreChunk", "Value", "ValueImageURLInput", "ValueImageURLInputImageURL", "ValueTextInput"]
+__all__ = ["ScoredVectorStoreChunk", "Value"]
-
-class ValueImageURLInputImageURL(BaseModel):
- url: str
- """The image URL. Can be either a URL or a Data URI."""
-
-
-class ValueImageURLInput(BaseModel):
- type: Optional[Literal["image_url"]] = None
- """Input type identifier"""
-
- image_url: ValueImageURLInputImageURL
- """The image input specification."""
-
-
-class ValueTextInput(BaseModel):
- type: Optional[Literal["text"]] = None
- """Input type identifier"""
-
- text: str
- """Text content to process"""
-
-
-Value: TypeAlias = Union[str, ValueImageURLInput, ValueTextInput, Dict[str, object], None]
+Value: TypeAlias = Union[str, ImageURLInput, TextInput, Dict[str, object], None]
class ScoredVectorStoreChunk(BaseModel):
diff --git a/tests/api_resources/data_sources/test_connectors.py b/tests/api_resources/data_sources/test_connectors.py
index f18a20d8..f25e9ce0 100644
--- a/tests/api_resources/data_sources/test_connectors.py
+++ b/tests/api_resources/data_sources/test_connectors.py
@@ -11,11 +11,8 @@
from tests.utils import assert_matches_type
from mixedbread.pagination import SyncLimitOffset, AsyncLimitOffset
from mixedbread.types.data_sources import (
- ConnectorListResponse,
- ConnectorCreateResponse,
+ DataSourceConnector,
ConnectorDeleteResponse,
- ConnectorUpdateResponse,
- ConnectorRetrieveResponse,
)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -30,7 +27,7 @@ def test_method_create(self, client: Mixedbread) -> None:
data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
vector_store_id="vector_store_id",
)
- assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
def test_method_create_with_all_params(self, client: Mixedbread) -> None:
@@ -42,7 +39,7 @@ def test_method_create_with_all_params(self, client: Mixedbread) -> None:
metadata={},
polling_interval="polling_interval",
)
- assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
def test_raw_response_create(self, client: Mixedbread) -> None:
@@ -54,7 +51,7 @@ def test_raw_response_create(self, client: Mixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = response.parse()
- assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
def test_streaming_response_create(self, client: Mixedbread) -> None:
@@ -66,7 +63,7 @@ def test_streaming_response_create(self, client: Mixedbread) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = response.parse()
- assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -84,7 +81,7 @@ def test_method_retrieve(self, client: Mixedbread) -> None:
connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
- assert_matches_type(ConnectorRetrieveResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
def test_raw_response_retrieve(self, client: Mixedbread) -> None:
@@ -96,7 +93,7 @@ def test_raw_response_retrieve(self, client: Mixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = response.parse()
- assert_matches_type(ConnectorRetrieveResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
def test_streaming_response_retrieve(self, client: Mixedbread) -> None:
@@ -108,7 +105,7 @@ def test_streaming_response_retrieve(self, client: Mixedbread) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = response.parse()
- assert_matches_type(ConnectorRetrieveResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -132,7 +129,7 @@ def test_method_update(self, client: Mixedbread) -> None:
connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
- assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
def test_method_update_with_all_params(self, client: Mixedbread) -> None:
@@ -144,7 +141,7 @@ def test_method_update_with_all_params(self, client: Mixedbread) -> None:
trigger_sync=True,
polling_interval="polling_interval",
)
- assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
def test_raw_response_update(self, client: Mixedbread) -> None:
@@ -156,7 +153,7 @@ def test_raw_response_update(self, client: Mixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = response.parse()
- assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
def test_streaming_response_update(self, client: Mixedbread) -> None:
@@ -168,7 +165,7 @@ def test_streaming_response_update(self, client: Mixedbread) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = response.parse()
- assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -191,7 +188,7 @@ def test_method_list(self, client: Mixedbread) -> None:
connector = client.data_sources.connectors.list(
data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
- assert_matches_type(SyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+ assert_matches_type(SyncLimitOffset[DataSourceConnector], connector, path=["response"])
@parametrize
def test_method_list_with_all_params(self, client: Mixedbread) -> None:
@@ -200,7 +197,7 @@ def test_method_list_with_all_params(self, client: Mixedbread) -> None:
limit=1000,
offset=0,
)
- assert_matches_type(SyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+ assert_matches_type(SyncLimitOffset[DataSourceConnector], connector, path=["response"])
@parametrize
def test_raw_response_list(self, client: Mixedbread) -> None:
@@ -211,7 +208,7 @@ def test_raw_response_list(self, client: Mixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = response.parse()
- assert_matches_type(SyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+ assert_matches_type(SyncLimitOffset[DataSourceConnector], connector, path=["response"])
@parametrize
def test_streaming_response_list(self, client: Mixedbread) -> None:
@@ -222,7 +219,7 @@ def test_streaming_response_list(self, client: Mixedbread) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = response.parse()
- assert_matches_type(SyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+ assert_matches_type(SyncLimitOffset[DataSourceConnector], connector, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -291,7 +288,7 @@ async def test_method_create(self, async_client: AsyncMixedbread) -> None:
data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
vector_store_id="vector_store_id",
)
- assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None:
@@ -303,7 +300,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncMixedbread
metadata={},
polling_interval="polling_interval",
)
- assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None:
@@ -315,7 +312,7 @@ async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = await response.parse()
- assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None:
@@ -327,7 +324,7 @@ async def test_streaming_response_create(self, async_client: AsyncMixedbread) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = await response.parse()
- assert_matches_type(ConnectorCreateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -345,7 +342,7 @@ async def test_method_retrieve(self, async_client: AsyncMixedbread) -> None:
connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
- assert_matches_type(ConnectorRetrieveResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
async def test_raw_response_retrieve(self, async_client: AsyncMixedbread) -> None:
@@ -357,7 +354,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncMixedbread) -> Non
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = await response.parse()
- assert_matches_type(ConnectorRetrieveResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
async def test_streaming_response_retrieve(self, async_client: AsyncMixedbread) -> None:
@@ -369,7 +366,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncMixedbread)
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = await response.parse()
- assert_matches_type(ConnectorRetrieveResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -393,7 +390,7 @@ async def test_method_update(self, async_client: AsyncMixedbread) -> None:
connector_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
- assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncMixedbread) -> None:
@@ -405,7 +402,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncMixedbread
trigger_sync=True,
polling_interval="polling_interval",
)
- assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
async def test_raw_response_update(self, async_client: AsyncMixedbread) -> None:
@@ -417,7 +414,7 @@ async def test_raw_response_update(self, async_client: AsyncMixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = await response.parse()
- assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
@parametrize
async def test_streaming_response_update(self, async_client: AsyncMixedbread) -> None:
@@ -429,7 +426,7 @@ async def test_streaming_response_update(self, async_client: AsyncMixedbread) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = await response.parse()
- assert_matches_type(ConnectorUpdateResponse, connector, path=["response"])
+ assert_matches_type(DataSourceConnector, connector, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -452,7 +449,7 @@ async def test_method_list(self, async_client: AsyncMixedbread) -> None:
connector = await async_client.data_sources.connectors.list(
data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
- assert_matches_type(AsyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+ assert_matches_type(AsyncLimitOffset[DataSourceConnector], connector, path=["response"])
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None:
@@ -461,7 +458,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread)
limit=1000,
offset=0,
)
- assert_matches_type(AsyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+ assert_matches_type(AsyncLimitOffset[DataSourceConnector], connector, path=["response"])
@parametrize
async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None:
@@ -472,7 +469,7 @@ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = await response.parse()
- assert_matches_type(AsyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+ assert_matches_type(AsyncLimitOffset[DataSourceConnector], connector, path=["response"])
@parametrize
async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None:
@@ -483,7 +480,7 @@ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> N
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
connector = await response.parse()
- assert_matches_type(AsyncLimitOffset[ConnectorListResponse], connector, path=["response"])
+ assert_matches_type(AsyncLimitOffset[DataSourceConnector], connector, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/parsing/test_jobs.py b/tests/api_resources/parsing/test_jobs.py
index a82ef6a0..6ddcf2da 100644
--- a/tests/api_resources/parsing/test_jobs.py
+++ b/tests/api_resources/parsing/test_jobs.py
@@ -10,7 +10,11 @@
from mixedbread import Mixedbread, AsyncMixedbread
from tests.utils import assert_matches_type
from mixedbread.pagination import SyncLimitOffset, AsyncLimitOffset
-from mixedbread.types.parsing import ParsingJob, JobListResponse, JobDeleteResponse
+from mixedbread.types.parsing import (
+ ParsingJob,
+ JobListResponse,
+ JobDeleteResponse,
+)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
diff --git a/tests/api_resources/test_api_keys.py b/tests/api_resources/test_api_keys.py
new file mode 100644
index 00000000..531fadfe
--- /dev/null
+++ b/tests/api_resources/test_api_keys.py
@@ -0,0 +1,460 @@
+# 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 APIKey, APIKeyCreated, APIKeyDeleteResponse
+from mixedbread._utils import parse_datetime
+from mixedbread.pagination import SyncLimitOffset, AsyncLimitOffset
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestAPIKeys:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Mixedbread) -> None:
+ api_key = client.api_keys.create()
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Mixedbread) -> None:
+ api_key = client.api_keys.create(
+ name="name",
+ expires_at=parse_datetime("2019-12-27T18:11:19.117Z"),
+ )
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Mixedbread) -> None:
+ response = client.api_keys.with_raw_response.create()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = response.parse()
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Mixedbread) -> None:
+ with client.api_keys.with_streaming_response.create() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = response.parse()
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_method_retrieve(self, client: Mixedbread) -> None:
+ api_key = client.api_keys.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(APIKey, api_key, path=["response"])
+
+ @parametrize
+ def test_raw_response_retrieve(self, client: Mixedbread) -> None:
+ response = client.api_keys.with_raw_response.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = response.parse()
+ assert_matches_type(APIKey, api_key, path=["response"])
+
+ @parametrize
+ def test_streaming_response_retrieve(self, client: Mixedbread) -> None:
+ with client.api_keys.with_streaming_response.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = response.parse()
+ assert_matches_type(APIKey, api_key, 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 `api_key_id` but received ''"):
+ client.api_keys.with_raw_response.retrieve(
+ "",
+ )
+
+ @parametrize
+ def test_method_list(self, client: Mixedbread) -> None:
+ api_key = client.api_keys.list()
+ assert_matches_type(SyncLimitOffset[APIKey], api_key, path=["response"])
+
+ @parametrize
+ def test_method_list_with_all_params(self, client: Mixedbread) -> None:
+ api_key = client.api_keys.list(
+ limit=1000,
+ offset=0,
+ )
+ assert_matches_type(SyncLimitOffset[APIKey], api_key, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Mixedbread) -> None:
+ response = client.api_keys.with_raw_response.list()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = response.parse()
+ assert_matches_type(SyncLimitOffset[APIKey], api_key, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Mixedbread) -> None:
+ with client.api_keys.with_streaming_response.list() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = response.parse()
+ assert_matches_type(SyncLimitOffset[APIKey], api_key, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_method_delete(self, client: Mixedbread) -> None:
+ api_key = client.api_keys.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"])
+
+ @parametrize
+ def test_raw_response_delete(self, client: Mixedbread) -> None:
+ response = client.api_keys.with_raw_response.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = response.parse()
+ assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"])
+
+ @parametrize
+ def test_streaming_response_delete(self, client: Mixedbread) -> None:
+ with client.api_keys.with_streaming_response.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = response.parse()
+ assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_delete(self, client: Mixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_id` but received ''"):
+ client.api_keys.with_raw_response.delete(
+ "",
+ )
+
+ @parametrize
+ def test_method_reroll(self, client: Mixedbread) -> None:
+ api_key = client.api_keys.reroll(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ @parametrize
+ def test_raw_response_reroll(self, client: Mixedbread) -> None:
+ response = client.api_keys.with_raw_response.reroll(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = response.parse()
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ @parametrize
+ def test_streaming_response_reroll(self, client: Mixedbread) -> None:
+ with client.api_keys.with_streaming_response.reroll(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = response.parse()
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_reroll(self, client: Mixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_id` but received ''"):
+ client.api_keys.with_raw_response.reroll(
+ "",
+ )
+
+ @parametrize
+ def test_method_revoke(self, client: Mixedbread) -> None:
+ api_key = client.api_keys.revoke(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(APIKey, api_key, path=["response"])
+
+ @parametrize
+ def test_raw_response_revoke(self, client: Mixedbread) -> None:
+ response = client.api_keys.with_raw_response.revoke(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = response.parse()
+ assert_matches_type(APIKey, api_key, path=["response"])
+
+ @parametrize
+ def test_streaming_response_revoke(self, client: Mixedbread) -> None:
+ with client.api_keys.with_streaming_response.revoke(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = response.parse()
+ assert_matches_type(APIKey, api_key, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_revoke(self, client: Mixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_id` but received ''"):
+ client.api_keys.with_raw_response.revoke(
+ "",
+ )
+
+
+class TestAsyncAPIKeys:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncMixedbread) -> None:
+ api_key = await async_client.api_keys.create()
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None:
+ api_key = await async_client.api_keys.create(
+ name="name",
+ expires_at=parse_datetime("2019-12-27T18:11:19.117Z"),
+ )
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.api_keys.with_raw_response.create()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = await response.parse()
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.api_keys.with_streaming_response.create() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = await response.parse()
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_method_retrieve(self, async_client: AsyncMixedbread) -> None:
+ api_key = await async_client.api_keys.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(APIKey, api_key, path=["response"])
+
+ @parametrize
+ async def test_raw_response_retrieve(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.api_keys.with_raw_response.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = await response.parse()
+ assert_matches_type(APIKey, api_key, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_retrieve(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.api_keys.with_streaming_response.retrieve(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = await response.parse()
+ assert_matches_type(APIKey, api_key, 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 `api_key_id` but received ''"):
+ await async_client.api_keys.with_raw_response.retrieve(
+ "",
+ )
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncMixedbread) -> None:
+ api_key = await async_client.api_keys.list()
+ assert_matches_type(AsyncLimitOffset[APIKey], api_key, path=["response"])
+
+ @parametrize
+ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None:
+ api_key = await async_client.api_keys.list(
+ limit=1000,
+ offset=0,
+ )
+ assert_matches_type(AsyncLimitOffset[APIKey], api_key, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.api_keys.with_raw_response.list()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = await response.parse()
+ assert_matches_type(AsyncLimitOffset[APIKey], api_key, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.api_keys.with_streaming_response.list() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = await response.parse()
+ assert_matches_type(AsyncLimitOffset[APIKey], api_key, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_method_delete(self, async_client: AsyncMixedbread) -> None:
+ api_key = await async_client.api_keys.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"])
+
+ @parametrize
+ async def test_raw_response_delete(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.api_keys.with_raw_response.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = await response.parse()
+ assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_delete(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.api_keys.with_streaming_response.delete(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = await response.parse()
+ assert_matches_type(APIKeyDeleteResponse, api_key, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_delete(self, async_client: AsyncMixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_id` but received ''"):
+ await async_client.api_keys.with_raw_response.delete(
+ "",
+ )
+
+ @parametrize
+ async def test_method_reroll(self, async_client: AsyncMixedbread) -> None:
+ api_key = await async_client.api_keys.reroll(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ @parametrize
+ async def test_raw_response_reroll(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.api_keys.with_raw_response.reroll(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = await response.parse()
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_reroll(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.api_keys.with_streaming_response.reroll(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = await response.parse()
+ assert_matches_type(APIKeyCreated, api_key, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_reroll(self, async_client: AsyncMixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_id` but received ''"):
+ await async_client.api_keys.with_raw_response.reroll(
+ "",
+ )
+
+ @parametrize
+ async def test_method_revoke(self, async_client: AsyncMixedbread) -> None:
+ api_key = await async_client.api_keys.revoke(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+ assert_matches_type(APIKey, api_key, path=["response"])
+
+ @parametrize
+ async def test_raw_response_revoke(self, async_client: AsyncMixedbread) -> None:
+ response = await async_client.api_keys.with_raw_response.revoke(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ api_key = await response.parse()
+ assert_matches_type(APIKey, api_key, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_revoke(self, async_client: AsyncMixedbread) -> None:
+ async with async_client.api_keys.with_streaming_response.revoke(
+ "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ api_key = await response.parse()
+ assert_matches_type(APIKey, api_key, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_revoke(self, async_client: AsyncMixedbread) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `api_key_id` but received ''"):
+ await async_client.api_keys.with_raw_response.revoke(
+ "",
+ )
diff --git a/tests/api_resources/test_data_sources.py b/tests/api_resources/test_data_sources.py
index 4d9ea104..be95dcb7 100644
--- a/tests/api_resources/test_data_sources.py
+++ b/tests/api_resources/test_data_sources.py
@@ -10,11 +10,8 @@
from mixedbread import Mixedbread, AsyncMixedbread
from tests.utils import assert_matches_type
from mixedbread.types import (
- DataSourceListResponse,
- DataSourceCreateResponse,
+ DataSource,
DataSourceDeleteResponse,
- DataSourceUpdateResponse,
- DataSourceRetrieveResponse,
)
from mixedbread._utils import parse_datetime
from mixedbread.pagination import SyncLimitOffset, AsyncLimitOffset
@@ -31,7 +28,7 @@ def test_method_create(self, client: Mixedbread) -> None:
type="notion",
name="name",
)
- assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
def test_method_create_with_all_params(self, client: Mixedbread) -> None:
@@ -52,7 +49,7 @@ def test_method_create_with_all_params(self, client: Mixedbread) -> None:
"expires_on": parse_datetime("2019-12-27T18:11:19.117Z"),
},
)
- assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
def test_raw_response_create(self, client: Mixedbread) -> None:
@@ -64,7 +61,7 @@ def test_raw_response_create(self, client: Mixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = response.parse()
- assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
def test_streaming_response_create(self, client: Mixedbread) -> None:
@@ -76,7 +73,7 @@ def test_streaming_response_create(self, client: Mixedbread) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = response.parse()
- assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -85,7 +82,7 @@ def test_method_retrieve(self, client: Mixedbread) -> None:
data_source = client.data_sources.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
- assert_matches_type(DataSourceRetrieveResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
def test_raw_response_retrieve(self, client: Mixedbread) -> None:
@@ -96,7 +93,7 @@ def test_raw_response_retrieve(self, client: Mixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = response.parse()
- assert_matches_type(DataSourceRetrieveResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
def test_streaming_response_retrieve(self, client: Mixedbread) -> None:
@@ -107,7 +104,7 @@ def test_streaming_response_retrieve(self, client: Mixedbread) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = response.parse()
- assert_matches_type(DataSourceRetrieveResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -123,7 +120,7 @@ def test_method_update(self, client: Mixedbread) -> None:
data_source = client.data_sources.update(
data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
- assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
def test_method_update_with_all_params(self, client: Mixedbread) -> None:
@@ -144,7 +141,7 @@ def test_method_update_with_all_params(self, client: Mixedbread) -> None:
"expires_on": parse_datetime("2019-12-27T18:11:19.117Z"),
},
)
- assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
def test_raw_response_update(self, client: Mixedbread) -> None:
@@ -155,7 +152,7 @@ def test_raw_response_update(self, client: Mixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = response.parse()
- assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
def test_streaming_response_update(self, client: Mixedbread) -> None:
@@ -166,7 +163,7 @@ def test_streaming_response_update(self, client: Mixedbread) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = response.parse()
- assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -180,7 +177,7 @@ def test_path_params_update(self, client: Mixedbread) -> None:
@parametrize
def test_method_list(self, client: Mixedbread) -> None:
data_source = client.data_sources.list()
- assert_matches_type(SyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+ assert_matches_type(SyncLimitOffset[DataSource], data_source, path=["response"])
@parametrize
def test_method_list_with_all_params(self, client: Mixedbread) -> None:
@@ -188,7 +185,7 @@ def test_method_list_with_all_params(self, client: Mixedbread) -> None:
limit=1000,
offset=0,
)
- assert_matches_type(SyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+ assert_matches_type(SyncLimitOffset[DataSource], data_source, path=["response"])
@parametrize
def test_raw_response_list(self, client: Mixedbread) -> None:
@@ -197,7 +194,7 @@ def test_raw_response_list(self, client: Mixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = response.parse()
- assert_matches_type(SyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+ assert_matches_type(SyncLimitOffset[DataSource], data_source, path=["response"])
@parametrize
def test_streaming_response_list(self, client: Mixedbread) -> None:
@@ -206,7 +203,7 @@ def test_streaming_response_list(self, client: Mixedbread) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = response.parse()
- assert_matches_type(SyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+ assert_matches_type(SyncLimitOffset[DataSource], data_source, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -258,7 +255,7 @@ async def test_method_create(self, async_client: AsyncMixedbread) -> None:
type="notion",
name="name",
)
- assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncMixedbread) -> None:
@@ -279,7 +276,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncMixedbread
"expires_on": parse_datetime("2019-12-27T18:11:19.117Z"),
},
)
- assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None:
@@ -291,7 +288,7 @@ async def test_raw_response_create(self, async_client: AsyncMixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = await response.parse()
- assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
async def test_streaming_response_create(self, async_client: AsyncMixedbread) -> None:
@@ -303,7 +300,7 @@ async def test_streaming_response_create(self, async_client: AsyncMixedbread) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = await response.parse()
- assert_matches_type(DataSourceCreateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -312,7 +309,7 @@ async def test_method_retrieve(self, async_client: AsyncMixedbread) -> None:
data_source = await async_client.data_sources.retrieve(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
- assert_matches_type(DataSourceRetrieveResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
async def test_raw_response_retrieve(self, async_client: AsyncMixedbread) -> None:
@@ -323,7 +320,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncMixedbread) -> Non
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = await response.parse()
- assert_matches_type(DataSourceRetrieveResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
async def test_streaming_response_retrieve(self, async_client: AsyncMixedbread) -> None:
@@ -334,7 +331,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncMixedbread)
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = await response.parse()
- assert_matches_type(DataSourceRetrieveResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -350,7 +347,7 @@ async def test_method_update(self, async_client: AsyncMixedbread) -> None:
data_source = await async_client.data_sources.update(
data_source_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
- assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncMixedbread) -> None:
@@ -371,7 +368,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncMixedbread
"expires_on": parse_datetime("2019-12-27T18:11:19.117Z"),
},
)
- assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
async def test_raw_response_update(self, async_client: AsyncMixedbread) -> None:
@@ -382,7 +379,7 @@ async def test_raw_response_update(self, async_client: AsyncMixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = await response.parse()
- assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
@parametrize
async def test_streaming_response_update(self, async_client: AsyncMixedbread) -> None:
@@ -393,7 +390,7 @@ async def test_streaming_response_update(self, async_client: AsyncMixedbread) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = await response.parse()
- assert_matches_type(DataSourceUpdateResponse, data_source, path=["response"])
+ assert_matches_type(DataSource, data_source, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -407,7 +404,7 @@ async def test_path_params_update(self, async_client: AsyncMixedbread) -> None:
@parametrize
async def test_method_list(self, async_client: AsyncMixedbread) -> None:
data_source = await async_client.data_sources.list()
- assert_matches_type(AsyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+ assert_matches_type(AsyncLimitOffset[DataSource], data_source, path=["response"])
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncMixedbread) -> None:
@@ -415,7 +412,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncMixedbread)
limit=1000,
offset=0,
)
- assert_matches_type(AsyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+ assert_matches_type(AsyncLimitOffset[DataSource], data_source, path=["response"])
@parametrize
async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None:
@@ -424,7 +421,7 @@ async def test_raw_response_list(self, async_client: AsyncMixedbread) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = await response.parse()
- assert_matches_type(AsyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+ assert_matches_type(AsyncLimitOffset[DataSource], data_source, path=["response"])
@parametrize
async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> None:
@@ -433,7 +430,7 @@ async def test_streaming_response_list(self, async_client: AsyncMixedbread) -> N
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
data_source = await response.parse()
- assert_matches_type(AsyncLimitOffset[DataSourceListResponse], data_source, path=["response"])
+ assert_matches_type(AsyncLimitOffset[DataSource], data_source, path=["response"])
assert cast(Any, response.is_closed) is True
From 291251bd5355630581c77fba2049da08d46f5bb4 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 26 May 2025 12:32:19 +0000
Subject: [PATCH 6/6] release: 0.4.0
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 16 ++++++++++++++++
pyproject.toml | 2 +-
src/mixedbread/_version.py | 2 +-
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index cce92405..da59f99e 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.3.1"
+ ".": "0.4.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c132c84c..95b6efae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,21 @@
# Changelog
+## 0.4.0 (2025-05-26)
+
+Full Changelog: [v0.3.1...v0.4.0](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.3.1...v0.4.0)
+
+### Features
+
+* **api:** update via SDK Studio ([c504aa4](https://github.com/mixedbread-ai/mixedbread-python/commit/c504aa4e20404af5c2f66f21ee55ef04af7092c8))
+* **api:** update via SDK Studio ([19da790](https://github.com/mixedbread-ai/mixedbread-python/commit/19da79023946597097d740650d1ff3af76839201))
+
+
+### Chores
+
+* **ci:** fix installation instructions ([3b8060d](https://github.com/mixedbread-ai/mixedbread-python/commit/3b8060de754d0b46c4aed0fb7a1f2fc20584d53d))
+* **ci:** upload sdks to package manager ([360dea4](https://github.com/mixedbread-ai/mixedbread-python/commit/360dea48d1c7d36ddb7e1a932d9a9ec759441a57))
+* **docs:** grammar improvements ([e3faf93](https://github.com/mixedbread-ai/mixedbread-python/commit/e3faf933f1278eec744ffdbe59202388c756791b))
+
## 0.3.1 (2025-05-10)
Full Changelog: [v0.3.0...v0.3.1](https://github.com/mixedbread-ai/mixedbread-python/compare/v0.3.0...v0.3.1)
diff --git a/pyproject.toml b/pyproject.toml
index 91395731..1b83a9b4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "mixedbread"
-version = "0.3.1"
+version = "0.4.0"
description = "The official Python library for the Mixedbread API"
dynamic = ["readme"]
license = "Apache-2.0"
diff --git a/src/mixedbread/_version.py b/src/mixedbread/_version.py
index 7e6e8c04..57b9c213 100644
--- a/src/mixedbread/_version.py
+++ b/src/mixedbread/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "mixedbread"
-__version__ = "0.3.1" # x-release-please-version
+__version__ = "0.4.0" # x-release-please-version