Skip to content

Commit 1989335

Browse files
authored
Sync updates from stainless branch: hardikjshah/dev (#24)
1 parent 8f251cb commit 1989335

File tree

21 files changed

+1828
-8
lines changed

21 files changed

+1828
-8
lines changed

src/index.ts

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,20 @@ import {
3232
Datasets,
3333
ListDatasetsResponse,
3434
} from './resources/datasets';
35+
import { EmbeddingCreateParams, Embeddings, EmbeddingsResponse } from './resources/embeddings';
36+
import {
37+
DeleteFileResponse,
38+
File,
39+
FileContentResponse,
40+
FileCreateParams,
41+
FileListParams,
42+
Files,
43+
ListFilesResponse,
44+
} from './resources/files';
3545
import {
3646
ChatCompletionResponseStreamChunk,
3747
CompletionResponse,
38-
EmbeddingsResponse,
48+
EmbeddingsResponse as InferenceAPIEmbeddingsResponse,
3949
Inference,
4050
InferenceBatchChatCompletionParams,
4151
InferenceBatchChatCompletionResponse,
@@ -174,6 +184,17 @@ import {
174184
ToolRuntimeListToolsParams,
175185
ToolRuntimeListToolsResponse,
176186
} from './resources/tool-runtime/tool-runtime';
187+
import {
188+
ListVectorStoresResponse,
189+
VectorStore,
190+
VectorStoreCreateParams,
191+
VectorStoreDeleteResponse,
192+
VectorStoreListParams,
193+
VectorStoreSearchParams,
194+
VectorStoreSearchResponse,
195+
VectorStoreUpdateParams,
196+
VectorStores,
197+
} from './resources/vector-stores/vector-stores';
177198

178199
export interface ClientOptions {
179200
/**
@@ -291,10 +312,12 @@ export class LlamaStackClient extends Core.APIClient {
291312
eval: API.Eval = new API.Eval(this);
292313
inspect: API.Inspect = new API.Inspect(this);
293314
inference: API.Inference = new API.Inference(this);
315+
embeddings: API.Embeddings = new API.Embeddings(this);
294316
chat: API.Chat = new API.Chat(this);
295317
completions: API.Completions = new API.Completions(this);
296318
vectorIo: API.VectorIo = new API.VectorIo(this);
297319
vectorDBs: API.VectorDBs = new API.VectorDBs(this);
320+
vectorStores: API.VectorStores = new API.VectorStores(this);
298321
models: API.Models = new API.Models(this);
299322
postTraining: API.PostTraining = new API.PostTraining(this);
300323
providers: API.Providers = new API.Providers(this);
@@ -306,6 +329,7 @@ export class LlamaStackClient extends Core.APIClient {
306329
scoring: API.Scoring = new API.Scoring(this);
307330
scoringFunctions: API.ScoringFunctions = new API.ScoringFunctions(this);
308331
benchmarks: API.Benchmarks = new API.Benchmarks(this);
332+
files: API.Files = new API.Files(this);
309333

310334
protected override defaultQuery(): Core.DefaultQuery | undefined {
311335
return this._options.defaultQuery;
@@ -359,10 +383,12 @@ LlamaStackClient.Datasets = Datasets;
359383
LlamaStackClient.Eval = Eval;
360384
LlamaStackClient.Inspect = Inspect;
361385
LlamaStackClient.Inference = Inference;
386+
LlamaStackClient.Embeddings = Embeddings;
362387
LlamaStackClient.Chat = Chat;
363388
LlamaStackClient.Completions = Completions;
364389
LlamaStackClient.VectorIo = VectorIo;
365390
LlamaStackClient.VectorDBs = VectorDBs;
391+
LlamaStackClient.VectorStores = VectorStores;
366392
LlamaStackClient.Models = Models;
367393
LlamaStackClient.PostTraining = PostTraining;
368394
LlamaStackClient.Providers = Providers;
@@ -374,6 +400,7 @@ LlamaStackClient.Telemetry = Telemetry;
374400
LlamaStackClient.Scoring = Scoring;
375401
LlamaStackClient.ScoringFunctions = ScoringFunctions;
376402
LlamaStackClient.Benchmarks = Benchmarks;
403+
LlamaStackClient.Files = Files;
377404
export declare namespace LlamaStackClient {
378405
export type RequestOptions = Core.RequestOptions;
379406

@@ -465,7 +492,7 @@ export declare namespace LlamaStackClient {
465492
Inference as Inference,
466493
type ChatCompletionResponseStreamChunk as ChatCompletionResponseStreamChunk,
467494
type CompletionResponse as CompletionResponse,
468-
type EmbeddingsResponse as EmbeddingsResponse,
495+
type InferenceAPIEmbeddingsResponse as EmbeddingsResponse,
469496
type TokenLogProbs as TokenLogProbs,
470497
type InferenceBatchChatCompletionResponse as InferenceBatchChatCompletionResponse,
471498
type InferenceBatchChatCompletionParams as InferenceBatchChatCompletionParams,
@@ -479,6 +506,12 @@ export declare namespace LlamaStackClient {
479506
type InferenceEmbeddingsParams as InferenceEmbeddingsParams,
480507
};
481508

509+
export {
510+
Embeddings as Embeddings,
511+
type EmbeddingsResponse as EmbeddingsResponse,
512+
type EmbeddingCreateParams as EmbeddingCreateParams,
513+
};
514+
482515
export { Chat as Chat, type ChatCompletionChunk as ChatCompletionChunk };
483516

484517
export {
@@ -505,6 +538,18 @@ export declare namespace LlamaStackClient {
505538
type VectorDBRegisterParams as VectorDBRegisterParams,
506539
};
507540

541+
export {
542+
VectorStores as VectorStores,
543+
type ListVectorStoresResponse as ListVectorStoresResponse,
544+
type VectorStore as VectorStore,
545+
type VectorStoreDeleteResponse as VectorStoreDeleteResponse,
546+
type VectorStoreSearchResponse as VectorStoreSearchResponse,
547+
type VectorStoreCreateParams as VectorStoreCreateParams,
548+
type VectorStoreUpdateParams as VectorStoreUpdateParams,
549+
type VectorStoreListParams as VectorStoreListParams,
550+
type VectorStoreSearchParams as VectorStoreSearchParams,
551+
};
552+
508553
export {
509554
Models as Models,
510555
type ListModelsResponse as ListModelsResponse,
@@ -597,6 +642,16 @@ export declare namespace LlamaStackClient {
597642
type BenchmarkRegisterParams as BenchmarkRegisterParams,
598643
};
599644

645+
export {
646+
Files as Files,
647+
type DeleteFileResponse as DeleteFileResponse,
648+
type File as File,
649+
type ListFilesResponse as ListFilesResponse,
650+
type FileContentResponse as FileContentResponse,
651+
type FileCreateParams as FileCreateParams,
652+
type FileListParams as FileListParams,
653+
};
654+
600655
export type AgentConfig = API.AgentConfig;
601656
export type BatchCompletion = API.BatchCompletion;
602657
export type ChatCompletionResponse = API.ChatCompletionResponse;

src/resources/completions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ export interface CompletionCreateParamsBase {
223223
*/
224224
stream_options?: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
225225

226+
/**
227+
* (Optional) The suffix that should be appended to the completion.
228+
*/
229+
suffix?: string;
230+
226231
/**
227232
* (Optional) The temperature to use.
228233
*/

src/resources/embeddings.ts

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../resource';
4+
import * as Core from '../core';
5+
6+
export class Embeddings extends APIResource {
7+
/**
8+
* Generate OpenAI-compatible embeddings for the given input using the specified
9+
* model.
10+
*/
11+
create(body: EmbeddingCreateParams, options?: Core.RequestOptions): Core.APIPromise<EmbeddingsResponse> {
12+
return this._client.post('/v1/openai/v1/embeddings', { body, ...options });
13+
}
14+
}
15+
16+
/**
17+
* Response from an OpenAI-compatible embeddings request.
18+
*/
19+
export interface EmbeddingsResponse {
20+
/**
21+
* List of embedding data objects
22+
*/
23+
data: Array<EmbeddingsResponse.Data>;
24+
25+
/**
26+
* The model that was used to generate the embeddings
27+
*/
28+
model: string;
29+
30+
/**
31+
* The object type, which will be "list"
32+
*/
33+
object: 'list';
34+
35+
/**
36+
* Usage information
37+
*/
38+
usage: EmbeddingsResponse.Usage;
39+
}
40+
41+
export namespace EmbeddingsResponse {
42+
/**
43+
* A single embedding data object from an OpenAI-compatible embeddings response.
44+
*/
45+
export interface Data {
46+
/**
47+
* The embedding vector as a list of floats (when encoding_format="float") or as a
48+
* base64-encoded string (when encoding_format="base64")
49+
*/
50+
embedding: Array<number> | string;
51+
52+
/**
53+
* The index of the embedding in the input list
54+
*/
55+
index: number;
56+
57+
/**
58+
* The object type, which will be "embedding"
59+
*/
60+
object: 'embedding';
61+
}
62+
63+
/**
64+
* Usage information
65+
*/
66+
export interface Usage {
67+
/**
68+
* The number of tokens in the input
69+
*/
70+
prompt_tokens: number;
71+
72+
/**
73+
* The total number of tokens used
74+
*/
75+
total_tokens: number;
76+
}
77+
}
78+
79+
export interface EmbeddingCreateParams {
80+
/**
81+
* Input text to embed, encoded as a string or array of strings. To embed multiple
82+
* inputs in a single request, pass an array of strings.
83+
*/
84+
input: string | Array<string>;
85+
86+
/**
87+
* The identifier of the model to use. The model must be an embedding model
88+
* registered with Llama Stack and available via the /models endpoint.
89+
*/
90+
model: string;
91+
92+
/**
93+
* (Optional) The number of dimensions the resulting output embeddings should have.
94+
* Only supported in text-embedding-3 and later models.
95+
*/
96+
dimensions?: number;
97+
98+
/**
99+
* (Optional) The format to return the embeddings in. Can be either "float" or
100+
* "base64". Defaults to "float".
101+
*/
102+
encoding_format?: string;
103+
104+
/**
105+
* (Optional) A unique identifier representing your end-user, which can help OpenAI
106+
* to monitor and detect abuse.
107+
*/
108+
user?: string;
109+
}
110+
111+
export declare namespace Embeddings {
112+
export {
113+
type EmbeddingsResponse as EmbeddingsResponse,
114+
type EmbeddingCreateParams as EmbeddingCreateParams,
115+
};
116+
}

0 commit comments

Comments
 (0)