Skip to content

Commit 24cf6cf

Browse files
release: 0.5.0-alpha.2 (#52)
Automated Release PR --- ## 0.5.0-alpha.2 (2026-02-05) Full Changelog: [v0.4.0-alpha.7...v0.5.0-alpha.2](v0.4.0-alpha.7...v0.5.0-alpha.2) ### Features * add support for tool_choice to repsponses api ([8170d7f](8170d7f)) * Adds support for the `safety_identifier` parameter ([db2ebc6](db2ebc6)) * **api:** add readonly connectors API ([c810c19](c810c19)) * convert Benchmarks API to use FastAPI router ([bcc19bb](bcc19bb)) * convert Datasets API to use FastAPI router ([a52b7ee](a52b7ee)) * Implement include parameter specifically for adding logprobs in the output message ([01f0ba8](01f0ba8)) * introduce /admin API for stack administration and operations ([2c9e2ab](2c9e2ab)) * migrate Inspect API to FastAPI router ([79f8d87](79f8d87)) * migrate Providers API to FastAPI router pattern ([22f7cf6](22f7cf6)) ### Bug Fixes * **mcp:** correct code tool API endpoint ([6006307](6006307)) * **mcp:** return correct lines on typescript errors ([368f4b5](368f4b5)) ### Chores * break long lines in snippets into multiline ([a3f9a49](a3f9a49)) * **ci:** upgrade `actions/github-script` ([8d32768](8d32768)) * clarify use of yarn for development and npm/yarn/pnpm for users ([#51](#51)) ([b413eed](b413eed)) * **internal:** codegen related update ([c12b19b](c12b19b)) * **internal:** codegen related update ([db8b76f](db8b76f)) * **internal:** codegen related update ([9d4ee0f](9d4ee0f)) * **internal:** codegen related update ([b5ea21d](b5ea21d)) * **internal:** codegen related update ([d199aff](d199aff)) * **internal:** update `actions/checkout` version ([fe86770](fe86770)) * **internal:** upgrade babel, qs, js-yaml ([d318482](d318482)) ### Documentation * add more examples ([cc58d0d](cc58d0d)) --- This pull request is managed by Stainless's [GitHub App](https://github.com/apps/stainless-app). The [semver version number](https://semver.org/#semantic-versioning-specification-semver) is based on included [commit messages](https://www.conventionalcommits.org/en/v1.0.0/). Alternatively, you can manually set the version number in the title of this pull request. For a better experience, it is recommended to use either rebase-merge or squash-merge when merging this pull request. 🔗 Stainless [website](https://www.stainlessapi.com) 📚 Read the [docs](https://app.stainlessapi.com/docs) 🙋 [Reach out](mailto:support@stainlessapi.com) for help or questions --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent b413eed commit 24cf6cf

68 files changed

Lines changed: 5035 additions & 1328 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ${{ github.repository == 'stainless-sdks/llama-stack-client-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
2020
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v6
2323

2424
- name: Set up Node
2525
uses: actions/setup-node@v4
@@ -41,7 +41,7 @@ jobs:
4141
contents: read
4242
id-token: write
4343
steps:
44-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v6
4545

4646
- name: Set up Node
4747
uses: actions/setup-node@v4
@@ -57,7 +57,7 @@ jobs:
5757
- name: Get GitHub OIDC Token
5858
if: github.repository == 'stainless-sdks/llama-stack-client-node'
5959
id: github-oidc
60-
uses: actions/github-script@v6
60+
uses: actions/github-script@v8
6161
with:
6262
script: core.setOutput('github_token', await core.getIDToken());
6363

@@ -74,7 +74,7 @@ jobs:
7474
runs-on: ${{ github.repository == 'stainless-sdks/llama-stack-client-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
7575
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
7676
steps:
77-
- uses: actions/checkout@v4
77+
- uses: actions/checkout@v6
7878

7979
- name: Set up Node
8080
uses: actions/setup-node@v4

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
if: github.repository == 'llamastack/llama-stack-client-typescript' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
1313

1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616

1717
- name: Check release environment
1818
run: |

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.4.0-alpha.7"
2+
".": "0.5.0-alpha.2"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 103
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-418ccf3126ab086a66c822c60204b95ef3192ffa64340bd3a1537ae46b830892.yml
3-
openapi_spec_hash: 885b75e847506a930b709eb630535912
4-
config_hash: 96aa17ff0395152d8d548b1d1e58b613
1+
configured_endpoints: 108
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-958e990011d6b4c27513743a151ec4c80c3103650a80027380d15f1d6b108e32.yml
3+
openapi_spec_hash: 5b49d825dbc2a26726ca752914a65114
4+
config_hash: 19b84a0a93d566334ae134dafc71991f

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
# Changelog
22

3+
## 0.5.0-alpha.2 (2026-02-05)
4+
5+
Full Changelog: [v0.4.0-alpha.7...v0.5.0-alpha.2](https://github.com/llamastack/llama-stack-client-typescript/compare/v0.4.0-alpha.7...v0.5.0-alpha.2)
6+
7+
### Features
8+
9+
* add support for tool_choice to repsponses api ([8170d7f](https://github.com/llamastack/llama-stack-client-typescript/commit/8170d7f453cdc6263fe19ddf8e6cddc097b61780))
10+
* Adds support for the `safety_identifier` parameter ([db2ebc6](https://github.com/llamastack/llama-stack-client-typescript/commit/db2ebc6f214bebe06e329bbfa6509f93dbc47b69))
11+
* **api:** add readonly connectors API ([c810c19](https://github.com/llamastack/llama-stack-client-typescript/commit/c810c19d824604b34dab48d453bf1f19ac1ff66d))
12+
* convert Benchmarks API to use FastAPI router ([bcc19bb](https://github.com/llamastack/llama-stack-client-typescript/commit/bcc19bb3640fffce18a128c042f11b695c8f7a6d))
13+
* convert Datasets API to use FastAPI router ([a52b7ee](https://github.com/llamastack/llama-stack-client-typescript/commit/a52b7ee0bd64a843134b2354e95502da2fe55f66))
14+
* Implement include parameter specifically for adding logprobs in the output message ([01f0ba8](https://github.com/llamastack/llama-stack-client-typescript/commit/01f0ba8970e6c1a729dd872cf228376fddd5f3fe))
15+
* introduce /admin API for stack administration and operations ([2c9e2ab](https://github.com/llamastack/llama-stack-client-typescript/commit/2c9e2ab11a42bb2192370880781e2faee633c17c))
16+
* migrate Inspect API to FastAPI router ([79f8d87](https://github.com/llamastack/llama-stack-client-typescript/commit/79f8d87b64a243c782c5a9eb5b62d31378781f36))
17+
* migrate Providers API to FastAPI router pattern ([22f7cf6](https://github.com/llamastack/llama-stack-client-typescript/commit/22f7cf60f463db6091bf213a630ac48bb1f12e49))
18+
19+
20+
### Bug Fixes
21+
22+
* **mcp:** correct code tool API endpoint ([6006307](https://github.com/llamastack/llama-stack-client-typescript/commit/60063077b65f31a31dabf254dbcfae50909cd692))
23+
* **mcp:** return correct lines on typescript errors ([368f4b5](https://github.com/llamastack/llama-stack-client-typescript/commit/368f4b50eb87213ab27f43a161df688d3cba4f62))
24+
25+
26+
### Chores
27+
28+
* break long lines in snippets into multiline ([a3f9a49](https://github.com/llamastack/llama-stack-client-typescript/commit/a3f9a49ec9ae6ce575a355888d0332643b314fff))
29+
* **ci:** upgrade `actions/github-script` ([8d32768](https://github.com/llamastack/llama-stack-client-typescript/commit/8d327684ea36362d0b06b297d8a7355353800298))
30+
* clarify use of yarn for development and npm/yarn/pnpm for users ([#51](https://github.com/llamastack/llama-stack-client-typescript/issues/51)) ([b413eed](https://github.com/llamastack/llama-stack-client-typescript/commit/b413eedc57a6666df5aa98af4c8726a468cb77ec))
31+
* **internal:** codegen related update ([c12b19b](https://github.com/llamastack/llama-stack-client-typescript/commit/c12b19b37e47e9982a99ea1f4ba7d0a92ff61f1f))
32+
* **internal:** codegen related update ([db8b76f](https://github.com/llamastack/llama-stack-client-typescript/commit/db8b76f2ca7761bf0b71fcf548d24e93b83014e0))
33+
* **internal:** codegen related update ([9d4ee0f](https://github.com/llamastack/llama-stack-client-typescript/commit/9d4ee0f21db979f28ac2008f37b02a70e72094ff))
34+
* **internal:** codegen related update ([b5ea21d](https://github.com/llamastack/llama-stack-client-typescript/commit/b5ea21d0dcf0a71a49420efdf721f21254b9a0ce))
35+
* **internal:** codegen related update ([d199aff](https://github.com/llamastack/llama-stack-client-typescript/commit/d199aff3d638854e58ae5575979d2c7f57eebc10))
36+
* **internal:** update `actions/checkout` version ([fe86770](https://github.com/llamastack/llama-stack-client-typescript/commit/fe867703d0446b015c6c59a62ae9e9b29161aca3))
37+
* **internal:** upgrade babel, qs, js-yaml ([d318482](https://github.com/llamastack/llama-stack-client-typescript/commit/d318482504fd85a956d3a382ba8113fedfb8416c))
38+
39+
40+
### Documentation
41+
42+
* add more examples ([cc58d0d](https://github.com/llamastack/llama-stack-client-typescript/commit/cc58d0d59eda97e5fbad6b6daea0272dcbb189cb))
43+
344
## 0.4.0-alpha.7 (2025-12-03)
445

546
Full Changelog: [v0.4.0-alpha.6...v0.4.0-alpha.7](https://github.com/llamastack/llama-stack-client-typescript/compare/v0.4.0-alpha.6...v0.4.0-alpha.7)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2025 llama-stack-client
1+
Copyright 2026 llama-stack-client
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

README.md

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,6 @@ const client = new LlamaStackClient();
3030
const models = await client.models.list();
3131
```
3232

33-
## Streaming responses
34-
35-
We provide support for streaming responses using Server Sent Events (SSE).
36-
37-
```ts
38-
import LlamaStackClient from 'llama-stack-client';
39-
40-
const client = new LlamaStackClient();
41-
42-
const stream = await client.chat.completions.create({
43-
messages: [{ content: 'string', role: 'user' }],
44-
model: 'model',
45-
stream: true,
46-
});
47-
for await (const chatCompletionChunk of stream) {
48-
console.log(chatCompletionChunk.id);
49-
}
50-
```
51-
52-
If you need to cancel a stream, you can `break` from the loop
53-
or call `stream.controller.abort()`.
54-
5533
### Request & Response types
5634

5735
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
@@ -66,9 +44,8 @@ const params: LlamaStackClient.Chat.CompletionCreateParams = {
6644
messages: [{ content: 'string', role: 'user' }],
6745
model: 'model',
6846
};
69-
const completion: LlamaStackClient.Chat.CompletionCreateResponse = await client.chat.completions.create(
70-
params,
71-
);
47+
const completion: LlamaStackClient.Chat.CompletionCreateResponse =
48+
await client.chat.completions.create(params);
7249
```
7350

7451
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -99,8 +76,14 @@ await client.files.create({ file: new File(['my bytes'], 'file'), purpose: 'assi
9976
await client.files.create({ file: await fetch('https://somesite/file'), purpose: 'assistants' });
10077

10178
// Finally, if none of the above are convenient, you can use our `toFile` helper:
102-
await client.files.create({ file: await toFile(Buffer.from('my bytes'), 'file'), purpose: 'assistants' });
103-
await client.files.create({ file: await toFile(new Uint8Array([0, 1, 2]), 'file'), purpose: 'assistants' });
79+
await client.files.create({
80+
file: await toFile(Buffer.from('my bytes'), 'file'),
81+
purpose: 'assistants',
82+
});
83+
await client.files.create({
84+
file: await toFile(new Uint8Array([0, 1, 2]), 'file'),
85+
purpose: 'assistants',
86+
});
10487
```
10588

10689
## Handling errors
@@ -179,6 +162,37 @@ On timeout, an `APIConnectionTimeoutError` is thrown.
179162

180163
Note that requests which time out will be [retried twice by default](#retries).
181164

165+
## Auto-pagination
166+
167+
List methods in the LlamaStackClient API are paginated.
168+
You can use the `for await … of` syntax to iterate through items across all pages:
169+
170+
```ts
171+
async function fetchAllResponseListResponses(params) {
172+
const allResponseListResponses = [];
173+
// Automatically fetches more pages as needed.
174+
for await (const responseListResponse of client.responses.list()) {
175+
allResponseListResponses.push(responseListResponse);
176+
}
177+
return allResponseListResponses;
178+
}
179+
```
180+
181+
Alternatively, you can request a single page at a time:
182+
183+
```ts
184+
let page = await client.responses.list();
185+
for (const responseListResponse of page.data) {
186+
console.log(responseListResponse);
187+
}
188+
189+
// Convenience methods are provided for manually paginating:
190+
while (page.hasNextPage()) {
191+
page = await page.getNextPage();
192+
// ...
193+
}
194+
```
195+
182196
## Advanced Usage
183197

184198
### Accessing raw Response data (e.g., headers)

api.md

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22

33
Types:
44

5+
- <code><a href="./src/resources/shared.ts">HealthInfo</a></code>
56
- <code><a href="./src/resources/shared.ts">InterleavedContent</a></code>
67
- <code><a href="./src/resources/shared.ts">InterleavedContentItem</a></code>
8+
- <code><a href="./src/resources/shared.ts">ListProvidersResponse</a></code>
9+
- <code><a href="./src/resources/shared.ts">ListRoutesResponse</a></code>
710
- <code><a href="./src/resources/shared.ts">ParamType</a></code>
11+
- <code><a href="./src/resources/shared.ts">ProviderInfo</a></code>
12+
- <code><a href="./src/resources/shared.ts">RouteInfo</a></code>
813
- <code><a href="./src/resources/shared.ts">SafetyViolation</a></code>
914
- <code><a href="./src/resources/shared.ts">SamplingParams</a></code>
1015
- <code><a href="./src/resources/shared.ts">ScoringResult</a></code>
1116
- <code><a href="./src/resources/shared.ts">SystemMessage</a></code>
17+
- <code><a href="./src/resources/shared.ts">VersionInfo</a></code>
1218

1319
# Toolgroups
1420

@@ -87,10 +93,10 @@ Methods:
8793

8894
- <code title="post /v1/prompts">client.prompts.<a href="./src/resources/prompts/prompts.ts">create</a>({ ...params }) -> Prompt</code>
8995
- <code title="get /v1/prompts/{prompt_id}">client.prompts.<a href="./src/resources/prompts/prompts.ts">retrieve</a>(promptId, { ...params }) -> Prompt</code>
90-
- <code title="post /v1/prompts/{prompt_id}">client.prompts.<a href="./src/resources/prompts/prompts.ts">update</a>(promptId, { ...params }) -> Prompt</code>
96+
- <code title="put /v1/prompts/{prompt_id}">client.prompts.<a href="./src/resources/prompts/prompts.ts">update</a>(promptId, { ...params }) -> Prompt</code>
9197
- <code title="get /v1/prompts">client.prompts.<a href="./src/resources/prompts/prompts.ts">list</a>() -> PromptListResponse</code>
9298
- <code title="delete /v1/prompts/{prompt_id}">client.prompts.<a href="./src/resources/prompts/prompts.ts">delete</a>(promptId) -> void</code>
93-
- <code title="post /v1/prompts/{prompt_id}/set-default-version">client.prompts.<a href="./src/resources/prompts/prompts.ts">setDefaultVersion</a>(promptId, { ...params }) -> Prompt</code>
99+
- <code title="put /v1/prompts/{prompt_id}/set-default-version">client.prompts.<a href="./src/resources/prompts/prompts.ts">setDefaultVersion</a>(promptId, { ...params }) -> Prompt</code>
94100

95101
## Versions
96102

@@ -130,13 +136,6 @@ Methods:
130136

131137
# Inspect
132138

133-
Types:
134-
135-
- <code><a href="./src/resources/inspect.ts">HealthInfo</a></code>
136-
- <code><a href="./src/resources/inspect.ts">ProviderInfo</a></code>
137-
- <code><a href="./src/resources/inspect.ts">RouteInfo</a></code>
138-
- <code><a href="./src/resources/inspect.ts">VersionInfo</a></code>
139-
140139
Methods:
141140

142141
- <code title="get /v1/health">client.inspect.<a href="./src/resources/inspect.ts">health</a>() -> HealthInfo</code>
@@ -269,7 +268,6 @@ Methods:
269268

270269
Types:
271270

272-
- <code><a href="./src/resources/providers.ts">ListProvidersResponse</a></code>
273271
- <code><a href="./src/resources/providers.ts">ProviderListResponse</a></code>
274272

275273
Methods:
@@ -281,7 +279,6 @@ Methods:
281279

282280
Types:
283281

284-
- <code><a href="./src/resources/routes.ts">ListRoutesResponse</a></code>
285282
- <code><a href="./src/resources/routes.ts">RouteListResponse</a></code>
286283

287284
Methods:
@@ -386,21 +383,12 @@ Methods:
386383

387384
# Alpha
388385

389-
## Inference
390-
391-
Types:
392-
393-
- <code><a href="./src/resources/alpha/inference.ts">InferenceRerankResponse</a></code>
394-
395-
Methods:
396-
397-
- <code title="post /v1alpha/inference/rerank">client.alpha.inference.<a href="./src/resources/alpha/inference.ts">rerank</a>({ ...params }) -> InferenceRerankResponse</code>
398-
399386
## PostTraining
400387

401388
Types:
402389

403390
- <code><a href="./src/resources/alpha/post-training/post-training.ts">AlgorithmConfig</a></code>
391+
- <code><a href="./src/resources/alpha/post-training/post-training.ts">ListPostTrainingJobsResponse</a></code>
404392
- <code><a href="./src/resources/alpha/post-training/post-training.ts">PostTrainingJob</a></code>
405393

406394
Methods:
@@ -412,17 +400,16 @@ Methods:
412400

413401
Types:
414402

415-
- <code><a href="./src/resources/alpha/post-training/job.ts">ListPostTrainingJobsResponse</a></code>
416403
- <code><a href="./src/resources/alpha/post-training/job.ts">JobListResponse</a></code>
417404
- <code><a href="./src/resources/alpha/post-training/job.ts">JobArtifactsResponse</a></code>
418405
- <code><a href="./src/resources/alpha/post-training/job.ts">JobStatusResponse</a></code>
419406

420407
Methods:
421408

422409
- <code title="get /v1alpha/post-training/jobs">client.alpha.postTraining.job.<a href="./src/resources/alpha/post-training/job.ts">list</a>() -> JobListResponse</code>
423-
- <code title="get /v1alpha/post-training/job/artifacts">client.alpha.postTraining.job.<a href="./src/resources/alpha/post-training/job.ts">artifacts</a>({ ...params }) -> JobArtifactsResponse</code>
424-
- <code title="post /v1alpha/post-training/job/cancel">client.alpha.postTraining.job.<a href="./src/resources/alpha/post-training/job.ts">cancel</a>({ ...params }) -> void</code>
425-
- <code title="get /v1alpha/post-training/job/status">client.alpha.postTraining.job.<a href="./src/resources/alpha/post-training/job.ts">status</a>({ ...params }) -> JobStatusResponse</code>
410+
- <code title="get /v1alpha/post-training/job/artifacts">client.alpha.postTraining.job.<a href="./src/resources/alpha/post-training/job.ts">artifacts</a>() -> JobArtifactsResponse</code>
411+
- <code title="post /v1alpha/post-training/job/cancel">client.alpha.postTraining.job.<a href="./src/resources/alpha/post-training/job.ts">cancel</a>() -> void</code>
412+
- <code title="get /v1alpha/post-training/job/status">client.alpha.postTraining.job.<a href="./src/resources/alpha/post-training/job.ts">status</a>() -> JobStatusResponse</code>
426413

427414
## Benchmarks
428415

@@ -462,6 +449,26 @@ Methods:
462449
- <code title="delete /v1alpha/eval/benchmarks/{benchmark_id}/jobs/{job_id}">client.alpha.eval.jobs.<a href="./src/resources/alpha/eval/jobs.ts">cancel</a>(benchmarkId, jobId) -> void</code>
463450
- <code title="get /v1alpha/eval/benchmarks/{benchmark_id}/jobs/{job_id}">client.alpha.eval.jobs.<a href="./src/resources/alpha/eval/jobs.ts">status</a>(benchmarkId, jobId) -> Job</code>
464451

452+
## Admin
453+
454+
Methods:
455+
456+
- <code title="get /v1alpha/admin/health">client.alpha.admin.<a href="./src/resources/alpha/admin.ts">health</a>() -> HealthInfo</code>
457+
- <code title="get /v1alpha/admin/providers/{provider_id}">client.alpha.admin.<a href="./src/resources/alpha/admin.ts">inspectProvider</a>(providerId) -> ProviderInfo</code>
458+
- <code title="get /v1alpha/admin/providers">client.alpha.admin.<a href="./src/resources/alpha/admin.ts">listProviders</a>() -> ProviderListResponse</code>
459+
- <code title="get /v1alpha/admin/inspect/routes">client.alpha.admin.<a href="./src/resources/alpha/admin.ts">listRoutes</a>({ ...params }) -> RouteListResponse</code>
460+
- <code title="get /v1alpha/admin/version">client.alpha.admin.<a href="./src/resources/alpha/admin.ts">version</a>() -> VersionInfo</code>
461+
462+
## Inference
463+
464+
Types:
465+
466+
- <code><a href="./src/resources/alpha/inference.ts">InferenceRerankResponse</a></code>
467+
468+
Methods:
469+
470+
- <code title="post /v1alpha/inference/rerank">client.alpha.inference.<a href="./src/resources/alpha/inference.ts">rerank</a>({ ...params }) -> InferenceRerankResponse</code>
471+
465472
# Beta
466473

467474
## Datasets

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "llama-stack-client",
3-
"version": "0.4.0-alpha.7",
3+
"version": "0.5.0-alpha.2",
44
"description": "The official TypeScript library for the Llama Stack Client API",
55
"author": "Llama Stack Client <llamastack@meta.com>",
66
"types": "dist/index.d.ts",

src/core.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
9090
const mediaType = contentType?.split(';')[0]?.trim();
9191
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
9292
if (isJSON) {
93+
const contentLength = response.headers.get('content-length');
94+
if (contentLength === '0') {
95+
// if there is no content we can't do anything
96+
return undefined as T;
97+
}
98+
9399
const json = await response.json();
94100

95101
debug('response', response.status, response.url, response.headers, json);

0 commit comments

Comments
 (0)