Skip to content
This repository was archived by the owner on Aug 14, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
e6a964e
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
eee6f0b
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
072269f
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
590de6d
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
8a1efad
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jul 25, 2025
5d6ccb5
chore(internal): codegen related update
stainless-app[bot] Jun 30, 2025
4368fbd
fix(ci): correct conditional
stainless-app[bot] Jul 25, 2025
5febc13
chore(ci): change upload type
stainless-app[bot] Jul 2, 2025
aa45ba3
chore(internal): codegen related update
stainless-app[bot] Jul 8, 2025
0568d6d
chore(internal): bump pinned h11 dep
stainless-app[bot] Jul 9, 2025
d1a4e40
chore(package): mark python 3.13 as supported
stainless-app[bot] Jul 9, 2025
8b7e9ba
fix(parsing): correctly handle nested discriminated unions
stainless-app[bot] Jul 10, 2025
193fb64
chore(readme): fix version rendering on pypi
stainless-app[bot] Jul 28, 2025
c6e0026
fix(client): don't send Content-Type header on GET requests
stainless-app[bot] Jul 28, 2025
a93aea1
codegen metadata
stainless-app[bot] Jul 15, 2025
c27a701
chore(internal): codegen related update
stainless-app[bot] Jul 16, 2025
0a8544e
codegen metadata
stainless-app[bot] Jul 16, 2025
264f24c
fix(parsing): ignore empty metadata
stainless-app[bot] Jul 22, 2025
d54c5db
fix(parsing): parse extra field types
stainless-app[bot] Jul 23, 2025
a201e22
feat(api): update via SDK Studio
stainless-app[bot] Jul 25, 2025
ac4614a
feat(api): update via SDK Studio
stainless-app[bot] Jul 25, 2025
1dd3e53
chore(project): add settings file for vscode
stainless-app[bot] Jul 25, 2025
4a54d61
feat(api): update via SDK Studio
stainless-app[bot] Jul 28, 2025
25c1e49
feat(api): update via SDK Studio
stainless-app[bot] Jul 28, 2025
59b933c
chore: update SDK settings
stainless-app[bot] Jul 28, 2025
aef5dee
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
c32029b
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
16f2953
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
02c9953
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
3f0a4b9
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jul 25, 2025
13cfa4a
feat(api): update via SDK Studio
stainless-app[bot] Jul 28, 2025
3aeb5ba
codegen metadata
stainless-app[bot] Jul 28, 2025
489b54d
feat(api): update via SDK Studio
stainless-app[bot] Jul 28, 2025
e97f870
feat(api): update via SDK Studio
stainless-app[bot] Jul 28, 2025
6114dbf
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
9746774
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
ce98414
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
d59862a
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
8b37cd3
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jul 25, 2025
74f7eda
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
96768dc
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
e6ae920
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
4132af9
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
4da7f49
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jul 25, 2025
6c73da7
feat(client): support file upload requests
stainless-app[bot] Jul 31, 2025
b6fa2b1
feat(api): update via SDK Studio
stainless-app[bot] Jul 31, 2025
748e6db
feat(api): update via SDK Studio
stainless-app[bot] Aug 1, 2025
80a2969
feat(api): update via SDK Studio
stainless-app[bot] Aug 1, 2025
4c7c077
codegen metadata
stainless-app[bot] Aug 4, 2025
62901e7
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
607c7be
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
39155e5
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
9a4320d
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
9d04993
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jul 25, 2025
3165cad
chore(internal): codegen related update
stainless-app[bot] Jun 30, 2025
d7c2ab8
fix(ci): correct conditional
stainless-app[bot] Jul 25, 2025
7827103
chore(ci): change upload type
stainless-app[bot] Jul 2, 2025
7cd543f
chore(internal): codegen related update
stainless-app[bot] Jul 8, 2025
4a7073f
chore(internal): bump pinned h11 dep
stainless-app[bot] Jul 9, 2025
2afc17b
chore(package): mark python 3.13 as supported
stainless-app[bot] Jul 9, 2025
9f95130
fix(parsing): correctly handle nested discriminated unions
stainless-app[bot] Jul 10, 2025
ca89c7f
chore(readme): fix version rendering on pypi
stainless-app[bot] Jul 28, 2025
d6a80a5
fix(client): don't send Content-Type header on GET requests
stainless-app[bot] Jul 28, 2025
64e9b91
codegen metadata
stainless-app[bot] Jul 15, 2025
4d4afec
chore(internal): codegen related update
stainless-app[bot] Jul 16, 2025
8599d25
codegen metadata
stainless-app[bot] Jul 16, 2025
a8a398f
fix(parsing): ignore empty metadata
stainless-app[bot] Jul 22, 2025
f981bdc
fix(parsing): parse extra field types
stainless-app[bot] Jul 23, 2025
dd0ae96
feat(api): update via SDK Studio
stainless-app[bot] Jul 25, 2025
3dbf2a4
feat(api): update via SDK Studio
stainless-app[bot] Jul 25, 2025
405febd
chore(project): add settings file for vscode
stainless-app[bot] Jul 25, 2025
6d609e3
feat(api): update via SDK Studio
stainless-app[bot] Jul 28, 2025
585f9ce
feat(api): update via SDK Studio
stainless-app[bot] Jul 28, 2025
2d422f9
chore: update SDK settings
stainless-app[bot] Jul 28, 2025
b2875ec
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
443ce02
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
3727fa5
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
da26ed0
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
87c9d01
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jul 25, 2025
07691ac
feat(api): update via SDK Studio
stainless-app[bot] Jul 28, 2025
81ee747
codegen metadata
stainless-app[bot] Jul 28, 2025
2a4296d
feat(api): update via SDK Studio
stainless-app[bot] Jul 28, 2025
f6b80ca
feat(api): update via SDK Studio
stainless-app[bot] Jul 28, 2025
2e1a629
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
f52cb89
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
8f15ef0
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
cc7a519
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
c05df66
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jul 25, 2025
5d6cc6b
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
86a0766
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
148be8d
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
5af7869
chore(internal): version bump
stainless-app[bot] Jul 15, 2025
03a7636
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jul 25, 2025
e84459f
feat(client): support file upload requests
stainless-app[bot] Jul 31, 2025
a34c823
feat(api): update via SDK Studio
stainless-app[bot] Jul 31, 2025
54ff3c4
feat(api): update via SDK Studio
stainless-app[bot] Aug 1, 2025
6e26309
feat(api): update via SDK Studio
stainless-app[bot] Aug 1, 2025
8be3c73
codegen metadata
stainless-app[bot] Aug 4, 2025
e5a1303
Merge remote-tracking branch 'origin/next' into next
stainless-app[bot] Aug 5, 2025
1f6b902
Merge remote-tracking branch 'origin/main' into next
stainless-app[bot] Aug 6, 2025
c50a0e0
chore(internal): fix ruff target version
stainless-app[bot] Aug 6, 2025
a6ec40e
Merge remote-tracking branch 'origin/main' into next
stainless-app[bot] Aug 6, 2025
5f90b04
feat(api): update via SDK Studio
stainless-app[bot] Aug 6, 2025
7a6b5de
Merge remote-tracking branch 'origin/main' into next
stainless-app[bot] Aug 6, 2025
9c69353
feat(api): update via SDK Studio
stainless-app[bot] Aug 6, 2025
5035f20
release: 0.2.17
stainless-app[bot] Aug 6, 2025
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
96 changes: 96 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: CI
on:
push:
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/llama-stack-client-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Install dependencies
run: rye sync --all-features

- name: Run lints
run: ./scripts/lint

build:
if: github.repository == 'stainless-sdks/llama-stack-client-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: depot-ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Install dependencies
run: rye sync --all-features

- name: Run build
run: rye build

- name: Get GitHub OIDC Token
id: github-oidc
uses: actions/github-script@v6
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Upload tarball
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
run: ./scripts/utils/upload-artifact.sh

test:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/llama-stack-client-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Bootstrap
run: ./scripts/bootstrap

- name: Run tests
run: ./scripts/test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.prism.log
.vscode
_dev

__pycache__
Expand Down
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.1.0-alpha.4"
".": "0.2.17"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 105
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-df7a19394e9124c18ec4e888e2856d22b5ebfd6fe6fe6e929ff6cfadb2ae7e2a.yml
openapi_spec_hash: 9428682672fdd7e2afee7af9ef849dc9
config_hash: e1d37a77a6e8ca86fb6bccb4b0f172c9
configured_endpoints: 106
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f59f1c7d33001d60b5190f68aa49eacec90f05dbe694620b8916152c3922051d.yml
openapi_spec_hash: 804edd2e834493906dc430145402be3b
config_hash: de16e52db65de71ac35adcdb665a74f5
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.analysis.importFormat": "relative",
}
124 changes: 124 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Llama Stack Client Python API library


[![PyPI version](https://img.shields.io/pypi/v/llama_stack_client.svg)](https://pypi.org/project/llama_stack_client/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/llama-stack-client)](https://pypi.org/project/llama-stack-client/)
[![Discord](https://img.shields.io/discord/1257833999603335178)](https://discord.gg/llama-stack)

Expand Down
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,18 @@ Methods:

- <code title="get /v1/inspect/routes">client.routes.<a href="./src/llama_stack_client/resources/routes.py">list</a>() -> <a href="./src/llama_stack_client/types/route_list_response.py">RouteListResponse</a></code>

# Moderations

Types:

```python
from llama_stack_client.types import CreateResponse
```

Methods:

- <code title="post /v1/openai/v1/moderations">client.moderations.<a href="./src/llama_stack_client/resources/moderations.py">create</a>(\*\*<a href="src/llama_stack_client/types/moderation_create_params.py">params</a>) -> <a href="./src/llama_stack_client/types/create_response.py">CreateResponse</a></code>

# Safety

Types:
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "llama_stack_client"
version = "0.2.17"
description = "The official Python library for the llama-stack-client API"
dynamic = ["readme"]
license = "Apache-2.0"
license = "MIT"
authors = [{ name = "Meta Llama", email = "[email protected]" }]
dependencies = [
"httpx>=0.23.0, <1",
Expand All @@ -27,13 +27,14 @@ classifiers = [
"Typing :: Typed",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: Apache Software License"
"License :: OSI Approved :: MIT License"
]

[dependency-groups]
Expand All @@ -52,8 +53,6 @@ dev = [
Homepage = "https://github.com/llamastack/llama-stack-client-python"
Repository = "https://github.com/llamastack/llama-stack-client-python"



[build-system]
requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"
Expand Down
6 changes: 3 additions & 3 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ filelock==3.12.4
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.14.0
h11==0.16.0
# via httpcore
httpcore==1.0.2
httpcore==1.0.9
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via llama-stack-client
# via respx
httpx-aiohttp==0.1.6
httpx-aiohttp==0.1.8
# via llama-stack-client
idna==3.4
# via anyio
Expand Down
6 changes: 3 additions & 3 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ exceptiongroup==1.2.2
frozenlist==1.6.2
# via aiohttp
# via aiosignal
h11==0.14.0
h11==0.16.0
# via httpcore
httpcore==1.0.2
httpcore==1.0.9
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via llama-stack-client
httpx-aiohttp==0.1.6
httpx-aiohttp==0.1.8
# via llama-stack-client
idna==3.4
# via anyio
Expand Down
12 changes: 7 additions & 5 deletions scripts/utils/upload-artifact.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
set -exuo pipefail

RESPONSE=$(curl -X POST "$URL" \
FILENAME=$(basename dist/*.whl)

RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \
-H "Authorization: Bearer $AUTH" \
-H "Content-Type: application/json")

Expand All @@ -12,13 +14,13 @@ if [[ "$SIGNED_URL" == "null" ]]; then
exit 1
fi

UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \
-H "Content-Type: application/gzip" \
--data-binary @- "$SIGNED_URL" 2>&1)
UPLOAD_RESPONSE=$(curl -v -X PUT \
-H "Content-Type: binary/octet-stream" \
--data-binary "@dist/$FILENAME" "$SIGNED_URL" 2>&1)

if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
echo -e "\033[32mInstallation: pip install --pre 'https://pkg.stainless.com/s/llama-stack-client-python/$SHA'\033[0m"
echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/llama-stack-client-python/$SHA/$FILENAME'\033[0m"
else
echo -e "\033[31mFailed to upload artifact.\033[0m"
exit 1
Expand Down
14 changes: 12 additions & 2 deletions src/llama_stack_client/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,18 @@ def _build_request(
# work around https://github.com/encode/httpx/discussions/2880
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}

is_body_allowed = options.method.lower() != "get"

if is_body_allowed:
if isinstance(json_data, bytes):
kwargs["content"] = json_data
else:
kwargs["json"] = json_data if is_given(json_data) else None
kwargs["files"] = files
else:
headers.pop("Content-Type", None)
kwargs.pop("data", None)

# TODO: report this error to httpx
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
headers=headers,
Expand All @@ -540,8 +552,6 @@ def _build_request(
# so that passing a `TypedDict` doesn't cause an error.
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
json=json_data if is_given(json_data) else None,
files=files,
**kwargs,
)

Expand Down
9 changes: 9 additions & 0 deletions src/llama_stack_client/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
toolgroups,
vector_dbs,
completions,
moderations,
scoring_functions,
synthetic_data_generation,
)
Expand Down Expand Up @@ -91,6 +92,7 @@ class LlamaStackClient(SyncAPIClient):
post_training: post_training.PostTrainingResource
providers: providers.ProvidersResource
routes: routes.RoutesResource
moderations: moderations.ModerationsResource
safety: safety.SafetyResource
shields: shields.ShieldsResource
synthetic_data_generation: synthetic_data_generation.SyntheticDataGenerationResource
Expand Down Expand Up @@ -177,6 +179,7 @@ def __init__(
self.post_training = post_training.PostTrainingResource(self)
self.providers = providers.ProvidersResource(self)
self.routes = routes.RoutesResource(self)
self.moderations = moderations.ModerationsResource(self)
self.safety = safety.SafetyResource(self)
self.shields = shields.ShieldsResource(self)
self.synthetic_data_generation = synthetic_data_generation.SyntheticDataGenerationResource(self)
Expand Down Expand Up @@ -315,6 +318,7 @@ class AsyncLlamaStackClient(AsyncAPIClient):
post_training: post_training.AsyncPostTrainingResource
providers: providers.AsyncProvidersResource
routes: routes.AsyncRoutesResource
moderations: moderations.AsyncModerationsResource
safety: safety.AsyncSafetyResource
shields: shields.AsyncShieldsResource
synthetic_data_generation: synthetic_data_generation.AsyncSyntheticDataGenerationResource
Expand Down Expand Up @@ -401,6 +405,7 @@ def __init__(
self.post_training = post_training.AsyncPostTrainingResource(self)
self.providers = providers.AsyncProvidersResource(self)
self.routes = routes.AsyncRoutesResource(self)
self.moderations = moderations.AsyncModerationsResource(self)
self.safety = safety.AsyncSafetyResource(self)
self.shields = shields.AsyncShieldsResource(self)
self.synthetic_data_generation = synthetic_data_generation.AsyncSyntheticDataGenerationResource(self)
Expand Down Expand Up @@ -540,6 +545,7 @@ def __init__(self, client: LlamaStackClient) -> None:
self.post_training = post_training.PostTrainingResourceWithRawResponse(client.post_training)
self.providers = providers.ProvidersResourceWithRawResponse(client.providers)
self.routes = routes.RoutesResourceWithRawResponse(client.routes)
self.moderations = moderations.ModerationsResourceWithRawResponse(client.moderations)
self.safety = safety.SafetyResourceWithRawResponse(client.safety)
self.shields = shields.ShieldsResourceWithRawResponse(client.shields)
self.synthetic_data_generation = synthetic_data_generation.SyntheticDataGenerationResourceWithRawResponse(
Expand Down Expand Up @@ -573,6 +579,7 @@ def __init__(self, client: AsyncLlamaStackClient) -> None:
self.post_training = post_training.AsyncPostTrainingResourceWithRawResponse(client.post_training)
self.providers = providers.AsyncProvidersResourceWithRawResponse(client.providers)
self.routes = routes.AsyncRoutesResourceWithRawResponse(client.routes)
self.moderations = moderations.AsyncModerationsResourceWithRawResponse(client.moderations)
self.safety = safety.AsyncSafetyResourceWithRawResponse(client.safety)
self.shields = shields.AsyncShieldsResourceWithRawResponse(client.shields)
self.synthetic_data_generation = synthetic_data_generation.AsyncSyntheticDataGenerationResourceWithRawResponse(
Expand Down Expand Up @@ -608,6 +615,7 @@ def __init__(self, client: LlamaStackClient) -> None:
self.post_training = post_training.PostTrainingResourceWithStreamingResponse(client.post_training)
self.providers = providers.ProvidersResourceWithStreamingResponse(client.providers)
self.routes = routes.RoutesResourceWithStreamingResponse(client.routes)
self.moderations = moderations.ModerationsResourceWithStreamingResponse(client.moderations)
self.safety = safety.SafetyResourceWithStreamingResponse(client.safety)
self.shields = shields.ShieldsResourceWithStreamingResponse(client.shields)
self.synthetic_data_generation = synthetic_data_generation.SyntheticDataGenerationResourceWithStreamingResponse(
Expand Down Expand Up @@ -643,6 +651,7 @@ def __init__(self, client: AsyncLlamaStackClient) -> None:
self.post_training = post_training.AsyncPostTrainingResourceWithStreamingResponse(client.post_training)
self.providers = providers.AsyncProvidersResourceWithStreamingResponse(client.providers)
self.routes = routes.AsyncRoutesResourceWithStreamingResponse(client.routes)
self.moderations = moderations.AsyncModerationsResourceWithStreamingResponse(client.moderations)
self.safety = safety.AsyncSafetyResourceWithStreamingResponse(client.safety)
self.shields = shields.AsyncShieldsResourceWithStreamingResponse(client.shields)
self.synthetic_data_generation = (
Expand Down
8 changes: 4 additions & 4 deletions src/llama_stack_client/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes:
return file

if is_tuple_t(file):
return (file[0], _read_file_content(file[1]), *file[2:])
return (file[0], read_file_content(file[1]), *file[2:])

raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")


def _read_file_content(file: FileContent) -> HttpxFileContent:
def read_file_content(file: FileContent) -> HttpxFileContent:
if isinstance(file, os.PathLike):
return pathlib.Path(file).read_bytes()
return file
Expand Down Expand Up @@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
return file

if is_tuple_t(file):
return (file[0], await _async_read_file_content(file[1]), *file[2:])
return (file[0], await async_read_file_content(file[1]), *file[2:])

raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")


async def _async_read_file_content(file: FileContent) -> HttpxFileContent:
async def async_read_file_content(file: FileContent) -> HttpxFileContent:
if isinstance(file, os.PathLike):
return await anyio.Path(file).read_bytes()

Expand Down
Loading
Loading