diff --git a/.fern/metadata.json b/.fern/metadata.json index 3791815..ab20a53 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,9 +1,9 @@ { "cliVersion": "3.86.0", "generatorName": "fernapi/fern-python-sdk", - "generatorVersion": "4.59.0", + "generatorVersion": "4.59.4", "generatorConfig": { "client_class_name": "Captain" }, - "sdkVersion": "0.0.0" + "sdkVersion": "0.0.12" } \ No newline at end of file diff --git a/README.md b/README.md index 1a92543..38e2519 100644 --- a/README.md +++ b/README.md @@ -37,15 +37,11 @@ Instantiate and use the client with the following: from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) -client.query.collection_v2( - collection_name="my_documents", - query="What are the key terms in the contract?", - inference=True, - stream=True, - rerank=True, +client.post_v2collections_collection_name_documents_wipe( + collection_name="collection_name", ) ``` @@ -59,18 +55,14 @@ import asyncio from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: - await client.query.collection_v2( - collection_name="my_documents", - query="What are the key terms in the contract?", - inference=True, - stream=True, - rerank=True, + await client.post_v2collections_collection_name_documents_wipe( + collection_name="collection_name", ) @@ -86,7 +78,7 @@ will be thrown. from runcaptain.core.api_error import ApiError try: - client.query.collection_v2(...) + client.post_v2collections_collection_name_documents_wipe(...) except ApiError as e: print(e.status_code) print(e.body) @@ -105,7 +97,11 @@ from runcaptain import Captain client = Captain( ..., ) -response = client.query.with_raw_response.collection_v2(...) +response = ( + client.with_raw_response.post_v2collections_collection_name_documents_wipe( + ... + ) +) print(response.headers) # access the response headers print(response.status_code) # access the response status code print(response.data) # access the underlying object @@ -126,7 +122,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret Use the `max_retries` request option to configure this behavior. ```python -client.query.collection_v2(..., request_options={ +client.post_v2collections_collection_name_documents_wipe(..., request_options={ "max_retries": 1 }) ``` @@ -146,7 +142,7 @@ client = Captain( # Override timeout for a specific method -client.query.collection_v2(..., request_options={ +client.post_v2collections_collection_name_documents_wipe(..., request_options={ "timeout_in_seconds": 1 }) ``` diff --git a/poetry.lock b/poetry.lock index 2f8666b..83fdc8b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -38,13 +38,13 @@ trio = ["trio (>=0.26.1)"] [[package]] name = "certifi" -version = "2026.1.4" +version = "2026.2.25" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.7" files = [ - {file = "certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c"}, - {file = "certifi-2026.1.4.tar.gz", hash = "sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120"}, + {file = "certifi-2026.2.25-py3-none-any.whl", hash = "sha256:027692e4402ad994f1c42e52a4997a9763c646b73e4096e4d5d6db8af1d6f0fa"}, + {file = "certifi-2026.2.25.tar.gz", hash = "sha256:e887ab5cee78ea814d3472169153c2d12cd43b14bd03329a39a9c6e2e80bfba7"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index ac15859..1b4afb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "captain-sdk" -version = "0.0.0" +version = "0.0.12" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index a89bbf8..76ab1b1 100644 --- a/reference.md +++ b/reference.md @@ -1,10 +1,9 @@ # Reference -## Collections -
client.collections.list_collections_v2(...) -> AsyncHttpResponse[CollectionListResponseV2] +
client.post_v2collections_collection_name_documents_wipe(...) -> AsyncHttpResponse[None]
-#### 📝 Description +#### 🔌 Usage
@@ -12,14 +11,55 @@
-List all collections for an organization. +```python +from runcaptain import Captain -Returns an array of collection objects with collection_name, collection_id, and document_count. +client = Captain( + organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", +) +client.post_v2collections_collection_name_documents_wipe( + collection_name="collection_name", +) + +```
+#### ⚙️ Parameters + +
+
+ +
+
+ +**collection_name:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.post_v2datasets_search() -> AsyncHttpResponse[None] +
+
+ #### 🔌 Usage
@@ -32,10 +72,10 @@ Returns an array of collection objects with collection_name, collection_id, and from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) -client.collections.list_collections_v2() +client.post_v2datasets_search() ```
@@ -51,18 +91,66 @@ client.collections.list_collections_v2()
-**limit:** `typing.Optional[int]` — Maximum number of collections to return +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+ +
+ + + +
+ +## Collections +
client.collections.list_collections_v2() -> AsyncHttpResponse[CollectionListResponseV2]
-**offset:** `typing.Optional[int]` — Pagination offset - +#### 📝 Description + +
+
+ +
+
+ +List all collections for an organization. + +Returns an array of collection objects with collection_name, collection_id, and document_count.
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from runcaptain import Captain + +client = Captain( + organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", +) +client.collections.list_collections_v2() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
@@ -109,11 +197,11 @@ Create a new collection (idempotent). Returns 201 if created, 200 if already exi from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.create_collection_v2( - collection_name="my_documents", + collection_name="collection_name", ) ``` @@ -130,7 +218,7 @@ client.collections.create_collection_v2(
-**collection_name:** `str` — Name of the collection to create +**collection_name:** `str`
@@ -188,11 +276,11 @@ Delete a collection and all its indexed documents. from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.delete_collection_v2( - collection_name="my_documents", + collection_name="collection_name", ) ``` @@ -209,7 +297,7 @@ client.collections.delete_collection_v2(
-**collection_name:** `str` — Name of the collection to delete +**collection_name:** `str`
@@ -271,12 +359,12 @@ All files, indexed data, and vector embeddings are preserved. The collection's i from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.change_collection_environment_v2( - collection_name="my_documents", - new_environment="production", + collection_name="collection_name", + new_environment="development", ) ``` @@ -293,7 +381,7 @@ client.collections.change_collection_environment_v2(
-**collection_name:** `str` — Name of the collection to move +**collection_name:** `str`
@@ -351,13 +439,12 @@ List all documents in a collection with pagination support. from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.list_documents_v2( - collection_name="my_documents", - limit=100, - offset=0, + collection_name="collection_name", + offset=1, ) ``` @@ -374,15 +461,7 @@ client.collections.list_documents_v2(
-**collection_name:** `str` — Name of the collection - -
-
- -
-
- -**limit:** `typing.Optional[int]` — Maximum number of documents to return +**collection_name:** `str`
@@ -440,8 +519,8 @@ Remove all documents from a collection while keeping the collection structure. from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.wipe_collection_documents_v2( collection_name="collection_name", @@ -511,8 +590,8 @@ Delete a specific document from a collection. from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.delete_document_v2( collection_name="collection_name", @@ -533,7 +612,7 @@ client.collections.delete_document_v2(
-**collection_name:** `str` — Name of the collection +**collection_name:** `str`
@@ -541,7 +620,7 @@ client.collections.delete_document_v2(
-**document_id:** `str` — ID of the document to delete +**document_id:** `str`
@@ -643,15 +722,14 @@ data: {"type":"stream_complete"} from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.query.collection_v2( - collection_name="my_documents", - query="What are the key terms in the contract?", + collection_name="collection_name", + query="Find Q3 contracts mentioning 'termination for convenience'", inference=True, - stream=True, - rerank=True, + stream=False, ) ``` @@ -668,7 +746,7 @@ client.query.collection_v2(
-**collection_name:** `str` — Name of the collection to query +**collection_name:** `str`
@@ -684,14 +762,6 @@ client.query.collection_v2(
-**idempotency_key:** `typing.Optional[str]` — UUID for request deduplication - -
-
- -
-
- **inference:** `typing.Optional[bool]` — Enable LLM-generated answers based on the relevant sections retrieved. When false, returns raw search results.
@@ -783,14 +853,14 @@ Index all files from an S3 bucket into a collection. Returns a job_id for tracki from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_s3bucket_v2( - collection_name="my_documents", - bucket_name="my-s3-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", aws_access_key_id="AKIAIOSFODNN7EXAMPLE", - aws_secret_access_key="your_secret_key", + aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", bucket_region="us-east-1", processing_type="advanced", ) @@ -809,7 +879,7 @@ client.indexing.index_s3bucket_v2(
-**collection_name:** `str` — Name of the collection to index into +**collection_name:** `str`
@@ -849,14 +919,6 @@ client.indexing.index_s3bucket_v2(
-**idempotency_key:** `typing.Optional[str]` — UUID for request deduplication - -
-
- -
-
- **bucket_region:** `typing.Optional[str]` — AWS region where the bucket is located
@@ -931,15 +993,15 @@ Index a single file from an S3 bucket into a collection. Returns a job_id for tr from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_s3file_v2( - collection_name="my_documents", - bucket_name="my-s3-bucket", - file_uri="s3://my-s3-bucket/contracts/acme_contract.pdf", + collection_name="collection_name", + bucket_name="my-company-docs", + file_uri="s3://my-company-docs/contracts/acme_contract.pdf", aws_access_key_id="AKIAIOSFODNN7EXAMPLE", - aws_secret_access_key="your_secret_key", + aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", bucket_region="us-east-1", processing_type="advanced", ) @@ -958,7 +1020,7 @@ client.indexing.index_s3file_v2(
-**collection_name:** `str` — Name of the collection to index into +**collection_name:** `str`
@@ -1064,12 +1126,12 @@ Index all files from a Google Cloud Storage bucket into a collection. Returns a from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_gcs_bucket_v2( - collection_name="my_documents", - bucket_name="my-gcs-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", service_account_json='{"type":"service_account","project_id":"my-project",...}', processing_type="advanced", ) @@ -1088,7 +1150,7 @@ client.indexing.index_gcs_bucket_v2(
-**collection_name:** `str` — Name of the collection to index into +**collection_name:** `str`
@@ -1186,8 +1248,8 @@ Index a single file from a GCS bucket into a collection. Returns a job_id for tr from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_gcs_file_v2( collection_name="collection_name", @@ -1211,7 +1273,7 @@ client.indexing.index_gcs_file_v2(
-**collection_name:** `str` — Name of the collection to index into +**collection_name:** `str`
@@ -1301,15 +1363,15 @@ Index all files from a specific directory in an S3 bucket into a collection. Use from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_s3directory_v2( - collection_name="my_documents", - bucket_name="my-s3-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", directory_path="reports/2024/january", aws_access_key_id="AKIAIOSFODNN7EXAMPLE", - aws_secret_access_key="your_secret_key", + aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", bucket_region="us-east-1", processing_type="advanced", ) @@ -1328,7 +1390,7 @@ client.indexing.index_s3directory_v2(
-**collection_name:** `str` — Name of the collection to index into +**collection_name:** `str`
@@ -1376,14 +1438,6 @@ client.indexing.index_s3directory_v2(
-**idempotency_key:** `typing.Optional[str]` — UUID for request deduplication - -
-
- -
-
- **bucket_region:** `typing.Optional[str]` — AWS region where the bucket is located
@@ -1458,12 +1512,12 @@ Index all files from a specific directory in a GCS bucket into a collection. Use from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_gcs_directory_v2( - collection_name="my_documents", - bucket_name="my-gcs-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", directory_path="reports/2024/january", service_account_json='{"type":"service_account","project_id":"my-project",...}', processing_type="advanced", @@ -1483,7 +1537,7 @@ client.indexing.index_gcs_directory_v2(
-**collection_name:** `str` — Name of the collection to index into +**collection_name:** `str`
@@ -1523,14 +1577,6 @@ client.indexing.index_gcs_directory_v2(
-**idempotency_key:** `typing.Optional[str]` — UUID for request deduplication - -
-
- -
-
- **max_files:** `typing.Optional[int]` — Maximum number of files to index (optional)
@@ -1597,14 +1643,14 @@ Index all files from an Azure Blob Storage container into a collection. Returns from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_azure_container_v2( - collection_name="my_documents", + collection_name="collection_name", container_name="my-container", account_name="mystorageaccount", - account_key="your_account_key", + account_key="your_account_key_base64", processing_type="advanced", ) @@ -1622,7 +1668,7 @@ client.indexing.index_azure_container_v2(
-**collection_name:** `str` — Name of the collection to index into +**collection_name:** `str`
@@ -1662,14 +1708,6 @@ client.indexing.index_azure_container_v2(
-**idempotency_key:** `typing.Optional[str]` — UUID for request deduplication - -
-
- -
-
- **max_files:** `typing.Optional[int]` — Maximum number of files to index (optional)
@@ -1736,15 +1774,15 @@ Index a single file from an Azure Blob Storage container into a collection. Retu from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_azure_file_v2( - collection_name="my_documents", + collection_name="collection_name", container_name="my-container", file_uri="https://mystorageaccount.blob.core.windows.net/my-container/contracts/acme_contract.pdf", account_name="mystorageaccount", - account_key="your_account_key", + account_key="your_account_key_base64", processing_type="advanced", ) @@ -1762,7 +1800,7 @@ client.indexing.index_azure_file_v2(
-**collection_name:** `str` — Name of the collection to index into +**collection_name:** `str`
@@ -1860,15 +1898,15 @@ Index all files from a specific directory (prefix) in an Azure Blob Storage cont from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_azure_directory_v2( - collection_name="my_documents", + collection_name="collection_name", container_name="my-container", directory_path="reports/2024/january", account_name="mystorageaccount", - account_key="your_account_key", + account_key="your_account_key_base64", processing_type="advanced", ) @@ -1886,7 +1924,7 @@ client.indexing.index_azure_directory_v2(
-**collection_name:** `str` — Name of the collection to index into +**collection_name:** `str`
@@ -1934,14 +1972,6 @@ client.indexing.index_azure_directory_v2(
-**idempotency_key:** `typing.Optional[str]` — UUID for request deduplication - -
-
- -
-
- **max_files:** `typing.Optional[int]` — Maximum number of files to index (optional)
@@ -2034,11 +2064,11 @@ Each file in the `files` array has a status: from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.jobs.get_job_status_v2( - job_id="abc123xyz-1234567890", + job_id="job_id", ) ``` @@ -2055,7 +2085,7 @@ client.jobs.get_job_status_v2(
-**job_id:** `str` — The job ID returned from an indexing request +**job_id:** `str`
@@ -2109,11 +2139,11 @@ Behavior: from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.jobs.cancel_job_v2( - job_id="abc123xyz-1234567890", + job_id="job_id", ) ``` @@ -2130,7 +2160,7 @@ client.jobs.cancel_job_v2(
-**job_id:** `str` — The job ID to cancel +**job_id:** `str`
@@ -2191,12 +2221,13 @@ Returns a list of search results with title, URL, snippet, and date. from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.datasets.search_dataset( dataset="nytimes", - q="", + q="q", + limit=1, ) ``` @@ -2290,12 +2321,12 @@ Returns the full article content in markdown format, along with metadata like ti from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.datasets.get_dataset_article( dataset="nytimes", - url="https://www.washingtonpost.com/example/news_example.html", + url="url", ) ``` diff --git a/src/runcaptain/client.py b/src/runcaptain/client.py index 4c84d40..ff87d3b 100644 --- a/src/runcaptain/client.py +++ b/src/runcaptain/client.py @@ -2,12 +2,16 @@ from __future__ import annotations +import os import typing import httpx +from .core.api_error import ApiError from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .core.logging import LogConfig, Logger +from .core.request_options import RequestOptions from .environment import CaptainEnvironment +from .raw_client import AsyncRawCaptain, RawCaptain if typing.TYPE_CHECKING: from .collections.client import AsyncCollectionsClient, CollectionsClient @@ -35,8 +39,8 @@ class Captain: - authorization : str organization_id : typing.Optional[str] + key : typing.Optional[typing.Union[str, typing.Callable[[], str]]] headers : typing.Optional[typing.Dict[str, str]] Additional headers to send with every request. @@ -57,8 +61,8 @@ class Captain: from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) """ @@ -67,8 +71,8 @@ def __init__( *, base_url: typing.Optional[str] = None, environment: CaptainEnvironment = CaptainEnvironment.DEFAULT, - authorization: str, - organization_id: typing.Optional[str] = None, + organization_id: typing.Optional[str] = os.getenv("CAPTAIN_ORGANIZATION_ID"), + key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv("CAPTAIN_API_KEY"), headers: typing.Optional[typing.Dict[str, str]] = None, timeout: typing.Optional[float] = None, follow_redirects: typing.Optional[bool] = True, @@ -78,10 +82,16 @@ def __init__( _defaulted_timeout = ( timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read ) + if organization_id is None: + raise ApiError( + body="The client must be instantiated be either passing in organization_id or setting CAPTAIN_ORGANIZATION_ID" + ) + if key is None: + raise ApiError(body="The client must be instantiated be either passing in key or setting CAPTAIN_API_KEY") self._client_wrapper = SyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), - authorization=authorization, organization_id=organization_id, + key=key, headers=headers, httpx_client=httpx_client if httpx_client is not None @@ -91,12 +101,80 @@ def __init__( timeout=_defaulted_timeout, logging=logging, ) + self._raw_client = RawCaptain(client_wrapper=self._client_wrapper) self._collections: typing.Optional[CollectionsClient] = None self._query: typing.Optional[QueryClient] = None self._indexing: typing.Optional[IndexingClient] = None self._jobs: typing.Optional[JobsClient] = None self._datasets: typing.Optional[DatasetsClient] = None + @property + def with_raw_response(self) -> RawCaptain: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawCaptain + """ + return self._raw_client + + def post_v2collections_collection_name_documents_wipe( + self, collection_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Parameters + ---------- + collection_name : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from runcaptain import Captain + + client = Captain( + organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", + ) + client.post_v2collections_collection_name_documents_wipe( + collection_name="collection_name", + ) + """ + _response = self._raw_client.post_v2collections_collection_name_documents_wipe( + collection_name, request_options=request_options + ) + return _response.data + + def post_v2datasets_search(self, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from runcaptain import Captain + + client = Captain( + organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", + ) + client.post_v2datasets_search() + """ + _response = self._raw_client.post_v2datasets_search(request_options=request_options) + return _response.data + @property def collections(self): if self._collections is None: @@ -156,8 +234,8 @@ class AsyncCaptain: - authorization : str organization_id : typing.Optional[str] + key : typing.Optional[typing.Union[str, typing.Callable[[], str]]] headers : typing.Optional[typing.Dict[str, str]] Additional headers to send with every request. @@ -178,8 +256,8 @@ class AsyncCaptain: from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) """ @@ -188,8 +266,8 @@ def __init__( *, base_url: typing.Optional[str] = None, environment: CaptainEnvironment = CaptainEnvironment.DEFAULT, - authorization: str, - organization_id: typing.Optional[str] = None, + organization_id: typing.Optional[str] = os.getenv("CAPTAIN_ORGANIZATION_ID"), + key: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = os.getenv("CAPTAIN_API_KEY"), headers: typing.Optional[typing.Dict[str, str]] = None, timeout: typing.Optional[float] = None, follow_redirects: typing.Optional[bool] = True, @@ -199,10 +277,16 @@ def __init__( _defaulted_timeout = ( timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read ) + if organization_id is None: + raise ApiError( + body="The client must be instantiated be either passing in organization_id or setting CAPTAIN_ORGANIZATION_ID" + ) + if key is None: + raise ApiError(body="The client must be instantiated be either passing in key or setting CAPTAIN_API_KEY") self._client_wrapper = AsyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), - authorization=authorization, organization_id=organization_id, + key=key, headers=headers, httpx_client=httpx_client if httpx_client is not None @@ -212,12 +296,96 @@ def __init__( timeout=_defaulted_timeout, logging=logging, ) + self._raw_client = AsyncRawCaptain(client_wrapper=self._client_wrapper) self._collections: typing.Optional[AsyncCollectionsClient] = None self._query: typing.Optional[AsyncQueryClient] = None self._indexing: typing.Optional[AsyncIndexingClient] = None self._jobs: typing.Optional[AsyncJobsClient] = None self._datasets: typing.Optional[AsyncDatasetsClient] = None + @property + def with_raw_response(self) -> AsyncRawCaptain: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawCaptain + """ + return self._raw_client + + async def post_v2collections_collection_name_documents_wipe( + self, collection_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Parameters + ---------- + collection_name : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from runcaptain import AsyncCaptain + + client = AsyncCaptain( + organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", + ) + + + async def main() -> None: + await client.post_v2collections_collection_name_documents_wipe( + collection_name="collection_name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.post_v2collections_collection_name_documents_wipe( + collection_name, request_options=request_options + ) + return _response.data + + async def post_v2datasets_search(self, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from runcaptain import AsyncCaptain + + client = AsyncCaptain( + organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", + ) + + + async def main() -> None: + await client.post_v2datasets_search() + + + asyncio.run(main()) + """ + _response = await self._raw_client.post_v2datasets_search(request_options=request_options) + return _response.data + @property def collections(self): if self._collections is None: diff --git a/src/runcaptain/collections/client.py b/src/runcaptain/collections/client.py index d043171..6fc6efe 100644 --- a/src/runcaptain/collections/client.py +++ b/src/runcaptain/collections/client.py @@ -33,11 +33,7 @@ def with_raw_response(self) -> RawCollectionsClient: return self._raw_client def list_collections_v2( - self, - *, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, + self, *, request_options: typing.Optional[RequestOptions] = None ) -> CollectionListResponseV2: """ List all collections for an organization. @@ -46,12 +42,6 @@ def list_collections_v2( Parameters ---------- - limit : typing.Optional[int] - Maximum number of collections to return - - offset : typing.Optional[int] - Pagination offset - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -65,12 +55,12 @@ def list_collections_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.list_collections_v2() """ - _response = self._raw_client.list_collections_v2(limit=limit, offset=offset, request_options=request_options) + _response = self._raw_client.list_collections_v2(request_options=request_options) return _response.data def create_collection_v2( @@ -86,7 +76,6 @@ def create_collection_v2( Parameters ---------- collection_name : str - Name of the collection to create description : typing.Optional[str] @@ -103,11 +92,11 @@ def create_collection_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.create_collection_v2( - collection_name="my_documents", + collection_name="collection_name", ) """ _response = self._raw_client.create_collection_v2( @@ -124,7 +113,6 @@ def delete_collection_v2( Parameters ---------- collection_name : str - Name of the collection to delete request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -139,11 +127,11 @@ def delete_collection_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.delete_collection_v2( - collection_name="my_documents", + collection_name="collection_name", ) """ _response = self._raw_client.delete_collection_v2(collection_name, request_options=request_options) @@ -174,7 +162,6 @@ def change_collection_environment_v2( Parameters ---------- collection_name : str - Name of the collection to move new_environment : ChangeEnvironmentRequestV2NewEnvironment The target environment to move the collection to @@ -192,12 +179,12 @@ def change_collection_environment_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.change_collection_environment_v2( - collection_name="my_documents", - new_environment="production", + collection_name="collection_name", + new_environment="development", ) """ _response = self._raw_client.change_collection_environment_v2( @@ -209,7 +196,6 @@ def list_documents_v2( self, collection_name: str, *, - limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, ) -> DocumentListResponseV2: @@ -219,10 +205,6 @@ def list_documents_v2( Parameters ---------- collection_name : str - Name of the collection - - limit : typing.Optional[int] - Maximum number of documents to return offset : typing.Optional[int] Pagination offset @@ -240,18 +222,15 @@ def list_documents_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.list_documents_v2( - collection_name="my_documents", - limit=100, - offset=0, + collection_name="collection_name", + offset=1, ) """ - _response = self._raw_client.list_documents_v2( - collection_name, limit=limit, offset=offset, request_options=request_options - ) + _response = self._raw_client.list_documents_v2(collection_name, offset=offset, request_options=request_options) return _response.data def wipe_collection_documents_v2( @@ -278,8 +257,8 @@ def wipe_collection_documents_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.wipe_collection_documents_v2( collection_name="collection_name", @@ -297,10 +276,8 @@ def delete_document_v2( Parameters ---------- collection_name : str - Name of the collection document_id : str - ID of the document to delete request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -315,8 +292,8 @@ def delete_document_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.collections.delete_document_v2( collection_name="collection_name", @@ -343,11 +320,7 @@ def with_raw_response(self) -> AsyncRawCollectionsClient: return self._raw_client async def list_collections_v2( - self, - *, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, + self, *, request_options: typing.Optional[RequestOptions] = None ) -> CollectionListResponseV2: """ List all collections for an organization. @@ -356,12 +329,6 @@ async def list_collections_v2( Parameters ---------- - limit : typing.Optional[int] - Maximum number of collections to return - - offset : typing.Optional[int] - Pagination offset - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -377,8 +344,8 @@ async def list_collections_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) @@ -388,9 +355,7 @@ async def main() -> None: asyncio.run(main()) """ - _response = await self._raw_client.list_collections_v2( - limit=limit, offset=offset, request_options=request_options - ) + _response = await self._raw_client.list_collections_v2(request_options=request_options) return _response.data async def create_collection_v2( @@ -406,7 +371,6 @@ async def create_collection_v2( Parameters ---------- collection_name : str - Name of the collection to create description : typing.Optional[str] @@ -425,14 +389,14 @@ async def create_collection_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.collections.create_collection_v2( - collection_name="my_documents", + collection_name="collection_name", ) @@ -452,7 +416,6 @@ async def delete_collection_v2( Parameters ---------- collection_name : str - Name of the collection to delete request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -469,14 +432,14 @@ async def delete_collection_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.collections.delete_collection_v2( - collection_name="my_documents", + collection_name="collection_name", ) @@ -510,7 +473,6 @@ async def change_collection_environment_v2( Parameters ---------- collection_name : str - Name of the collection to move new_environment : ChangeEnvironmentRequestV2NewEnvironment The target environment to move the collection to @@ -530,15 +492,15 @@ async def change_collection_environment_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.collections.change_collection_environment_v2( - collection_name="my_documents", - new_environment="production", + collection_name="collection_name", + new_environment="development", ) @@ -553,7 +515,6 @@ async def list_documents_v2( self, collection_name: str, *, - limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, ) -> DocumentListResponseV2: @@ -563,10 +524,6 @@ async def list_documents_v2( Parameters ---------- collection_name : str - Name of the collection - - limit : typing.Optional[int] - Maximum number of documents to return offset : typing.Optional[int] Pagination offset @@ -586,23 +543,22 @@ async def list_documents_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.collections.list_documents_v2( - collection_name="my_documents", - limit=100, - offset=0, + collection_name="collection_name", + offset=1, ) asyncio.run(main()) """ _response = await self._raw_client.list_documents_v2( - collection_name, limit=limit, offset=offset, request_options=request_options + collection_name, offset=offset, request_options=request_options ) return _response.data @@ -632,8 +588,8 @@ async def wipe_collection_documents_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) @@ -659,10 +615,8 @@ async def delete_document_v2( Parameters ---------- collection_name : str - Name of the collection document_id : str - ID of the document to delete request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -679,8 +633,8 @@ async def delete_document_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) diff --git a/src/runcaptain/collections/raw_client.py b/src/runcaptain/collections/raw_client.py index 8db600a..8453bf2 100644 --- a/src/runcaptain/collections/raw_client.py +++ b/src/runcaptain/collections/raw_client.py @@ -29,11 +29,7 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper def list_collections_v2( - self, - *, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, + self, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[CollectionListResponseV2]: """ List all collections for an organization. @@ -42,12 +38,6 @@ def list_collections_v2( Parameters ---------- - limit : typing.Optional[int] - Maximum number of collections to return - - offset : typing.Optional[int] - Pagination offset - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -59,10 +49,6 @@ def list_collections_v2( _response = self._client_wrapper.httpx_client.request( "v2/collections", method="GET", - params={ - "limit": limit, - "offset": offset, - }, request_options=request_options, ) try: @@ -93,7 +79,6 @@ def create_collection_v2( Parameters ---------- collection_name : str - Name of the collection to create description : typing.Optional[str] @@ -141,7 +126,6 @@ def delete_collection_v2( Parameters ---------- collection_name : str - Name of the collection to delete request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -207,7 +191,6 @@ def change_collection_environment_v2( Parameters ---------- collection_name : str - Name of the collection to move new_environment : ChangeEnvironmentRequestV2NewEnvironment The target environment to move the collection to @@ -284,7 +267,6 @@ def list_documents_v2( self, collection_name: str, *, - limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[DocumentListResponseV2]: @@ -294,10 +276,6 @@ def list_documents_v2( Parameters ---------- collection_name : str - Name of the collection - - limit : typing.Optional[int] - Maximum number of documents to return offset : typing.Optional[int] Pagination offset @@ -314,7 +292,6 @@ def list_documents_v2( f"v2/collections/{jsonable_encoder(collection_name)}/documents", method="GET", params={ - "limit": limit, "offset": offset, }, request_options=request_options, @@ -382,10 +359,8 @@ def delete_document_v2( Parameters ---------- collection_name : str - Name of the collection document_id : str - ID of the document to delete request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -432,11 +407,7 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper async def list_collections_v2( - self, - *, - limit: typing.Optional[int] = None, - offset: typing.Optional[int] = None, - request_options: typing.Optional[RequestOptions] = None, + self, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[CollectionListResponseV2]: """ List all collections for an organization. @@ -445,12 +416,6 @@ async def list_collections_v2( Parameters ---------- - limit : typing.Optional[int] - Maximum number of collections to return - - offset : typing.Optional[int] - Pagination offset - request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -462,10 +427,6 @@ async def list_collections_v2( _response = await self._client_wrapper.httpx_client.request( "v2/collections", method="GET", - params={ - "limit": limit, - "offset": offset, - }, request_options=request_options, ) try: @@ -496,7 +457,6 @@ async def create_collection_v2( Parameters ---------- collection_name : str - Name of the collection to create description : typing.Optional[str] @@ -544,7 +504,6 @@ async def delete_collection_v2( Parameters ---------- collection_name : str - Name of the collection to delete request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -610,7 +569,6 @@ async def change_collection_environment_v2( Parameters ---------- collection_name : str - Name of the collection to move new_environment : ChangeEnvironmentRequestV2NewEnvironment The target environment to move the collection to @@ -687,7 +645,6 @@ async def list_documents_v2( self, collection_name: str, *, - limit: typing.Optional[int] = None, offset: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[DocumentListResponseV2]: @@ -697,10 +654,6 @@ async def list_documents_v2( Parameters ---------- collection_name : str - Name of the collection - - limit : typing.Optional[int] - Maximum number of documents to return offset : typing.Optional[int] Pagination offset @@ -717,7 +670,6 @@ async def list_documents_v2( f"v2/collections/{jsonable_encoder(collection_name)}/documents", method="GET", params={ - "limit": limit, "offset": offset, }, request_options=request_options, @@ -785,10 +737,8 @@ async def delete_document_v2( Parameters ---------- collection_name : str - Name of the collection document_id : str - ID of the document to delete request_options : typing.Optional[RequestOptions] Request-specific configuration. diff --git a/src/runcaptain/core/client_wrapper.py b/src/runcaptain/core/client_wrapper.py index 8b7c254..12bc453 100644 --- a/src/runcaptain/core/client_wrapper.py +++ b/src/runcaptain/core/client_wrapper.py @@ -11,15 +11,15 @@ class BaseClientWrapper: def __init__( self, *, - authorization: str, - organization_id: typing.Optional[str] = None, + organization_id: str, + key: typing.Union[str, typing.Callable[[], str]], headers: typing.Optional[typing.Dict[str, str]] = None, base_url: str, timeout: typing.Optional[float] = None, logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, ): - self._authorization = authorization self._organization_id = organization_id + self._key = key self._headers = headers self._base_url = base_url self._timeout = timeout @@ -29,19 +29,24 @@ def get_headers(self) -> typing.Dict[str, str]: import platform headers: typing.Dict[str, str] = { - "User-Agent": "captain-sdk/0.0.0", + "User-Agent": "captain-sdk/0.0.1", "X-Fern-Language": "Python", "X-Fern-Runtime": f"python/{platform.python_version()}", "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", "X-Fern-SDK-Name": "captain-sdk", - "X-Fern-SDK-Version": "0.0.0", + "X-Fern-SDK-Version": "0.0.12", **(self.get_custom_headers() or {}), } - headers["Authorization"] = self._authorization - if self._organization_id is not None: - headers["X-Organization-ID"] = self._organization_id + headers["X-Organization-ID"] = self._organization_id + headers["Authorization"] = f"Bearer {self._get_key()}" return headers + def _get_key(self) -> str: + if isinstance(self._key, str): + return self._key + else: + return self._key() + def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]: return self._headers @@ -56,8 +61,8 @@ class SyncClientWrapper(BaseClientWrapper): def __init__( self, *, - authorization: str, - organization_id: typing.Optional[str] = None, + organization_id: str, + key: typing.Union[str, typing.Callable[[], str]], headers: typing.Optional[typing.Dict[str, str]] = None, base_url: str, timeout: typing.Optional[float] = None, @@ -65,8 +70,8 @@ def __init__( httpx_client: httpx.Client, ): super().__init__( - authorization=authorization, organization_id=organization_id, + key=key, headers=headers, base_url=base_url, timeout=timeout, @@ -85,8 +90,8 @@ class AsyncClientWrapper(BaseClientWrapper): def __init__( self, *, - authorization: str, - organization_id: typing.Optional[str] = None, + organization_id: str, + key: typing.Union[str, typing.Callable[[], str]], headers: typing.Optional[typing.Dict[str, str]] = None, base_url: str, timeout: typing.Optional[float] = None, @@ -95,8 +100,8 @@ def __init__( httpx_client: httpx.AsyncClient, ): super().__init__( - authorization=authorization, organization_id=organization_id, + key=key, headers=headers, base_url=base_url, timeout=timeout, diff --git a/src/runcaptain/datasets/client.py b/src/runcaptain/datasets/client.py index e20d30b..e46bc4d 100644 --- a/src/runcaptain/datasets/client.py +++ b/src/runcaptain/datasets/client.py @@ -71,13 +71,13 @@ def search_dataset( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.datasets.search_dataset( dataset="nytimes", - q="artificial intelligence", - limit=5, + q="q", + limit=1, ) """ _response = self._raw_client.search_dataset(dataset, q=q, limit=limit, request_options=request_options) @@ -125,12 +125,12 @@ def get_dataset_article( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.datasets.get_dataset_article( dataset="nytimes", - url="https://www.nytimes.com/example/news_example.html", + url="url", ) """ _response = self._raw_client.get_dataset_article(dataset, url, request_options=request_options) @@ -199,16 +199,16 @@ async def search_dataset( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.datasets.search_dataset( dataset="nytimes", - q="artificial intelligence", - limit=5, + q="q", + limit=1, ) @@ -261,15 +261,15 @@ async def get_dataset_article( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.datasets.get_dataset_article( dataset="nytimes", - url="https://www.nytimes.com/example/news_example.html", + url="url", ) diff --git a/src/runcaptain/indexing/client.py b/src/runcaptain/indexing/client.py index 41b804c..73d31ae 100644 --- a/src/runcaptain/indexing/client.py +++ b/src/runcaptain/indexing/client.py @@ -43,7 +43,6 @@ def index_s3bucket_v2( aws_access_key_id: str, aws_secret_access_key: str, processing_type: IndexS3RequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, bucket_region: typing.Optional[str] = OMIT, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, @@ -56,7 +55,6 @@ def index_s3bucket_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -70,9 +68,6 @@ def index_s3bucket_v2( processing_type : IndexS3RequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - bucket_region : typing.Optional[str] AWS region where the bucket is located @@ -98,14 +93,14 @@ def index_s3bucket_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_s3bucket_v2( - collection_name="my_documents", - bucket_name="my-s3-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", aws_access_key_id="AKIAIOSFODNN7EXAMPLE", - aws_secret_access_key="your_secret_key", + aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", bucket_region="us-east-1", processing_type="advanced", ) @@ -116,7 +111,6 @@ def index_s3bucket_v2( aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, processing_type=processing_type, - idempotency_key=idempotency_key, bucket_region=bucket_region, max_files=max_files, skip_existing=skip_existing, @@ -144,7 +138,6 @@ def index_s3file_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -180,15 +173,15 @@ def index_s3file_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_s3file_v2( - collection_name="my_documents", - bucket_name="my-s3-bucket", - file_uri="s3://my-s3-bucket/contracts/acme_contract.pdf", + collection_name="collection_name", + bucket_name="my-company-docs", + file_uri="s3://my-company-docs/contracts/acme_contract.pdf", aws_access_key_id="AKIAIOSFODNN7EXAMPLE", - aws_secret_access_key="your_secret_key", + aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", bucket_region="us-east-1", processing_type="advanced", ) @@ -224,7 +217,6 @@ def index_gcs_bucket_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -257,12 +249,12 @@ def index_gcs_bucket_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_gcs_bucket_v2( - collection_name="my_documents", - bucket_name="my-gcs-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", service_account_json='{"type":"service_account","project_id":"my-project",...}', processing_type="advanced", ) @@ -296,7 +288,6 @@ def index_gcs_file_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -326,8 +317,8 @@ def index_gcs_file_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_gcs_file_v2( collection_name="collection_name", @@ -357,7 +348,6 @@ def index_s3directory_v2( aws_access_key_id: str, aws_secret_access_key: str, processing_type: IndexS3DirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, bucket_region: typing.Optional[str] = OMIT, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, @@ -370,7 +360,6 @@ def index_s3directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -387,9 +376,6 @@ def index_s3directory_v2( processing_type : IndexS3DirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - bucket_region : typing.Optional[str] AWS region where the bucket is located @@ -415,15 +401,15 @@ def index_s3directory_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_s3directory_v2( - collection_name="my_documents", - bucket_name="my-s3-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", directory_path="reports/2024/january", aws_access_key_id="AKIAIOSFODNN7EXAMPLE", - aws_secret_access_key="your_secret_key", + aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", bucket_region="us-east-1", processing_type="advanced", ) @@ -435,7 +421,6 @@ def index_s3directory_v2( aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, processing_type=processing_type, - idempotency_key=idempotency_key, bucket_region=bucket_region, max_files=max_files, skip_existing=skip_existing, @@ -452,7 +437,6 @@ def index_gcs_directory_v2( directory_path: str, service_account_json: str, processing_type: IndexGcsDirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -464,7 +448,6 @@ def index_gcs_directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -478,9 +461,6 @@ def index_gcs_directory_v2( processing_type : IndexGcsDirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -503,12 +483,12 @@ def index_gcs_directory_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_gcs_directory_v2( - collection_name="my_documents", - bucket_name="my-gcs-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", directory_path="reports/2024/january", service_account_json='{"type":"service_account","project_id":"my-project",...}', processing_type="advanced", @@ -520,7 +500,6 @@ def index_gcs_directory_v2( directory_path=directory_path, service_account_json=service_account_json, processing_type=processing_type, - idempotency_key=idempotency_key, max_files=max_files, skip_existing=skip_existing, custom_metadata=custom_metadata, @@ -536,7 +515,6 @@ def index_azure_container_v2( account_name: str, account_key: str, processing_type: IndexAzureRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -548,7 +526,6 @@ def index_azure_container_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -562,9 +539,6 @@ def index_azure_container_v2( processing_type : IndexAzureRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -587,14 +561,14 @@ def index_azure_container_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_azure_container_v2( - collection_name="my_documents", + collection_name="collection_name", container_name="my-container", account_name="mystorageaccount", - account_key="your_account_key", + account_key="your_account_key_base64", processing_type="advanced", ) """ @@ -604,7 +578,6 @@ def index_azure_container_v2( account_name=account_name, account_key=account_key, processing_type=processing_type, - idempotency_key=idempotency_key, max_files=max_files, skip_existing=skip_existing, custom_metadata=custom_metadata, @@ -630,7 +603,6 @@ def index_azure_file_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -663,15 +635,15 @@ def index_azure_file_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_azure_file_v2( - collection_name="my_documents", + collection_name="collection_name", container_name="my-container", file_uri="https://mystorageaccount.blob.core.windows.net/my-container/contracts/acme_contract.pdf", account_name="mystorageaccount", - account_key="your_account_key", + account_key="your_account_key_base64", processing_type="advanced", ) """ @@ -696,7 +668,6 @@ def index_azure_directory_v2( account_name: str, account_key: str, processing_type: IndexAzureDirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -708,7 +679,6 @@ def index_azure_directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -725,9 +695,6 @@ def index_azure_directory_v2( processing_type : IndexAzureDirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -750,15 +717,15 @@ def index_azure_directory_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.indexing.index_azure_directory_v2( - collection_name="my_documents", + collection_name="collection_name", container_name="my-container", directory_path="reports/2024/january", account_name="mystorageaccount", - account_key="your_account_key", + account_key="your_account_key_base64", processing_type="advanced", ) """ @@ -769,7 +736,6 @@ def index_azure_directory_v2( account_name=account_name, account_key=account_key, processing_type=processing_type, - idempotency_key=idempotency_key, max_files=max_files, skip_existing=skip_existing, custom_metadata=custom_metadata, @@ -801,7 +767,6 @@ async def index_s3bucket_v2( aws_access_key_id: str, aws_secret_access_key: str, processing_type: IndexS3RequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, bucket_region: typing.Optional[str] = OMIT, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, @@ -814,7 +779,6 @@ async def index_s3bucket_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -828,9 +792,6 @@ async def index_s3bucket_v2( processing_type : IndexS3RequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - bucket_region : typing.Optional[str] AWS region where the bucket is located @@ -858,17 +819,17 @@ async def index_s3bucket_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.indexing.index_s3bucket_v2( - collection_name="my_documents", - bucket_name="my-s3-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", aws_access_key_id="AKIAIOSFODNN7EXAMPLE", - aws_secret_access_key="your_secret_key", + aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", bucket_region="us-east-1", processing_type="advanced", ) @@ -882,7 +843,6 @@ async def main() -> None: aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, processing_type=processing_type, - idempotency_key=idempotency_key, bucket_region=bucket_region, max_files=max_files, skip_existing=skip_existing, @@ -910,7 +870,6 @@ async def index_s3file_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -948,18 +907,18 @@ async def index_s3file_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.indexing.index_s3file_v2( - collection_name="my_documents", - bucket_name="my-s3-bucket", - file_uri="s3://my-s3-bucket/contracts/acme_contract.pdf", + collection_name="collection_name", + bucket_name="my-company-docs", + file_uri="s3://my-company-docs/contracts/acme_contract.pdf", aws_access_key_id="AKIAIOSFODNN7EXAMPLE", - aws_secret_access_key="your_secret_key", + aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", bucket_region="us-east-1", processing_type="advanced", ) @@ -998,7 +957,6 @@ async def index_gcs_bucket_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -1033,15 +991,15 @@ async def index_gcs_bucket_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.indexing.index_gcs_bucket_v2( - collection_name="my_documents", - bucket_name="my-gcs-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", service_account_json='{"type":"service_account","project_id":"my-project",...}', processing_type="advanced", ) @@ -1078,7 +1036,6 @@ async def index_gcs_file_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -1110,8 +1067,8 @@ async def index_gcs_file_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) @@ -1147,7 +1104,6 @@ async def index_s3directory_v2( aws_access_key_id: str, aws_secret_access_key: str, processing_type: IndexS3DirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, bucket_region: typing.Optional[str] = OMIT, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, @@ -1160,7 +1116,6 @@ async def index_s3directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -1177,9 +1132,6 @@ async def index_s3directory_v2( processing_type : IndexS3DirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - bucket_region : typing.Optional[str] AWS region where the bucket is located @@ -1207,18 +1159,18 @@ async def index_s3directory_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.indexing.index_s3directory_v2( - collection_name="my_documents", - bucket_name="my-s3-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", directory_path="reports/2024/january", aws_access_key_id="AKIAIOSFODNN7EXAMPLE", - aws_secret_access_key="your_secret_key", + aws_secret_access_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", bucket_region="us-east-1", processing_type="advanced", ) @@ -1233,7 +1185,6 @@ async def main() -> None: aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, processing_type=processing_type, - idempotency_key=idempotency_key, bucket_region=bucket_region, max_files=max_files, skip_existing=skip_existing, @@ -1250,7 +1201,6 @@ async def index_gcs_directory_v2( directory_path: str, service_account_json: str, processing_type: IndexGcsDirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -1262,7 +1212,6 @@ async def index_gcs_directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -1276,9 +1225,6 @@ async def index_gcs_directory_v2( processing_type : IndexGcsDirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -1303,15 +1249,15 @@ async def index_gcs_directory_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.indexing.index_gcs_directory_v2( - collection_name="my_documents", - bucket_name="my-gcs-bucket", + collection_name="collection_name", + bucket_name="my-company-docs", directory_path="reports/2024/january", service_account_json='{"type":"service_account","project_id":"my-project",...}', processing_type="advanced", @@ -1326,7 +1272,6 @@ async def main() -> None: directory_path=directory_path, service_account_json=service_account_json, processing_type=processing_type, - idempotency_key=idempotency_key, max_files=max_files, skip_existing=skip_existing, custom_metadata=custom_metadata, @@ -1342,7 +1287,6 @@ async def index_azure_container_v2( account_name: str, account_key: str, processing_type: IndexAzureRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -1354,7 +1298,6 @@ async def index_azure_container_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -1368,9 +1311,6 @@ async def index_azure_container_v2( processing_type : IndexAzureRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -1395,17 +1335,17 @@ async def index_azure_container_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.indexing.index_azure_container_v2( - collection_name="my_documents", + collection_name="collection_name", container_name="my-container", account_name="mystorageaccount", - account_key="your_account_key", + account_key="your_account_key_base64", processing_type="advanced", ) @@ -1418,7 +1358,6 @@ async def main() -> None: account_name=account_name, account_key=account_key, processing_type=processing_type, - idempotency_key=idempotency_key, max_files=max_files, skip_existing=skip_existing, custom_metadata=custom_metadata, @@ -1444,7 +1383,6 @@ async def index_azure_file_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -1479,18 +1417,18 @@ async def index_azure_file_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.indexing.index_azure_file_v2( - collection_name="my_documents", + collection_name="collection_name", container_name="my-container", file_uri="https://mystorageaccount.blob.core.windows.net/my-container/contracts/acme_contract.pdf", account_name="mystorageaccount", - account_key="your_account_key", + account_key="your_account_key_base64", processing_type="advanced", ) @@ -1518,7 +1456,6 @@ async def index_azure_directory_v2( account_name: str, account_key: str, processing_type: IndexAzureDirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -1530,7 +1467,6 @@ async def index_azure_directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -1547,9 +1483,6 @@ async def index_azure_directory_v2( processing_type : IndexAzureDirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -1574,18 +1507,18 @@ async def index_azure_directory_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.indexing.index_azure_directory_v2( - collection_name="my_documents", + collection_name="collection_name", container_name="my-container", directory_path="reports/2024/january", account_name="mystorageaccount", - account_key="your_account_key", + account_key="your_account_key_base64", processing_type="advanced", ) @@ -1599,7 +1532,6 @@ async def main() -> None: account_name=account_name, account_key=account_key, processing_type=processing_type, - idempotency_key=idempotency_key, max_files=max_files, skip_existing=skip_existing, custom_metadata=custom_metadata, diff --git a/src/runcaptain/indexing/raw_client.py b/src/runcaptain/indexing/raw_client.py index bb8f09b..db63203 100644 --- a/src/runcaptain/indexing/raw_client.py +++ b/src/runcaptain/indexing/raw_client.py @@ -36,7 +36,6 @@ def index_s3bucket_v2( aws_access_key_id: str, aws_secret_access_key: str, processing_type: IndexS3RequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, bucket_region: typing.Optional[str] = OMIT, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, @@ -49,7 +48,6 @@ def index_s3bucket_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -63,9 +61,6 @@ def index_s3bucket_v2( processing_type : IndexS3RequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - bucket_region : typing.Optional[str] AWS region where the bucket is located @@ -101,7 +96,6 @@ def index_s3bucket_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, @@ -140,7 +134,6 @@ def index_s3file_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -222,7 +215,6 @@ def index_gcs_bucket_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -299,7 +291,6 @@ def index_gcs_file_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -364,7 +355,6 @@ def index_s3directory_v2( aws_access_key_id: str, aws_secret_access_key: str, processing_type: IndexS3DirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, bucket_region: typing.Optional[str] = OMIT, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, @@ -377,7 +367,6 @@ def index_s3directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -394,9 +383,6 @@ def index_s3directory_v2( processing_type : IndexS3DirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - bucket_region : typing.Optional[str] AWS region where the bucket is located @@ -433,7 +419,6 @@ def index_s3directory_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, @@ -461,7 +446,6 @@ def index_gcs_directory_v2( directory_path: str, service_account_json: str, processing_type: IndexGcsDirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -473,7 +457,6 @@ def index_gcs_directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -487,9 +470,6 @@ def index_gcs_directory_v2( processing_type : IndexGcsDirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -521,7 +501,6 @@ def index_gcs_directory_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, @@ -549,7 +528,6 @@ def index_azure_container_v2( account_name: str, account_key: str, processing_type: IndexAzureRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -561,7 +539,6 @@ def index_azure_container_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -575,9 +552,6 @@ def index_azure_container_v2( processing_type : IndexAzureRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -609,7 +583,6 @@ def index_azure_container_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, @@ -647,7 +620,6 @@ def index_azure_file_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -716,7 +688,6 @@ def index_azure_directory_v2( account_name: str, account_key: str, processing_type: IndexAzureDirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -728,7 +699,6 @@ def index_azure_directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -745,9 +715,6 @@ def index_azure_directory_v2( processing_type : IndexAzureDirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -780,7 +747,6 @@ def index_azure_directory_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, @@ -813,7 +779,6 @@ async def index_s3bucket_v2( aws_access_key_id: str, aws_secret_access_key: str, processing_type: IndexS3RequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, bucket_region: typing.Optional[str] = OMIT, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, @@ -826,7 +791,6 @@ async def index_s3bucket_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -840,9 +804,6 @@ async def index_s3bucket_v2( processing_type : IndexS3RequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - bucket_region : typing.Optional[str] AWS region where the bucket is located @@ -878,7 +839,6 @@ async def index_s3bucket_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, @@ -917,7 +877,6 @@ async def index_s3file_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -999,7 +958,6 @@ async def index_gcs_bucket_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -1076,7 +1034,6 @@ async def index_gcs_file_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -1141,7 +1098,6 @@ async def index_s3directory_v2( aws_access_key_id: str, aws_secret_access_key: str, processing_type: IndexS3DirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, bucket_region: typing.Optional[str] = OMIT, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, @@ -1154,7 +1110,6 @@ async def index_s3directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the S3 bucket @@ -1171,9 +1126,6 @@ async def index_s3directory_v2( processing_type : IndexS3DirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - bucket_region : typing.Optional[str] AWS region where the bucket is located @@ -1210,7 +1162,6 @@ async def index_s3directory_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, @@ -1238,7 +1189,6 @@ async def index_gcs_directory_v2( directory_path: str, service_account_json: str, processing_type: IndexGcsDirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -1250,7 +1200,6 @@ async def index_gcs_directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into bucket_name : str Name of the GCS bucket @@ -1264,9 +1213,6 @@ async def index_gcs_directory_v2( processing_type : IndexGcsDirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -1298,7 +1244,6 @@ async def index_gcs_directory_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, @@ -1326,7 +1271,6 @@ async def index_azure_container_v2( account_name: str, account_key: str, processing_type: IndexAzureRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -1338,7 +1282,6 @@ async def index_azure_container_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -1352,9 +1295,6 @@ async def index_azure_container_v2( processing_type : IndexAzureRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -1386,7 +1326,6 @@ async def index_azure_container_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, @@ -1424,7 +1363,6 @@ async def index_azure_file_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -1493,7 +1431,6 @@ async def index_azure_directory_v2( account_name: str, account_key: str, processing_type: IndexAzureDirectoryRequestV2ProcessingType, - idempotency_key: typing.Optional[str] = None, max_files: typing.Optional[int] = OMIT, skip_existing: typing.Optional[bool] = OMIT, custom_metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, @@ -1505,7 +1442,6 @@ async def index_azure_directory_v2( Parameters ---------- collection_name : str - Name of the collection to index into container_name : str Name of the Azure Blob Storage container @@ -1522,9 +1458,6 @@ async def index_azure_directory_v2( processing_type : IndexAzureDirectoryRequestV2ProcessingType Document processing type. 'advanced' uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. 'basic' provides reliable OCR optimized for general document indexing and high-volume processing. - idempotency_key : typing.Optional[str] - UUID for request deduplication - max_files : typing.Optional[int] Maximum number of files to index (optional) @@ -1557,7 +1490,6 @@ async def index_azure_directory_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, diff --git a/src/runcaptain/jobs/client.py b/src/runcaptain/jobs/client.py index cd021dd..10f5a5b 100644 --- a/src/runcaptain/jobs/client.py +++ b/src/runcaptain/jobs/client.py @@ -58,7 +58,6 @@ def get_job_status_v2( Parameters ---------- job_id : str - The job ID returned from an indexing request request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -73,11 +72,11 @@ def get_job_status_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.jobs.get_job_status_v2( - job_id="abc123xyz-1234567890", + job_id="job_id", ) """ _response = self._raw_client.get_job_status_v2(job_id, request_options=request_options) @@ -96,7 +95,6 @@ def cancel_job_v2( Parameters ---------- job_id : str - The job ID to cancel request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -111,11 +109,11 @@ def cancel_job_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.jobs.cancel_job_v2( - job_id="abc123xyz-1234567890", + job_id="job_id", ) """ _response = self._raw_client.cancel_job_v2(job_id, request_options=request_options) @@ -171,7 +169,6 @@ async def get_job_status_v2( Parameters ---------- job_id : str - The job ID returned from an indexing request request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -188,14 +185,14 @@ async def get_job_status_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.jobs.get_job_status_v2( - job_id="abc123xyz-1234567890", + job_id="job_id", ) @@ -217,7 +214,6 @@ async def cancel_job_v2( Parameters ---------- job_id : str - The job ID to cancel request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -234,14 +230,14 @@ async def cancel_job_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.jobs.cancel_job_v2( - job_id="abc123xyz-1234567890", + job_id="job_id", ) diff --git a/src/runcaptain/jobs/raw_client.py b/src/runcaptain/jobs/raw_client.py index 8f15a15..74cd595 100644 --- a/src/runcaptain/jobs/raw_client.py +++ b/src/runcaptain/jobs/raw_client.py @@ -52,7 +52,6 @@ def get_job_status_v2( Parameters ---------- job_id : str - The job ID returned from an indexing request request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -106,7 +105,6 @@ def cancel_job_v2( Parameters ---------- job_id : str - The job ID to cancel request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -175,7 +173,6 @@ async def get_job_status_v2( Parameters ---------- job_id : str - The job ID returned from an indexing request request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -229,7 +226,6 @@ async def cancel_job_v2( Parameters ---------- job_id : str - The job ID to cancel request_options : typing.Optional[RequestOptions] Request-specific configuration. diff --git a/src/runcaptain/query/client.py b/src/runcaptain/query/client.py index a923999..1613280 100644 --- a/src/runcaptain/query/client.py +++ b/src/runcaptain/query/client.py @@ -31,7 +31,6 @@ def collection_v2( collection_name: str, *, query: str, - idempotency_key: typing.Optional[str] = None, inference: typing.Optional[bool] = OMIT, stream: typing.Optional[bool] = OMIT, top_k: typing.Optional[int] = OMIT, @@ -97,14 +96,10 @@ def collection_v2( Parameters ---------- collection_name : str - Name of the collection to query query : str The natural language query to search for - idempotency_key : typing.Optional[str] - UUID for request deduplication - inference : typing.Optional[bool] Enable LLM-generated answers based on the relevant sections retrieved. When false, returns raw search results. @@ -136,22 +131,19 @@ def collection_v2( from runcaptain import Captain client = Captain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) client.query.collection_v2( - collection_name="my_documents", - query="What are the key terms in the contract?", - inference=False, + collection_name="collection_name", + query="Find Q3 contracts mentioning 'termination for convenience'", + inference=True, stream=False, - top_k=10, - rerank=True, ) """ _response = self._raw_client.collection_v2( collection_name, query=query, - idempotency_key=idempotency_key, inference=inference, stream=stream, top_k=top_k, @@ -183,7 +175,6 @@ async def collection_v2( collection_name: str, *, query: str, - idempotency_key: typing.Optional[str] = None, inference: typing.Optional[bool] = OMIT, stream: typing.Optional[bool] = OMIT, top_k: typing.Optional[int] = OMIT, @@ -249,14 +240,10 @@ async def collection_v2( Parameters ---------- collection_name : str - Name of the collection to query query : str The natural language query to search for - idempotency_key : typing.Optional[str] - UUID for request deduplication - inference : typing.Optional[bool] Enable LLM-generated answers based on the relevant sections retrieved. When false, returns raw search results. @@ -290,19 +277,17 @@ async def collection_v2( from runcaptain import AsyncCaptain client = AsyncCaptain( - authorization="YOUR_AUTHORIZATION", organization_id="YOUR_ORGANIZATION_ID", + key="YOUR_KEY", ) async def main() -> None: await client.query.collection_v2( - collection_name="my_documents", - query="What are the key terms in the contract?", - inference=False, + collection_name="collection_name", + query="Find Q3 contracts mentioning 'termination for convenience'", + inference=True, stream=False, - top_k=10, - rerank=True, ) @@ -311,7 +296,6 @@ async def main() -> None: _response = await self._raw_client.collection_v2( collection_name, query=query, - idempotency_key=idempotency_key, inference=inference, stream=stream, top_k=top_k, diff --git a/src/runcaptain/query/raw_client.py b/src/runcaptain/query/raw_client.py index 1c53391..0459590 100644 --- a/src/runcaptain/query/raw_client.py +++ b/src/runcaptain/query/raw_client.py @@ -24,7 +24,6 @@ def collection_v2( collection_name: str, *, query: str, - idempotency_key: typing.Optional[str] = None, inference: typing.Optional[bool] = OMIT, stream: typing.Optional[bool] = OMIT, top_k: typing.Optional[int] = OMIT, @@ -90,14 +89,10 @@ def collection_v2( Parameters ---------- collection_name : str - Name of the collection to query query : str The natural language query to search for - idempotency_key : typing.Optional[str] - UUID for request deduplication - inference : typing.Optional[bool] Enable LLM-generated answers based on the relevant sections retrieved. When false, returns raw search results. @@ -138,7 +133,6 @@ def collection_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, @@ -168,7 +162,6 @@ async def collection_v2( collection_name: str, *, query: str, - idempotency_key: typing.Optional[str] = None, inference: typing.Optional[bool] = OMIT, stream: typing.Optional[bool] = OMIT, top_k: typing.Optional[int] = OMIT, @@ -234,14 +227,10 @@ async def collection_v2( Parameters ---------- collection_name : str - Name of the collection to query query : str The natural language query to search for - idempotency_key : typing.Optional[str] - UUID for request deduplication - inference : typing.Optional[bool] Enable LLM-generated answers based on the relevant sections retrieved. When false, returns raw search results. @@ -282,7 +271,6 @@ async def collection_v2( }, headers={ "content-type": "application/json", - "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None, }, request_options=request_options, omit=OMIT, diff --git a/src/runcaptain/raw_client.py b/src/runcaptain/raw_client.py new file mode 100644 index 0000000..b59019a --- /dev/null +++ b/src/runcaptain/raw_client.py @@ -0,0 +1,126 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .core.api_error import ApiError +from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .core.http_response import AsyncHttpResponse, HttpResponse +from .core.jsonable_encoder import jsonable_encoder +from .core.request_options import RequestOptions + + +class RawCaptain: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def post_v2collections_collection_name_documents_wipe( + self, collection_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[None]: + """ + Parameters + ---------- + collection_name : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v2/collections/{jsonable_encoder(collection_name)}/documents/wipe", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def post_v2datasets_search(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + "v2/datasets/search", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawCaptain: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def post_v2collections_collection_name_documents_wipe( + self, collection_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Parameters + ---------- + collection_name : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v2/collections/{jsonable_encoder(collection_name)}/documents/wipe", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def post_v2datasets_search( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + "v2/datasets/search", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/runcaptain/types/collection_item_v2.py b/src/runcaptain/types/collection_item_v2.py index d7c9be3..15b105d 100644 --- a/src/runcaptain/types/collection_item_v2.py +++ b/src/runcaptain/types/collection_item_v2.py @@ -7,19 +7,9 @@ class CollectionItemV2(UniversalBaseModel): - collection_id: str = pydantic.Field() - """ - Unique identifier for the collection - """ - - collection_name: str = pydantic.Field() - """ - Name of the collection - """ - environment: typing.Optional[str] = pydantic.Field(default=None) """ - Environment the collection belongs to (e.g. production, staging, development) + Environment the collection belongs to """ is_active: typing.Optional[bool] = pydantic.Field(default=None) @@ -37,9 +27,14 @@ class CollectionItemV2(UniversalBaseModel): Total number of API requests made against this collection """ - document_count: typing.Optional[int] = pydantic.Field(default=None) + database_name: str = pydantic.Field() + """ + Name of the collection database + """ + + file_count: int = pydantic.Field() """ - Total number of documents indexed in this collection + Total number of files indexed in this collection """ if IS_PYDANTIC_V2: