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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.0.1-alpha.1"
".": "0.1.0-alpha.1"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 12
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/taam-cloud%2Ftaam-cloud-05d424fe16b4eefcbfc7aa4aa054838d9b780adabd107eabb3c1270a3ff2376a.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/taam-cloud%2Ftaam-cloud-7277b9a88c7f7703fef58dbba2051bf4dd5d89eaad6b93768ad7114ff1567948.yml
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.1.0-alpha.1 (2025-01-24)

Full Changelog: [v0.0.1-alpha.1...v0.1.0-alpha.1](https://github.com/taamsoftadmin/taam-cloud-python-sdk/compare/v0.0.1-alpha.1...v0.1.0-alpha.1)

### Features

* **api:** update via SDK Studio ([#5](https://github.com/taamsoftadmin/taam-cloud-python-sdk/issues/5)) ([5bd0793](https://github.com/taamsoftadmin/taam-cloud-python-sdk/commit/5bd0793db5e509483b24318b8045caa05d60432b))

## 0.0.1-alpha.1 (2025-01-23)

Full Changelog: [v0.0.1-alpha.0...v0.0.1-alpha.1](https://github.com/taamsoftadmin/taam-cloud-python-sdk/compare/v0.0.1-alpha.0...v0.0.1-alpha.1)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ client = TaamCloud(
environment="environment_1",
)

embedding = client.embeddings.create(
embeddings_response = client.embeddings.create(
input=["string"],
model="jina-embeddings-v3",
)
Expand Down Expand Up @@ -64,7 +64,7 @@ client = AsyncTaamCloud(


async def main() -> None:
embedding = await client.embeddings.create(
embeddings_response = await client.embeddings.create(
input=["string"],
model="jina-embeddings-v3",
)
Expand Down
28 changes: 14 additions & 14 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# TaamCloud

Types:

```python
from taam_cloud.types import UploadResponse
```

Methods:

- <code title="post /upload">client.<a href="./src/taam_cloud/_client.py">upload</a>(\*\*<a href="src/taam_cloud/types/client_upload_params.py">params</a>) -> <a href="./src/taam_cloud/types/upload_response.py">UploadResponse</a></code>

# Embeddings

Types:

```python
from taam_cloud.types import EmbeddingCreateResponse
from taam_cloud.types import EmbeddingsResponse
```

Methods:

- <code title="post /v1/embeddings">client.embeddings.<a href="./src/taam_cloud/resources/embeddings.py">create</a>(\*\*<a href="src/taam_cloud/types/embedding_create_params.py">params</a>) -> <a href="./src/taam_cloud/types/embedding_create_response.py">object</a></code>
- <code title="post /v1/embeddings">client.embeddings.<a href="./src/taam_cloud/resources/embeddings.py">create</a>(\*\*<a href="src/taam_cloud/types/embedding_create_params.py">params</a>) -> <a href="./src/taam_cloud/types/embeddings_response.py">object</a></code>

# Rerank

Expand Down Expand Up @@ -58,18 +70,6 @@ Methods:

- <code title="post /v1/images/generations">client.images.generations.<a href="./src/taam_cloud/resources/images/generations.py">create</a>(\*\*<a href="src/taam_cloud/types/images/generation_create_params.py">params</a>) -> <a href="./src/taam_cloud/types/images/image_generation_response.py">ImageGenerationResponse</a></code>

# Files

Types:

```python
from taam_cloud.types import FileUploadResponse
```

Methods:

- <code title="post /upload">client.files.<a href="./src/taam_cloud/resources/files.py">upload</a>(\*\*<a href="src/taam_cloud/types/file_upload_params.py">params</a>) -> <a href="./src/taam_cloud/types/file_upload_response.py">FileUploadResponse</a></code>

# Crawl

Types:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "taam_cloud"
version = "0.0.1-alpha.1"
version = "0.1.0-alpha.1"
description = "The official Python library for the taam-cloud API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
157 changes: 148 additions & 9 deletions src/taam_cloud/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,48 @@

from . import _exceptions
from ._qs import Querystring
from .types import client_upload_params
from ._types import (
NOT_GIVEN,
Body,
Omit,
Query,
Headers,
Timeout,
NotGiven,
FileTypes,
Transport,
ProxiesTypes,
RequestOptions,
)
from ._utils import (
is_given,
extract_files,
maybe_transform,
deepcopy_minimal,
get_async_library,
async_maybe_transform,
)
from ._version import __version__
from .resources import maps, crawl, files, models, rerank, scrape, searches, embeddings
from ._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from .resources import maps, crawl, models, rerank, scrape, searches, embeddings
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
from ._exceptions import APIStatusError, TaamCloudError
from ._base_client import (
DEFAULT_MAX_RETRIES,
SyncAPIClient,
AsyncAPIClient,
make_request_options,
)
from .resources.chat import chat
from .resources.suno import suno
from .resources.images import images
from .types.upload_response import UploadResponse

__all__ = [
"ENVIRONMENTS",
Expand Down Expand Up @@ -63,7 +80,6 @@ class TaamCloud(SyncAPIClient):
suno: suno.SunoResource
models: models.ModelsResource
images: images.ImagesResource
files: files.FilesResource
crawl: crawl.CrawlResource
scrape: scrape.ScrapeResource
maps: maps.MapsResource
Expand Down Expand Up @@ -155,7 +171,6 @@ def __init__(
self.suno = suno.SunoResource(self)
self.models = models.ModelsResource(self)
self.images = images.ImagesResource(self)
self.files = files.FilesResource(self)
self.crawl = crawl.CrawlResource(self)
self.scrape = scrape.ScrapeResource(self)
self.maps = maps.MapsResource(self)
Expand Down Expand Up @@ -236,6 +251,63 @@ def copy(
# client.with_options(timeout=10).foo.create(...)
with_options = copy

def upload(
self,
*,
file: FileTypes,
enable_ocr: bool | NotGiven = NOT_GIVEN,
enable_vision: bool | NotGiven = NOT_GIVEN,
save_all: bool | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UploadResponse:
"""
Upload and process files with optional OCR and Vision capabilities

Args:
file: File to upload

enable_ocr: Enable OCR processing

enable_vision: Enable Vision processing

save_all: Save raw files

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
body = deepcopy_minimal(
{
"file": file,
"enable_ocr": enable_ocr,
"enable_vision": enable_vision,
"save_all": save_all,
}
)
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
# It should be noted that the actual Content-Type header that will be
# sent to the server will contain a `boundary` parameter, e.g.
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Content-Type header is being set before file boundary parameter, which could allow header injection attacks. The header should be set by the multipart encoder instead.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
extra_headers = extra_headers or {}

return self.post(
"/upload",
body=maybe_transform(body, client_upload_params.ClientUploadParams),
files=files,
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=UploadResponse,
)

@override
def _make_status_error(
self,
Expand Down Expand Up @@ -277,7 +349,6 @@ class AsyncTaamCloud(AsyncAPIClient):
suno: suno.AsyncSunoResource
models: models.AsyncModelsResource
images: images.AsyncImagesResource
files: files.AsyncFilesResource
crawl: crawl.AsyncCrawlResource
scrape: scrape.AsyncScrapeResource
maps: maps.AsyncMapsResource
Expand Down Expand Up @@ -369,7 +440,6 @@ def __init__(
self.suno = suno.AsyncSunoResource(self)
self.models = models.AsyncModelsResource(self)
self.images = images.AsyncImagesResource(self)
self.files = files.AsyncFilesResource(self)
self.crawl = crawl.AsyncCrawlResource(self)
self.scrape = scrape.AsyncScrapeResource(self)
self.maps = maps.AsyncMapsResource(self)
Expand Down Expand Up @@ -450,6 +520,63 @@ def copy(
# client.with_options(timeout=10).foo.create(...)
with_options = copy

async def upload(
self,
*,
file: FileTypes,
enable_ocr: bool | NotGiven = NOT_GIVEN,
enable_vision: bool | NotGiven = NOT_GIVEN,
save_all: bool | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UploadResponse:
"""
Upload and process files with optional OCR and Vision capabilities

Args:
file: File to upload

enable_ocr: Enable OCR processing

enable_vision: Enable Vision processing

save_all: Save raw files

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
body = deepcopy_minimal(
{
"file": file,
"enable_ocr": enable_ocr,
"enable_vision": enable_vision,
"save_all": save_all,
}
)
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
# It should be noted that the actual Content-Type header that will be
# sent to the server will contain a `boundary` parameter, e.g.
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
return await self.post(
"/upload",
body=await async_maybe_transform(body, client_upload_params.ClientUploadParams),
files=files,
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=UploadResponse,
)

@override
def _make_status_error(
self,
Expand Down Expand Up @@ -492,12 +619,15 @@ def __init__(self, client: TaamCloud) -> None:
self.suno = suno.SunoResourceWithRawResponse(client.suno)
self.models = models.ModelsResourceWithRawResponse(client.models)
self.images = images.ImagesResourceWithRawResponse(client.images)
self.files = files.FilesResourceWithRawResponse(client.files)
self.crawl = crawl.CrawlResourceWithRawResponse(client.crawl)
self.scrape = scrape.ScrapeResourceWithRawResponse(client.scrape)
self.maps = maps.MapsResourceWithRawResponse(client.maps)
self.searches = searches.SearchesResourceWithRawResponse(client.searches)

self.upload = to_raw_response_wrapper(
client.upload,
)


class AsyncTaamCloudWithRawResponse:
def __init__(self, client: AsyncTaamCloud) -> None:
Expand All @@ -507,12 +637,15 @@ def __init__(self, client: AsyncTaamCloud) -> None:
self.suno = suno.AsyncSunoResourceWithRawResponse(client.suno)
self.models = models.AsyncModelsResourceWithRawResponse(client.models)
self.images = images.AsyncImagesResourceWithRawResponse(client.images)
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
self.crawl = crawl.AsyncCrawlResourceWithRawResponse(client.crawl)
self.scrape = scrape.AsyncScrapeResourceWithRawResponse(client.scrape)
self.maps = maps.AsyncMapsResourceWithRawResponse(client.maps)
self.searches = searches.AsyncSearchesResourceWithRawResponse(client.searches)

self.upload = async_to_raw_response_wrapper(
client.upload,
)


class TaamCloudWithStreamedResponse:
def __init__(self, client: TaamCloud) -> None:
Expand All @@ -522,12 +655,15 @@ def __init__(self, client: TaamCloud) -> None:
self.suno = suno.SunoResourceWithStreamingResponse(client.suno)
self.models = models.ModelsResourceWithStreamingResponse(client.models)
self.images = images.ImagesResourceWithStreamingResponse(client.images)
self.files = files.FilesResourceWithStreamingResponse(client.files)
self.crawl = crawl.CrawlResourceWithStreamingResponse(client.crawl)
self.scrape = scrape.ScrapeResourceWithStreamingResponse(client.scrape)
self.maps = maps.MapsResourceWithStreamingResponse(client.maps)
self.searches = searches.SearchesResourceWithStreamingResponse(client.searches)

self.upload = to_streamed_response_wrapper(
client.upload,
)


class AsyncTaamCloudWithStreamedResponse:
def __init__(self, client: AsyncTaamCloud) -> None:
Expand All @@ -537,12 +673,15 @@ def __init__(self, client: AsyncTaamCloud) -> None:
self.suno = suno.AsyncSunoResourceWithStreamingResponse(client.suno)
self.models = models.AsyncModelsResourceWithStreamingResponse(client.models)
self.images = images.AsyncImagesResourceWithStreamingResponse(client.images)
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
self.crawl = crawl.AsyncCrawlResourceWithStreamingResponse(client.crawl)
self.scrape = scrape.AsyncScrapeResourceWithStreamingResponse(client.scrape)
self.maps = maps.AsyncMapsResourceWithStreamingResponse(client.maps)
self.searches = searches.AsyncSearchesResourceWithStreamingResponse(client.searches)

self.upload = async_to_streamed_response_wrapper(
client.upload,
)


Client = TaamCloud

Expand Down
2 changes: 1 addition & 1 deletion src/taam_cloud/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "taam_cloud"
__version__ = "0.0.1-alpha.1" # x-release-please-version
__version__ = "0.1.0-alpha.1" # x-release-please-version
Loading
Loading