Skip to content

Commit 7da9564

Browse files
authored
Sync updates from stainless branch: ashwinb/dev (#19)
1 parent de5b912 commit 7da9564

File tree

21 files changed

+331
-266
lines changed

21 files changed

+331
-266
lines changed

src/_shims/index-deno.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,5 @@ export declare class FsReadStream extends Readable {
108108
const _ReadableStream = ReadableStream;
109109
type _ReadableStream = ReadableStream;
110110
export { _ReadableStream as ReadableStream };
111+
112+
export const init = () => {};

src/_shims/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,5 @@ export function fileFromPath(path: string, options?: FileFromPathOptions): Promi
7979
export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise<File>;
8080

8181
export function isFsReadStream(value: any): value is FsReadStream;
82+
83+
export const init: () => void;

src/_shims/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
*/
44
const shims = require('./registry');
55
const auto = require('llama-stack-client/_shims/auto/runtime');
6-
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
6+
exports.init = () => {
7+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
8+
};
79
for (const property of Object.keys(shims)) {
810
Object.defineProperty(exports, property, {
911
get() {
1012
return shims[property];
1113
},
1214
});
1315
}
16+
17+
exports.init();

src/_shims/index.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@
33
*/
44
import * as shims from './registry.mjs';
55
import * as auto from 'llama-stack-client/_shims/auto/runtime';
6-
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
6+
export const init = () => {
7+
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
8+
};
79
export * from './registry.mjs';
10+
11+
init();

src/core.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ import {
1717
type RequestInit,
1818
type Response,
1919
type HeadersInit,
20+
init,
2021
} from './_shims/index';
22+
23+
// try running side effects outside of _shims/index to workaround https://github.com/vercel/next.js/issues/76881
24+
init();
25+
2126
export { type Response };
2227
import { BlobLike, isBlobLike, isMultipartBody } from './uploads';
2328
export {
@@ -29,6 +34,20 @@ export {
2934

3035
export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
3136

37+
/**
38+
* An alias to the builtin `Array` type so we can
39+
* easily alias it in import statements if there are name clashes.
40+
*/
41+
type _Array<T> = Array<T>;
42+
43+
/**
44+
* An alias to the builtin `Record` type so we can
45+
* easily alias it in import statements if there are name clashes.
46+
*/
47+
type _Record<K extends keyof any, T> = Record<K, T>;
48+
49+
export type { _Array as Array, _Record as Record };
50+
3251
type PromiseOrValue<T> = T | Promise<T>;
3352

3453
type APIResponseProps = {
@@ -380,7 +399,7 @@ export abstract class APIClient {
380399
getHeader(headers, 'x-stainless-timeout') === undefined &&
381400
options.timeout
382401
) {
383-
reqHeaders['x-stainless-timeout'] = String(options.timeout);
402+
reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000));
384403
}
385404

386405
this.validateHeaders(reqHeaders, headers);

src/index.ts

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ import * as Pagination from './pagination';
88
import { type DatasetsIterrowsParams, DatasetsIterrowsResponse } from './pagination';
99
import * as Uploads from './uploads';
1010
import * as API from './resources/index';
11-
import {
12-
BatchInference,
13-
BatchInferenceChatCompletionParams,
14-
BatchInferenceChatCompletionResponse,
15-
BatchInferenceCompletionParams,
16-
} from './resources/batch-inference';
1711
import {
1812
Benchmark,
1913
BenchmarkListResponse,
@@ -36,6 +30,9 @@ import {
3630
CompletionResponse,
3731
EmbeddingsResponse,
3832
Inference,
33+
InferenceBatchChatCompletionParams,
34+
InferenceBatchChatCompletionResponse,
35+
InferenceBatchCompletionParams,
3936
InferenceChatCompletionParams,
4037
InferenceChatCompletionParamsNonStreaming,
4138
InferenceChatCompletionParamsStreaming,
@@ -157,6 +154,7 @@ import {
157154
ToolRuntime,
158155
ToolRuntimeInvokeToolParams,
159156
ToolRuntimeListToolsParams,
157+
ToolRuntimeListToolsResponse,
160158
} from './resources/tool-runtime/tool-runtime';
161159

162160
export interface ClientOptions {
@@ -270,7 +268,6 @@ export class LlamaStackClient extends Core.APIClient {
270268
tools: API.Tools = new API.Tools(this);
271269
toolRuntime: API.ToolRuntime = new API.ToolRuntime(this);
272270
agents: API.Agents = new API.Agents(this);
273-
batchInference: API.BatchInference = new API.BatchInference(this);
274271
datasets: API.Datasets = new API.Datasets(this);
275272
eval: API.Eval = new API.Eval(this);
276273
inspect: API.Inspect = new API.Inspect(this);
@@ -336,7 +333,6 @@ LlamaStackClient.Toolgroups = Toolgroups;
336333
LlamaStackClient.Tools = Tools;
337334
LlamaStackClient.ToolRuntime = ToolRuntime;
338335
LlamaStackClient.Agents = Agents;
339-
LlamaStackClient.BatchInference = BatchInference;
340336
LlamaStackClient.Datasets = Datasets;
341337
LlamaStackClient.Eval = Eval;
342338
LlamaStackClient.Inspect = Inspect;
@@ -383,6 +379,7 @@ export declare namespace LlamaStackClient {
383379
ToolRuntime as ToolRuntime,
384380
type ToolDef as ToolDef,
385381
type ToolInvocationResult as ToolInvocationResult,
382+
type ToolRuntimeListToolsResponse as ToolRuntimeListToolsResponse,
386383
type ToolRuntimeInvokeToolParams as ToolRuntimeInvokeToolParams,
387384
type ToolRuntimeListToolsParams as ToolRuntimeListToolsParams,
388385
};
@@ -398,13 +395,6 @@ export declare namespace LlamaStackClient {
398395
type AgentCreateParams as AgentCreateParams,
399396
};
400397

401-
export {
402-
BatchInference as BatchInference,
403-
type BatchInferenceChatCompletionResponse as BatchInferenceChatCompletionResponse,
404-
type BatchInferenceChatCompletionParams as BatchInferenceChatCompletionParams,
405-
type BatchInferenceCompletionParams as BatchInferenceCompletionParams,
406-
};
407-
408398
export {
409399
Datasets as Datasets,
410400
type ListDatasetsResponse as ListDatasetsResponse,
@@ -442,6 +432,9 @@ export declare namespace LlamaStackClient {
442432
type CompletionResponse as CompletionResponse,
443433
type EmbeddingsResponse as EmbeddingsResponse,
444434
type TokenLogProbs as TokenLogProbs,
435+
type InferenceBatchChatCompletionResponse as InferenceBatchChatCompletionResponse,
436+
type InferenceBatchChatCompletionParams as InferenceBatchChatCompletionParams,
437+
type InferenceBatchCompletionParams as InferenceBatchCompletionParams,
445438
type InferenceChatCompletionParams as InferenceChatCompletionParams,
446439
type InferenceChatCompletionParamsNonStreaming as InferenceChatCompletionParamsNonStreaming,
447440
type InferenceChatCompletionParamsStreaming as InferenceChatCompletionParamsStreaming,

src/internal/decoders/jsonl.ts

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/resources/batch-inference.ts

Lines changed: 0 additions & 103 deletions
This file was deleted.

src/resources/datasets.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ export class Datasets extends APIResource {
1616
}
1717

1818
/**
19-
* Get a paginated list of rows from a dataset. Uses cursor-based pagination.
19+
* Get a paginated list of rows from a dataset. Uses offset-based pagination where:
20+
*
21+
* - start_index: The starting index (0-based). If None, starts from beginning.
22+
* - limit: Number of items to return. If None or -1, returns all items.
23+
*
24+
* The response includes:
25+
*
26+
* - data: List of items for the current page
27+
* - has_more: Whether there are more items available after this set
2028
*/
2129
iterrows(
2230
datasetId: string,
@@ -166,19 +174,18 @@ export namespace DatasetListResponse {
166174
}
167175

168176
/**
169-
* A paginated list of rows from a dataset.
177+
* A generic paginated response that follows a simple format.
170178
*/
171179
export interface DatasetIterrowsResponse {
172180
/**
173-
* The rows in the current page.
181+
* The list of items for the current page
174182
*/
175183
data: Array<Record<string, boolean | number | string | Array<unknown> | unknown | null>>;
176184

177185
/**
178-
* Index into dataset for the first row in the next page. None if there are no more
179-
* rows.
186+
* Whether there are more items available after this set
180187
*/
181-
next_start_index?: number;
188+
has_more: boolean;
182189
}
183190

184191
export interface DatasetRegisterResponse {

src/resources/eval/eval.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export interface EvaluateResponse {
132132
export interface Job {
133133
job_id: string;
134134

135-
status: 'completed' | 'in_progress' | 'failed' | 'scheduled';
135+
status: 'completed' | 'in_progress' | 'failed' | 'scheduled' | 'cancelled';
136136
}
137137

138138
export interface EvalEvaluateRowsParams {

0 commit comments

Comments
 (0)