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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,59 @@ Methods:
- <code title="get /parse/jobs/{job_id}/results">client.parse.<a href="./src/contextual/resources/parse.py">job_results</a>(job_id, \*\*<a href="src/contextual/types/parse_job_results_params.py">params</a>) -> <a href="./src/contextual/types/parse_job_results_response.py">ParseJobResultsResponse</a></code>
- <code title="get /parse/jobs/{job_id}/status">client.parse.<a href="./src/contextual/resources/parse.py">job_status</a>(job_id) -> <a href="./src/contextual/types/parse_job_status_response.py">ParseJobStatusResponse</a></code>
- <code title="get /parse/jobs">client.parse.<a href="./src/contextual/resources/parse.py">jobs</a>(\*\*<a href="src/contextual/types/parse_jobs_params.py">params</a>) -> <a href="./src/contextual/types/parse_jobs_response.py">ParseJobsResponse</a></code>

# Extract

Types:

```python
from contextual.types import ExtractDeleteDocumentResponse, ExtractDeleteSchemaResponse, ExtractListDocumentsResponse, ExtractRetrieveDocumentResponse, ExtractListJobsResponse, ExtractRetrieveJobResponse, ExtractRetrieveJobResultsResponse, ExtractListSchemasResponse, ExtractRetrieveSchemaResponse, ExtractUploadDocumentResponse, ExtractCreateJobResponse, ExtractCreateSchemaResponse, ExtractUpdateSchemaResponse
```

Methods:

- <code title="delete /extract/documents/{document_id}">client.extract.<a href="./src/contextual/resources/extract.py">delete_document</a>(document_id) -> <a href="./src/contextual/types/extract_delete_document_response.py">ExtractDeleteDocumentResponse</a></code>
- <code title="delete /extract/schemas/{schema_id}">client.extract.<a href="./src/contextual/resources/extract.py">delete_schema</a>(schema_id) -> <a href="./src/contextual/types/extract_delete_schema_response.py">ExtractDeleteSchemaResponse</a></code>
- <code title="get /extract/documents">client.extract.<a href="./src/contextual/resources/extract.py">list_documents</a>(\*\*<a href="src/contextual/types/extract_list_documents_params.py">params</a>) -> <a href="./src/contextual/types/extract_list_documents_response.py">ExtractListDocumentsResponse</a></code>
- <code title="get /extract/documents/{document_id}">client.extract.<a href="./src/contextual/resources/extract.py">retrieve_document</a>(document_id) -> <a href="./src/contextual/types/extract_retrieve_document_response.py">ExtractRetrieveDocumentResponse</a></code>
- <code title="get /extract/jobs">client.extract.<a href="./src/contextual/resources/extract.py">list_jobs</a>(\*\*<a href="src/contextual/types/extract_list_jobs_params.py">params</a>) -> <a href="./src/contextual/types/extract_list_jobs_response.py">ExtractListJobsResponse</a></code>
- <code title="get /extract/jobs/{job_id}">client.extract.<a href="./src/contextual/resources/extract.py">retrieve_job</a>(job_id) -> <a href="./src/contextual/types/extract_retrieve_job_response.py">ExtractRetrieveJobResponse</a></code>
- <code title="get /extract/jobs/{job_id}/results">client.extract.<a href="./src/contextual/resources/extract.py">retrieve_job_results</a>(job_id) -> <a href="./src/contextual/types/extract_retrieve_job_results_response.py">ExtractRetrieveJobResultsResponse</a></code>
- <code title="get /extract/schemas">client.extract.<a href="./src/contextual/resources/extract.py">list_schemas</a>(\*\*<a href="src/contextual/types/extract_list_schemas_params.py">params</a>) -> <a href="./src/contextual/types/extract_list_schemas_response.py">ExtractListSchemasResponse</a></code>
- <code title="get /extract/schemas/{schema_id}">client.extract.<a href="./src/contextual/resources/extract.py">retrieve_schema</a>(schema_id) -> <a href="./src/contextual/types/extract_retrieve_schema_response.py">ExtractRetrieveSchemaResponse</a></code>
- <code title="post /extract/documents/upload">client.extract.<a href="./src/contextual/resources/extract.py">upload_document</a>(\*\*<a href="src/contextual/types/extract_upload_document_params.py">params</a>) -> <a href="./src/contextual/types/extract_upload_document_response.py">ExtractUploadDocumentResponse</a></code>
- <code title="post /extract/jobs">client.extract.<a href="./src/contextual/resources/extract.py">create_job</a>(\*\*<a href="src/contextual/types/extract_create_job_params.py">params</a>) -> <a href="./src/contextual/types/extract_create_job_response.py">ExtractCreateJobResponse</a></code>
- <code title="post /extract/schemas">client.extract.<a href="./src/contextual/resources/extract.py">create_schema</a>(\*\*<a href="src/contextual/types/extract_create_schema_params.py">params</a>) -> <a href="./src/contextual/types/extract_create_schema_response.py">ExtractCreateSchemaResponse</a></code>
- <code title="put /extract/jobs/{job_id}/results">client.extract.<a href="./src/contextual/resources/extract.py">update_job_results</a>(job_id, \*\*<a href="src/contextual/types/extract_update_job_results_params.py">params</a>) -> object</code>
- <code title="put /extract/schemas/{schema_id}">client.extract.<a href="./src/contextual/resources/extract.py">update_schema</a>(schema_id, \*\*<a href="src/contextual/types/extract_update_schema_params.py">params</a>) -> <a href="./src/contextual/types/extract_update_schema_response.py">ExtractUpdateSchemaResponse</a></code>

# Billing

Types:

```python
from contextual.types import BillingRetrieveBalanceResponse, BillingListTopUpsResponse, BillingRetrieveBillingModeHistoryResponse, BillingRetrieveMetadataResponse, BillingRetrieveAclUsageResponse, BillingRetrieveEarliestUsageDateResponse, BillingRetrieveMonthlyUsageResponse
```

Methods:

- <code title="get /billing/balance">client.billing.<a href="./src/contextual/resources/billing.py">retrieve_balance</a>() -> <a href="./src/contextual/types/billing_retrieve_balance_response.py">BillingRetrieveBalanceResponse</a></code>
- <code title="get /billing/balance/top-ups">client.billing.<a href="./src/contextual/resources/billing.py">list_top_ups</a>(\*\*<a href="src/contextual/types/billing_list_top_ups_params.py">params</a>) -> <a href="./src/contextual/types/billing_list_top_ups_response.py">BillingListTopUpsResponse</a></code>
- <code title="get /billing/billing_mode/history">client.billing.<a href="./src/contextual/resources/billing.py">retrieve_billing_mode_history</a>(\*\*<a href="src/contextual/types/billing_retrieve_billing_mode_history_params.py">params</a>) -> <a href="./src/contextual/types/billing_retrieve_billing_mode_history_response.py">BillingRetrieveBillingModeHistoryResponse</a></code>
- <code title="get /billing/metadata">client.billing.<a href="./src/contextual/resources/billing.py">retrieve_metadata</a>() -> <a href="./src/contextual/types/billing_retrieve_metadata_response.py">BillingRetrieveMetadataResponse</a></code>
- <code title="get /billing/usages/acl">client.billing.<a href="./src/contextual/resources/billing.py">retrieve_acl_usage</a>(\*\*<a href="src/contextual/types/billing_retrieve_acl_usage_params.py">params</a>) -> <a href="./src/contextual/types/billing_retrieve_acl_usage_response.py">BillingRetrieveAclUsageResponse</a></code>
- <code title="get /billing/usages/earliest_date">client.billing.<a href="./src/contextual/resources/billing.py">retrieve_earliest_usage_date</a>() -> <a href="./src/contextual/types/billing_retrieve_earliest_usage_date_response.py">BillingRetrieveEarliestUsageDateResponse</a></code>
- <code title="get /billing/usages/monthly">client.billing.<a href="./src/contextual/resources/billing.py">retrieve_monthly_usage</a>(\*\*<a href="src/contextual/types/billing_retrieve_monthly_usage_params.py">params</a>) -> <a href="./src/contextual/types/billing_retrieve_monthly_usage_response.py">BillingRetrieveMonthlyUsageResponse</a></code>

# Workspaces

Types:

```python
from contextual.types import WorkspaceRetrieveConsentResponse, WorkspaceUpdateConsentResponse
```

Methods:

- <code title="get /workspaces/consent">client.workspaces.<a href="./src/contextual/resources/workspaces.py">retrieve_consent</a>() -> <a href="./src/contextual/types/workspace_retrieve_consent_response.py">WorkspaceRetrieveConsentResponse</a></code>
- <code title="put /workspaces/consent">client.workspaces.<a href="./src/contextual/resources/workspaces.py">update_consent</a>(\*\*<a href="src/contextual/types/workspace_update_consent_params.py">params</a>) -> <a href="./src/contextual/types/workspace_update_consent_response.py">WorkspaceUpdateConsentResponse</a></code>
109 changes: 108 additions & 1 deletion src/contextual/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@
)

if TYPE_CHECKING:
from .resources import parse, users, agents, lmunit, rerank, generate, datastores
from .resources import parse, users, agents, lmunit, rerank, billing, extract, generate, datastores, workspaces
from .resources.parse import ParseResource, AsyncParseResource
from .resources.users import UsersResource, AsyncUsersResource
from .resources.lmunit import LMUnitResource, AsyncLMUnitResource
from .resources.rerank import RerankResource, AsyncRerankResource
from .resources.billing import BillingResource, AsyncBillingResource
from .resources.extract import ExtractResource, AsyncExtractResource
from .resources.generate import GenerateResource, AsyncGenerateResource
from .resources.workspaces import WorkspacesResource, AsyncWorkspacesResource
from .resources.agents.agents import AgentsResource, AsyncAgentsResource
from .resources.datastores.datastores import DatastoresResource, AsyncDatastoresResource

Expand Down Expand Up @@ -157,6 +160,24 @@ def parse(self) -> ParseResource:

return ParseResource(self)

@cached_property
def extract(self) -> ExtractResource:
from .resources.extract import ExtractResource

return ExtractResource(self)

@cached_property
def billing(self) -> BillingResource:
from .resources.billing import BillingResource

return BillingResource(self)

@cached_property
def workspaces(self) -> WorkspacesResource:
from .resources.workspaces import WorkspacesResource

return WorkspacesResource(self)

@cached_property
def with_raw_response(self) -> ContextualAIWithRawResponse:
return ContextualAIWithRawResponse(self)
Expand Down Expand Up @@ -380,6 +401,24 @@ def parse(self) -> AsyncParseResource:

return AsyncParseResource(self)

@cached_property
def extract(self) -> AsyncExtractResource:
from .resources.extract import AsyncExtractResource

return AsyncExtractResource(self)

@cached_property
def billing(self) -> AsyncBillingResource:
from .resources.billing import AsyncBillingResource

return AsyncBillingResource(self)

@cached_property
def workspaces(self) -> AsyncWorkspacesResource:
from .resources.workspaces import AsyncWorkspacesResource

return AsyncWorkspacesResource(self)

@cached_property
def with_raw_response(self) -> AsyncContextualAIWithRawResponse:
return AsyncContextualAIWithRawResponse(self)
Expand Down Expand Up @@ -546,6 +585,23 @@ def parse(self) -> parse.ParseResourceWithRawResponse:

return ParseResourceWithRawResponse(self._client.parse)

@cached_property
def extract(self) -> extract.ExtractResourceWithRawResponse:
from .resources.extract import ExtractResourceWithRawResponse

return ExtractResourceWithRawResponse(self._client.extract)

@cached_property
def billing(self) -> billing.BillingResourceWithRawResponse:
from .resources.billing import BillingResourceWithRawResponse

return BillingResourceWithRawResponse(self._client.billing)

@cached_property
def workspaces(self) -> workspaces.WorkspacesResourceWithRawResponse:
from .resources.workspaces import WorkspacesResourceWithRawResponse

return WorkspacesResourceWithRawResponse(self._client.workspaces)

class AsyncContextualAIWithRawResponse:
_client: AsyncContextualAI
Expand Down Expand Up @@ -595,6 +651,23 @@ def parse(self) -> parse.AsyncParseResourceWithRawResponse:

return AsyncParseResourceWithRawResponse(self._client.parse)

@cached_property
def extract(self) -> extract.AsyncExtractResourceWithRawResponse:
from .resources.extract import AsyncExtractResourceWithRawResponse

return AsyncExtractResourceWithRawResponse(self._client.extract)

@cached_property
def billing(self) -> billing.AsyncBillingResourceWithRawResponse:
from .resources.billing import AsyncBillingResourceWithRawResponse

return AsyncBillingResourceWithRawResponse(self._client.billing)

@cached_property
def workspaces(self) -> workspaces.AsyncWorkspacesResourceWithRawResponse:
from .resources.workspaces import AsyncWorkspacesResourceWithRawResponse

return AsyncWorkspacesResourceWithRawResponse(self._client.workspaces)

class ContextualAIWithStreamedResponse:
_client: ContextualAI
Expand Down Expand Up @@ -644,6 +717,23 @@ def parse(self) -> parse.ParseResourceWithStreamingResponse:

return ParseResourceWithStreamingResponse(self._client.parse)

@cached_property
def extract(self) -> extract.ExtractResourceWithStreamingResponse:
from .resources.extract import ExtractResourceWithStreamingResponse

return ExtractResourceWithStreamingResponse(self._client.extract)

@cached_property
def billing(self) -> billing.BillingResourceWithStreamingResponse:
from .resources.billing import BillingResourceWithStreamingResponse

return BillingResourceWithStreamingResponse(self._client.billing)

@cached_property
def workspaces(self) -> workspaces.WorkspacesResourceWithStreamingResponse:
from .resources.workspaces import WorkspacesResourceWithStreamingResponse

return WorkspacesResourceWithStreamingResponse(self._client.workspaces)

class AsyncContextualAIWithStreamedResponse:
_client: AsyncContextualAI
Expand Down Expand Up @@ -693,6 +783,23 @@ def parse(self) -> parse.AsyncParseResourceWithStreamingResponse:

return AsyncParseResourceWithStreamingResponse(self._client.parse)

@cached_property
def extract(self) -> extract.AsyncExtractResourceWithStreamingResponse:
from .resources.extract import AsyncExtractResourceWithStreamingResponse

return AsyncExtractResourceWithStreamingResponse(self._client.extract)

@cached_property
def billing(self) -> billing.AsyncBillingResourceWithStreamingResponse:
from .resources.billing import AsyncBillingResourceWithStreamingResponse

return AsyncBillingResourceWithStreamingResponse(self._client.billing)

@cached_property
def workspaces(self) -> workspaces.AsyncWorkspacesResourceWithStreamingResponse:
from .resources.workspaces import AsyncWorkspacesResourceWithStreamingResponse

return AsyncWorkspacesResourceWithStreamingResponse(self._client.workspaces)

Client = ContextualAI

Expand Down
42 changes: 42 additions & 0 deletions src/contextual/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@
RerankResourceWithStreamingResponse,
AsyncRerankResourceWithStreamingResponse,
)
from .billing import (
BillingResource,
AsyncBillingResource,
BillingResourceWithRawResponse,
AsyncBillingResourceWithRawResponse,
BillingResourceWithStreamingResponse,
AsyncBillingResourceWithStreamingResponse,
)
from .extract import (
ExtractResource,
AsyncExtractResource,
ExtractResourceWithRawResponse,
AsyncExtractResourceWithRawResponse,
ExtractResourceWithStreamingResponse,
AsyncExtractResourceWithStreamingResponse,
)
from .generate import (
GenerateResource,
AsyncGenerateResource,
Expand All @@ -56,6 +72,14 @@
DatastoresResourceWithStreamingResponse,
AsyncDatastoresResourceWithStreamingResponse,
)
from .workspaces import (
WorkspacesResource,
AsyncWorkspacesResource,
WorkspacesResourceWithRawResponse,
AsyncWorkspacesResourceWithRawResponse,
WorkspacesResourceWithStreamingResponse,
AsyncWorkspacesResourceWithStreamingResponse,
)

__all__ = [
"DatastoresResource",
Expand Down Expand Up @@ -100,4 +124,22 @@
"AsyncParseResourceWithRawResponse",
"ParseResourceWithStreamingResponse",
"AsyncParseResourceWithStreamingResponse",
"ExtractResource",
"AsyncExtractResource",
"ExtractResourceWithRawResponse",
"AsyncExtractResourceWithRawResponse",
"ExtractResourceWithStreamingResponse",
"AsyncExtractResourceWithStreamingResponse",
"BillingResource",
"AsyncBillingResource",
"BillingResourceWithRawResponse",
"AsyncBillingResourceWithRawResponse",
"BillingResourceWithStreamingResponse",
"AsyncBillingResourceWithStreamingResponse",
"WorkspacesResource",
"AsyncWorkspacesResource",
"WorkspacesResourceWithRawResponse",
"AsyncWorkspacesResourceWithRawResponse",
"WorkspacesResourceWithStreamingResponse",
"AsyncWorkspacesResourceWithStreamingResponse",
]
Loading