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
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.4.0-alpha.7"
".": "0.4.0-alpha.8"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-418ccf3126ab086a66c822c60204b95ef3192ffa64340bd3a1537ae46b830892.yml
openapi_spec_hash: 885b75e847506a930b709eb630535912
config_hash: 96aa17ff0395152d8d548b1d1e58b613
configured_endpoints: 108
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-faa8aea30f68f4757456ffabbaa687cace33f1dc3b3eba9cb074ca4500a6fa43.yml
openapi_spec_hash: 8cea736f660e8842c3a2580469d331aa
config_hash: aa28e451064c13a38ddc44df99ebf52a
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# Changelog

## 0.4.0-alpha.8 (2025-12-24)

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

### Features

* add support for tool_choice to repsponses api ([8170d7f](https://github.com/llamastack/llama-stack-client-typescript/commit/8170d7f453cdc6263fe19ddf8e6cddc097b61780))
* **api:** add readonly connectors API ([c810c19](https://github.com/llamastack/llama-stack-client-typescript/commit/c810c19d824604b34dab48d453bf1f19ac1ff66d))
* convert Benchmarks API to use FastAPI router ([bcc19bb](https://github.com/llamastack/llama-stack-client-typescript/commit/bcc19bb3640fffce18a128c042f11b695c8f7a6d))
* convert Datasets API to use FastAPI router ([a52b7ee](https://github.com/llamastack/llama-stack-client-typescript/commit/a52b7ee0bd64a843134b2354e95502da2fe55f66))
* Implement include parameter specifically for adding logprobs in the output message ([01f0ba8](https://github.com/llamastack/llama-stack-client-typescript/commit/01f0ba8970e6c1a729dd872cf228376fddd5f3fe))
* introduce /admin API for stack administration and operations ([2c9e2ab](https://github.com/llamastack/llama-stack-client-typescript/commit/2c9e2ab11a42bb2192370880781e2faee633c17c))
* migrate Inspect API to FastAPI router ([79f8d87](https://github.com/llamastack/llama-stack-client-typescript/commit/79f8d87b64a243c782c5a9eb5b62d31378781f36))
* migrate Providers API to FastAPI router pattern ([22f7cf6](https://github.com/llamastack/llama-stack-client-typescript/commit/22f7cf60f463db6091bf213a630ac48bb1f12e49))


### Bug Fixes

* **mcp:** correct code tool API endpoint ([6006307](https://github.com/llamastack/llama-stack-client-typescript/commit/60063077b65f31a31dabf254dbcfae50909cd692))
* **mcp:** return correct lines on typescript errors ([368f4b5](https://github.com/llamastack/llama-stack-client-typescript/commit/368f4b50eb87213ab27f43a161df688d3cba4f62))


### Chores

* 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))
* **internal:** codegen related update ([9d4ee0f](https://github.com/llamastack/llama-stack-client-typescript/commit/9d4ee0f21db979f28ac2008f37b02a70e72094ff))
* **internal:** codegen related update ([b5ea21d](https://github.com/llamastack/llama-stack-client-typescript/commit/b5ea21d0dcf0a71a49420efdf721f21254b9a0ce))
* **internal:** codegen related update ([d199aff](https://github.com/llamastack/llama-stack-client-typescript/commit/d199aff3d638854e58ae5575979d2c7f57eebc10))


### Documentation

* add more examples ([cc58d0d](https://github.com/llamastack/llama-stack-client-typescript/commit/cc58d0d59eda97e5fbad6b6daea0272dcbb189cb))

## 0.4.0-alpha.7 (2025-12-03)

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)
Expand Down
53 changes: 31 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,6 @@ const client = new LlamaStackClient();
const models = await client.models.list();
```

## Streaming responses

We provide support for streaming responses using Server Sent Events (SSE).

```ts
import LlamaStackClient from 'llama-stack-client';

const client = new LlamaStackClient();

const stream = await client.chat.completions.create({
messages: [{ content: 'string', role: 'user' }],
model: 'model',
stream: true,
});
for await (const chatCompletionChunk of stream) {
console.log(chatCompletionChunk.id);
}
```

If you need to cancel a stream, you can `break` from the loop
or call `stream.controller.abort()`.

### Request & Response types

This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
Expand Down Expand Up @@ -179,6 +157,37 @@ On timeout, an `APIConnectionTimeoutError` is thrown.

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

## Auto-pagination

List methods in the LlamaStackClient API are paginated.
You can use the `for await … of` syntax to iterate through items across all pages:

```ts
async function fetchAllResponseListResponses(params) {
const allResponseListResponses = [];
// Automatically fetches more pages as needed.
for await (const responseListResponse of client.responses.list()) {
allResponseListResponses.push(responseListResponse);
}
return allResponseListResponses;
}
```

Alternatively, you can request a single page at a time:

```ts
let page = await client.responses.list();
for (const responseListResponse of page.data) {
console.log(responseListResponse);
}

// Convenience methods are provided for manually paginating:
while (page.hasNextPage()) {
page = await page.getNextPage();
// ...
}
```

## Advanced Usage

### Accessing raw Response data (e.g., headers)
Expand Down
27 changes: 17 additions & 10 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

Types:

- <code><a href="./src/resources/shared.ts">HealthInfo</a></code>
- <code><a href="./src/resources/shared.ts">InterleavedContent</a></code>
- <code><a href="./src/resources/shared.ts">InterleavedContentItem</a></code>
- <code><a href="./src/resources/shared.ts">ListProvidersResponse</a></code>
- <code><a href="./src/resources/shared.ts">ListRoutesResponse</a></code>
- <code><a href="./src/resources/shared.ts">ParamType</a></code>
- <code><a href="./src/resources/shared.ts">ProviderInfo</a></code>
- <code><a href="./src/resources/shared.ts">RouteInfo</a></code>
- <code><a href="./src/resources/shared.ts">SafetyViolation</a></code>
- <code><a href="./src/resources/shared.ts">SamplingParams</a></code>
- <code><a href="./src/resources/shared.ts">ScoringResult</a></code>
- <code><a href="./src/resources/shared.ts">SystemMessage</a></code>
- <code><a href="./src/resources/shared.ts">VersionInfo</a></code>

# Toolgroups

Expand Down Expand Up @@ -130,13 +136,6 @@ Methods:

# Inspect

Types:

- <code><a href="./src/resources/inspect.ts">HealthInfo</a></code>
- <code><a href="./src/resources/inspect.ts">ProviderInfo</a></code>
- <code><a href="./src/resources/inspect.ts">RouteInfo</a></code>
- <code><a href="./src/resources/inspect.ts">VersionInfo</a></code>

Methods:

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

Types:

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

Methods:
Expand All @@ -281,7 +279,6 @@ Methods:

Types:

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

Methods:
Expand Down Expand Up @@ -401,6 +398,7 @@ Methods:
Types:

- <code><a href="./src/resources/alpha/post-training/post-training.ts">AlgorithmConfig</a></code>
- <code><a href="./src/resources/alpha/post-training/post-training.ts">ListPostTrainingJobsResponse</a></code>
- <code><a href="./src/resources/alpha/post-training/post-training.ts">PostTrainingJob</a></code>

Methods:
Expand All @@ -412,7 +410,6 @@ Methods:

Types:

- <code><a href="./src/resources/alpha/post-training/job.ts">ListPostTrainingJobsResponse</a></code>
- <code><a href="./src/resources/alpha/post-training/job.ts">JobListResponse</a></code>
- <code><a href="./src/resources/alpha/post-training/job.ts">JobArtifactsResponse</a></code>
- <code><a href="./src/resources/alpha/post-training/job.ts">JobStatusResponse</a></code>
Expand Down Expand Up @@ -462,6 +459,16 @@ Methods:
- <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>
- <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>

## Admin

Methods:

- <code title="get /v1alpha/admin/health">client.alpha.admin.<a href="./src/resources/alpha/admin.ts">health</a>() -> HealthInfo</code>
- <code title="get /v1alpha/admin/providers/{provider_id}">client.alpha.admin.<a href="./src/resources/alpha/admin.ts">inspectProvider</a>(providerId) -> ProviderInfo</code>
- <code title="get /v1alpha/admin/providers">client.alpha.admin.<a href="./src/resources/alpha/admin.ts">listProviders</a>() -> ProviderListResponse</code>
- <code title="get /v1alpha/admin/inspect/routes">client.alpha.admin.<a href="./src/resources/alpha/admin.ts">listRoutes</a>({ ...params }) -> RouteListResponse</code>
- <code title="get /v1alpha/admin/version">client.alpha.admin.<a href="./src/resources/alpha/admin.ts">version</a>() -> VersionInfo</code>

# Beta

## Datasets
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "llama-stack-client",
"version": "0.4.0-alpha.7",
"version": "0.4.0-alpha.8",
"description": "The official TypeScript library for the Llama Stack Client API",
"author": "Llama Stack Client <llamastack@meta.com>",
"types": "dist/index.d.ts",
Expand Down
27 changes: 11 additions & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ import {
FilesOpenAICursorPage,
ListFilesResponse,
} from './resources/files';
import { HealthInfo, Inspect, ProviderInfo, RouteInfo, VersionInfo } from './resources/inspect';
import { Inspect } from './resources/inspect';
import { CreateResponse, ModerationCreateParams, Moderations } from './resources/moderations';
import { ListProvidersResponse, ProviderListResponse, Providers } from './resources/providers';
import { ListRoutesResponse, RouteListParams, RouteListResponse, Routes } from './resources/routes';
import { ProviderListResponse, Providers } from './resources/providers';
import { RouteListParams, RouteListResponse, Routes } from './resources/routes';
import { RunShieldResponse, Safety, SafetyRunShieldParams } from './resources/safety';
import {
Scoring,
Expand Down Expand Up @@ -431,13 +431,7 @@ export declare namespace LlamaStackClient {
type ConversationUpdateParams as ConversationUpdateParams,
};

export {
Inspect as Inspect,
type HealthInfo as HealthInfo,
type ProviderInfo as ProviderInfo,
type RouteInfo as RouteInfo,
type VersionInfo as VersionInfo,
};
export { Inspect as Inspect };

export {
Embeddings as Embeddings,
Expand Down Expand Up @@ -485,15 +479,10 @@ export declare namespace LlamaStackClient {
type ModelRegisterParams as ModelRegisterParams,
};

export {
Providers as Providers,
type ListProvidersResponse as ListProvidersResponse,
type ProviderListResponse as ProviderListResponse,
};
export { Providers as Providers, type ProviderListResponse as ProviderListResponse };

export {
Routes as Routes,
type ListRoutesResponse as ListRoutesResponse,
type RouteListResponse as RouteListResponse,
type RouteListParams as RouteListParams,
};
Expand Down Expand Up @@ -561,13 +550,19 @@ export declare namespace LlamaStackClient {

export { Beta as Beta };

export type HealthInfo = API.HealthInfo;
export type InterleavedContent = API.InterleavedContent;
export type InterleavedContentItem = API.InterleavedContentItem;
export type ListProvidersResponse = API.ListProvidersResponse;
export type ListRoutesResponse = API.ListRoutesResponse;
export type ParamType = API.ParamType;
export type ProviderInfo = API.ProviderInfo;
export type RouteInfo = API.RouteInfo;
export type SafetyViolation = API.SafetyViolation;
export type SamplingParams = API.SamplingParams;
export type ScoringResult = API.ScoringResult;
export type SystemMessage = API.SystemMessage;
export type VersionInfo = API.VersionInfo;
}

export { getResponseOutputText } from './lib/response-helpers';
Expand Down
84 changes: 84 additions & 0 deletions src/resources/alpha/admin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright (c) Meta Platforms, Inc. and affiliates.
// All rights reserved.
//
// This source code is licensed under the terms described in the LICENSE file in
// the root directory of this source tree.
//
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import { isRequestOptions } from '../../core';
import * as Core from '../../core';
import * as ProvidersAPI from '../providers';
import * as RoutesAPI from '../routes';
import * as Shared from '../shared';

export class Admin extends APIResource {
/**
* Get the current health status of the service.
*/
health(options?: Core.RequestOptions): Core.APIPromise<Shared.HealthInfo> {
return this._client.get('/v1alpha/admin/health', options);
}

/**
* Get detailed information about a specific provider.
*/
inspectProvider(providerId: string, options?: Core.RequestOptions): Core.APIPromise<Shared.ProviderInfo> {
return this._client.get(`/v1alpha/admin/providers/${providerId}`, options);
}

/**
* List all available providers with their configuration and health status.
*/
listProviders(options?: Core.RequestOptions): Core.APIPromise<ProvidersAPI.ProviderListResponse> {
return (
this._client.get('/v1alpha/admin/providers', options) as Core.APIPromise<{
data: ProvidersAPI.ProviderListResponse;
}>
)._thenUnwrap((obj) => obj.data);
}

/**
* List all available API routes with their methods and implementing providers.
*/
listRoutes(
query?: AdminListRoutesParams,
options?: Core.RequestOptions,
): Core.APIPromise<RoutesAPI.RouteListResponse>;
listRoutes(options?: Core.RequestOptions): Core.APIPromise<RoutesAPI.RouteListResponse>;
listRoutes(
query: AdminListRoutesParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<RoutesAPI.RouteListResponse> {
if (isRequestOptions(query)) {
return this.listRoutes({}, query);
}
return (
this._client.get('/v1alpha/admin/inspect/routes', { query, ...options }) as Core.APIPromise<{
data: RoutesAPI.RouteListResponse;
}>
)._thenUnwrap((obj) => obj.data);
}

/**
* Get the version of the service.
*/
version(options?: Core.RequestOptions): Core.APIPromise<Shared.VersionInfo> {
return this._client.get('/v1alpha/admin/version', options);
}
}

export interface AdminListRoutesParams {
/**
* Filter to control which routes are returned. Can be an API level ('v1',
* 'v1alpha', 'v1beta') to show non-deprecated routes at that level, or
* 'deprecated' to show deprecated routes across all levels. If not specified,
* returns all non-deprecated routes.
*/
api_filter?: 'v1' | 'v1alpha' | 'v1beta' | 'deprecated' | null;
}

export declare namespace Admin {
export { type AdminListRoutesParams as AdminListRoutesParams };
}
Loading