diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3c0b29c..44fc7fc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.5.0-alpha.2" + ".": "0.5.0-alpha.3" } diff --git a/.stats.yml b/.stats.yml index 48be7ae..3573544 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 108 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-958e990011d6b4c27513743a151ec4c80c3103650a80027380d15f1d6b108e32.yml -openapi_spec_hash: 5b49d825dbc2a26726ca752914a65114 -config_hash: 19b84a0a93d566334ae134dafc71991f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-621e8b8ef37d5ebf024fe3bf6a59486a90debf01acca2c9bb4e9032e2dff92d3.yml +openapi_spec_hash: 51f623cd3ea4addf8f939dd4ef8962c8 +config_hash: 6aa61d4143c3e3df785972c0287d1370 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ee4ac0..d4b0979 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## 0.5.0-alpha.3 (2026-02-19) + +Full Changelog: [v0.5.0-alpha.2...v0.5.0-alpha.3](https://github.com/llamastack/llama-stack-client-typescript/compare/v0.5.0-alpha.2...v0.5.0-alpha.3) + +### ⚠ BREAKING CHANGES + +* improve consistency of post-training API endpoints + +### Features + +* Add prompt_cache_key parameter support ([e6399ef](https://github.com/llamastack/llama-stack-client-typescript/commit/e6399ef9e8b34b6cf3238c4c8f8b7d0134a8788e)) +* add support for /responses background parameter ([c7e9581](https://github.com/llamastack/llama-stack-client-typescript/commit/c7e9581d7df28f5c97dd9ecc903c942f33972649)) +* Add truncation parameter support ([3119d6b](https://github.com/llamastack/llama-stack-client-typescript/commit/3119d6bb8a1d38d6fa1958daeed0fb5dbb12b1e1)) +* improve consistency of post-training API endpoints ([93376fc](https://github.com/llamastack/llama-stack-client-typescript/commit/93376fcbe864d4e8becd957301e6df15b3d803f8)) +* **vector_io:** Implement Contextual Retrieval for improved RAG search quality ([abf9c27](https://github.com/llamastack/llama-stack-client-typescript/commit/abf9c27dcee824cd87f5b1889c456d99a7a94fb9)) + + +### Bug Fixes + +* align chat completion usage schema with OpenAI spec ([6fa6eb8](https://github.com/llamastack/llama-stack-client-typescript/commit/6fa6eb87d96902586d4feb82747a5cdf99622045)) +* **inference:** use flat response message model for chat/completions ([d7033cd](https://github.com/llamastack/llama-stack-client-typescript/commit/d7033cd2af32a823514135971b3775037992393c)) +* **vector_io:** align Protocol signatures with request models ([11a1a20](https://github.com/llamastack/llama-stack-client-typescript/commit/11a1a20e82bae62f8210cb26091d3df8bf648f15)) + + +### Chores + +* **api:** minor updates ([1286b39](https://github.com/llamastack/llama-stack-client-typescript/commit/1286b396a69ae48b41ad125405f005264339116d)) +* **internal:** avoid type checking errors with ts-reset ([2cffe20](https://github.com/llamastack/llama-stack-client-typescript/commit/2cffe2040a77c3310db5d1803fc3800b4dd72f28)) + ## 0.5.0-alpha.2 (2026-02-05) 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) diff --git a/api.md b/api.md index aeddd14..96b1c74 100644 --- a/api.md +++ b/api.md @@ -407,9 +407,9 @@ Types: Methods: - client.alpha.postTraining.job.list() -> JobListResponse -- client.alpha.postTraining.job.artifacts() -> JobArtifactsResponse -- client.alpha.postTraining.job.cancel() -> void -- client.alpha.postTraining.job.status() -> JobStatusResponse +- client.alpha.postTraining.job.artifacts(jobUuid) -> JobArtifactsResponse +- client.alpha.postTraining.job.cancel(jobUuid) -> void +- client.alpha.postTraining.job.status(jobUuid) -> JobStatusResponse ## Benchmarks diff --git a/package.json b/package.json index 22fa765..9cbef4f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "llama-stack-client", - "version": "0.5.0-alpha.2", + "version": "0.5.0-alpha.3", "description": "The official TypeScript library for the Llama Stack Client API", "author": "Llama Stack Client ", "types": "dist/index.d.ts", diff --git a/src/resources/alpha/post-training/job.ts b/src/resources/alpha/post-training/job.ts index 07db269..4875053 100644 --- a/src/resources/alpha/post-training/job.ts +++ b/src/resources/alpha/post-training/job.ts @@ -23,15 +23,15 @@ export class Job extends APIResource { /** * Get the artifacts of a training job. */ - artifacts(options?: Core.RequestOptions): Core.APIPromise { - return this._client.get('/v1alpha/post-training/job/artifacts', options); + artifacts(jobUuid: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.get(`/v1alpha/post-training/jobs/${jobUuid}/artifacts`, options); } /** * Cancel a training job. */ - cancel(options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/v1alpha/post-training/job/cancel', { + cancel(jobUuid: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post(`/v1alpha/post-training/jobs/${jobUuid}/cancel`, { ...options, headers: { Accept: '*/*', ...options?.headers }, }); @@ -40,8 +40,8 @@ export class Job extends APIResource { /** * Get the status of a training job. */ - status(options?: Core.RequestOptions): Core.APIPromise { - return this._client.get('/v1alpha/post-training/job/status', options); + status(jobUuid: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.get(`/v1alpha/post-training/jobs/${jobUuid}/status`, options); } } diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 631c779..8cb5b41 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -53,7 +53,12 @@ export interface ChatCompletionChunk { object?: 'chat.completion.chunk'; /** - * Usage information for OpenAI chat completion. + * The service tier that was used for this response. + */ + service_tier?: string | null; + + /** + * Token usage information (typically included in final chunk with stream_options). */ usage?: ChatCompletionChunk.Usage | null; } @@ -278,54 +283,54 @@ export namespace ChatCompletionChunk { } /** - * Usage information for OpenAI chat completion. + * Token usage information (typically included in final chunk with stream_options). */ export interface Usage { /** * Number of tokens in the completion. */ - completion_tokens: number; + completion_tokens?: number; /** - * Number of tokens in the prompt. + * Detailed breakdown of output token usage. */ - prompt_tokens: number; + completion_tokens_details?: Usage.CompletionTokensDetails; /** - * Total tokens used (prompt + completion). + * Number of tokens in the prompt. */ - total_tokens: number; + prompt_tokens?: number; /** - * Token details for output tokens in OpenAI chat completion usage. + * Detailed breakdown of input token usage. */ - completion_tokens_details?: Usage.CompletionTokensDetails | null; + prompt_tokens_details?: Usage.PromptTokensDetails; /** - * Token details for prompt tokens in OpenAI chat completion usage. + * Total tokens used (prompt + completion). */ - prompt_tokens_details?: Usage.PromptTokensDetails | null; + total_tokens?: number; } export namespace Usage { /** - * Token details for output tokens in OpenAI chat completion usage. + * Detailed breakdown of output token usage. */ export interface CompletionTokensDetails { /** * Number of tokens used for reasoning (o1/o3 models). */ - reasoning_tokens?: number | null; + reasoning_tokens?: number; } /** - * Token details for prompt tokens in OpenAI chat completion usage. + * Detailed breakdown of input token usage. */ export interface PromptTokensDetails { /** * Number of tokens retrieved from cache. */ - cached_tokens?: number | null; + cached_tokens?: number; } } } diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index f2b9074..f562d71 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -93,7 +93,12 @@ export interface CompletionCreateResponse { object?: 'chat.completion'; /** - * Usage information for OpenAI chat completion. + * The service tier that was used for this response. + */ + service_tier?: string | null; + + /** + * Token usage information for the completion. */ usage?: CompletionCreateResponse.Usage | null; } @@ -116,12 +121,7 @@ export namespace CompletionCreateResponse { /** * The message from the model. */ - message: - | Choice.OpenAIUserMessageParamOutput - | Choice.OpenAISystemMessageParam - | Choice.OpenAIAssistantMessageParamOutput - | Choice.OpenAIToolMessageParam - | Choice.OpenAIDeveloperMessageParam; + message: Choice.Message; /** * The log probabilities for the tokens in the message from an OpenAI-compatible @@ -132,195 +132,59 @@ export namespace CompletionCreateResponse { export namespace Choice { /** - * A message from the user in an OpenAI-compatible chat completion request. - */ - export interface OpenAIUserMessageParamOutput { - /** - * The content of the message, which can include text and other media. - */ - content: - | string - | Array< - | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartTextParam - | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartImageParam - | OpenAIUserMessageParamOutput.OpenAIFile - >; - - /** - * The name of the user message participant. - */ - name?: string | null; - - /** - * Must be 'user' to identify this as a user message. - */ - role?: 'user'; - } - - export namespace OpenAIUserMessageParamOutput { - /** - * Text content part for OpenAI-compatible chat completion messages. - */ - export interface OpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - - /** - * Image content part for OpenAI-compatible chat completion messages. - */ - export interface OpenAIChatCompletionContentPartImageParam { - /** - * Image URL specification and processing details. - */ - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - /** - * Must be 'image_url' to identify this as image content. - */ - type?: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - /** - * Image URL specification and processing details. - */ - export interface ImageURL { - /** - * URL of the image to include in the message. - */ - url: string; - - /** - * Level of detail for image processing. Can be 'low', 'high', or 'auto'. - */ - detail?: 'low' | 'high' | 'auto' | null; - } - } - - export interface OpenAIFile { - /** - * File specification. - */ - file: OpenAIFile.File; - - /** - * Must be 'file' to identify this as file content. - */ - type?: 'file'; - } - - export namespace OpenAIFile { - /** - * File specification. - */ - export interface File { - /** - * Base64-encoded file data. - */ - file_data?: string | null; - - /** - * ID of an uploaded file. - */ - file_id?: string | null; - - /** - * Name of the file. - */ - filename?: string | null; - } - } - } - - /** - * A system message providing instructions or context to the model. + * The message from the model. */ - export interface OpenAISystemMessageParam { + export interface Message { /** - * The content of the 'system prompt'. If multiple system messages are provided, - * they are concatenated. + * Annotations for the message, when applicable. */ - content: string | Array; + annotations?: Array<{ [key: string]: unknown }>; /** - * The name of the system message participant. + * Audio response data when using audio output modality. */ - name?: string | null; + audio?: { [key: string]: unknown } | null; /** - * Must be 'system' to identify this as a system message. + * The content of the message. */ - role?: 'system'; - } + content?: string | null; - export namespace OpenAISystemMessageParam { /** - * Text content part for OpenAI-compatible chat completion messages. + * Deprecated: the name and arguments of a function that should be called. */ - export interface ListOpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; + function_call?: Message.FunctionCall; - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - } - - /** - * A message containing the model's (assistant) response in an OpenAI-compatible - * chat completion request. - */ - export interface OpenAIAssistantMessageParamOutput { /** - * The content of the model's response. + * The refusal message generated by the model. */ - content?: - | string - | Array - | null; + refusal?: string | null; /** - * The name of the assistant message participant. - */ - name?: string | null; - - /** - * Must be 'assistant' to identify this as the model's response. + * The role of the message author, always 'assistant' in responses. */ role?: 'assistant'; /** - * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object. + * The tool calls generated by the model. */ - tool_calls?: Array | null; + tool_calls?: Array; } - export namespace OpenAIAssistantMessageParamOutput { + export namespace Message { /** - * Text content part for OpenAI-compatible chat completion messages. + * Deprecated: the name and arguments of a function that should be called. */ - export interface ListOpenAIChatCompletionContentPartTextParam { + export interface FunctionCall { /** - * The text content of the message. + * Arguments to pass to the function as a JSON string. */ - text: string; + arguments?: string | null; /** - * Must be 'text' to identify this as text content. + * Name of the function to call. */ - type?: 'text'; + name?: string | null; } /** @@ -366,81 +230,6 @@ export namespace CompletionCreateResponse { } } - /** - * A message representing the result of a tool invocation in an OpenAI-compatible - * chat completion request. - */ - export interface OpenAIToolMessageParam { - /** - * The response content from the tool. - */ - content: string | Array; - - /** - * Unique identifier for the tool call this response is for. - */ - tool_call_id: string; - - /** - * Must be 'tool' to identify this as a tool response. - */ - role?: 'tool'; - } - - export namespace OpenAIToolMessageParam { - /** - * Text content part for OpenAI-compatible chat completion messages. - */ - export interface ListOpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - } - - /** - * A message from the developer in an OpenAI-compatible chat completion request. - */ - export interface OpenAIDeveloperMessageParam { - /** - * The content of the developer message. - */ - content: string | Array; - - /** - * The name of the developer message participant. - */ - name?: string | null; - - /** - * Must be 'developer' to identify this as a developer message. - */ - role?: 'developer'; - } - - export namespace OpenAIDeveloperMessageParam { - /** - * Text content part for OpenAI-compatible chat completion messages. - */ - export interface ListOpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - } - /** * The log probabilities for the tokens in the message from an OpenAI-compatible * chat completion response. @@ -559,54 +348,54 @@ export namespace CompletionCreateResponse { } /** - * Usage information for OpenAI chat completion. + * Token usage information for the completion. */ export interface Usage { /** * Number of tokens in the completion. */ - completion_tokens: number; + completion_tokens?: number; /** - * Number of tokens in the prompt. + * Detailed breakdown of output token usage. */ - prompt_tokens: number; + completion_tokens_details?: Usage.CompletionTokensDetails; /** - * Total tokens used (prompt + completion). + * Number of tokens in the prompt. */ - total_tokens: number; + prompt_tokens?: number; /** - * Token details for output tokens in OpenAI chat completion usage. + * Detailed breakdown of input token usage. */ - completion_tokens_details?: Usage.CompletionTokensDetails | null; + prompt_tokens_details?: Usage.PromptTokensDetails; /** - * Token details for prompt tokens in OpenAI chat completion usage. + * Total tokens used (prompt + completion). */ - prompt_tokens_details?: Usage.PromptTokensDetails | null; + total_tokens?: number; } export namespace Usage { /** - * Token details for output tokens in OpenAI chat completion usage. + * Detailed breakdown of output token usage. */ export interface CompletionTokensDetails { /** * Number of tokens used for reasoning (o1/o3 models). */ - reasoning_tokens?: number | null; + reasoning_tokens?: number; } /** - * Token details for prompt tokens in OpenAI chat completion usage. + * Detailed breakdown of input token usage. */ export interface PromptTokensDetails { /** * Number of tokens retrieved from cache. */ - cached_tokens?: number | null; + cached_tokens?: number; } } } @@ -649,9 +438,14 @@ export interface CompletionRetrieveResponse { object?: 'chat.completion'; /** - * Usage information for OpenAI chat completion. + * The service tier that was used for this response. + */ + service_tier?: string | null; + + /** + * Token usage information for the completion. */ - usage?: CompletionRetrieveResponse.Usage | null; + usage?: CompletionRetrieveResponse.Usage; } export namespace CompletionRetrieveResponse { @@ -672,211 +466,70 @@ export namespace CompletionRetrieveResponse { /** * The message from the model. */ - message: - | Choice.OpenAIUserMessageParamOutput - | Choice.OpenAISystemMessageParam - | Choice.OpenAIAssistantMessageParamOutput - | Choice.OpenAIToolMessageParam - | Choice.OpenAIDeveloperMessageParam; + message: Choice.Message; /** * The log probabilities for the tokens in the message from an OpenAI-compatible * chat completion response. */ - logprobs?: Choice.Logprobs | null; - } - - export namespace Choice { - /** - * A message from the user in an OpenAI-compatible chat completion request. - */ - export interface OpenAIUserMessageParamOutput { - /** - * The content of the message, which can include text and other media. - */ - content: - | string - | Array< - | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartTextParam - | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartImageParam - | OpenAIUserMessageParamOutput.OpenAIFile - >; - - /** - * The name of the user message participant. - */ - name?: string | null; - - /** - * Must be 'user' to identify this as a user message. - */ - role?: 'user'; - } - - export namespace OpenAIUserMessageParamOutput { - /** - * Text content part for OpenAI-compatible chat completion messages. - */ - export interface OpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - - /** - * Image content part for OpenAI-compatible chat completion messages. - */ - export interface OpenAIChatCompletionContentPartImageParam { - /** - * Image URL specification and processing details. - */ - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - /** - * Must be 'image_url' to identify this as image content. - */ - type?: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - /** - * Image URL specification and processing details. - */ - export interface ImageURL { - /** - * URL of the image to include in the message. - */ - url: string; - - /** - * Level of detail for image processing. Can be 'low', 'high', or 'auto'. - */ - detail?: 'low' | 'high' | 'auto' | null; - } - } - - export interface OpenAIFile { - /** - * File specification. - */ - file: OpenAIFile.File; - - /** - * Must be 'file' to identify this as file content. - */ - type?: 'file'; - } - - export namespace OpenAIFile { - /** - * File specification. - */ - export interface File { - /** - * Base64-encoded file data. - */ - file_data?: string | null; - - /** - * ID of an uploaded file. - */ - file_id?: string | null; - - /** - * Name of the file. - */ - filename?: string | null; - } - } - } - - /** - * A system message providing instructions or context to the model. - */ - export interface OpenAISystemMessageParam { - /** - * The content of the 'system prompt'. If multiple system messages are provided, - * they are concatenated. - */ - content: string | Array; - - /** - * The name of the system message participant. - */ - name?: string | null; - - /** - * Must be 'system' to identify this as a system message. - */ - role?: 'system'; - } - - export namespace OpenAISystemMessageParam { - /** - * Text content part for OpenAI-compatible chat completion messages. - */ - export interface ListOpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - } + logprobs?: Choice.Logprobs | null; + } + export namespace Choice { /** - * A message containing the model's (assistant) response in an OpenAI-compatible - * chat completion request. + * The message from the model. */ - export interface OpenAIAssistantMessageParamOutput { + export interface Message { /** - * The content of the model's response. + * Annotations for the message, when applicable. */ - content?: - | string - | Array - | null; + annotations?: Array<{ [key: string]: unknown }>; /** - * The name of the assistant message participant. + * Audio response data when using audio output modality. */ - name?: string | null; + audio?: { [key: string]: unknown } | null; /** - * Must be 'assistant' to identify this as the model's response. + * The content of the message. + */ + content?: string | null; + + /** + * Deprecated: the name and arguments of a function that should be called. + */ + function_call?: Message.FunctionCall; + + /** + * The refusal message generated by the model. + */ + refusal?: string | null; + + /** + * The role of the message author, always 'assistant' in responses. */ role?: 'assistant'; /** - * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object. + * The tool calls generated by the model. */ - tool_calls?: Array | null; + tool_calls?: Array; } - export namespace OpenAIAssistantMessageParamOutput { + export namespace Message { /** - * Text content part for OpenAI-compatible chat completion messages. + * Deprecated: the name and arguments of a function that should be called. */ - export interface ListOpenAIChatCompletionContentPartTextParam { + export interface FunctionCall { /** - * The text content of the message. + * Arguments to pass to the function as a JSON string. */ - text: string; + arguments?: string | null; /** - * Must be 'text' to identify this as text content. + * Name of the function to call. */ - type?: 'text'; + name?: string | null; } /** @@ -922,81 +575,6 @@ export namespace CompletionRetrieveResponse { } } - /** - * A message representing the result of a tool invocation in an OpenAI-compatible - * chat completion request. - */ - export interface OpenAIToolMessageParam { - /** - * The response content from the tool. - */ - content: string | Array; - - /** - * Unique identifier for the tool call this response is for. - */ - tool_call_id: string; - - /** - * Must be 'tool' to identify this as a tool response. - */ - role?: 'tool'; - } - - export namespace OpenAIToolMessageParam { - /** - * Text content part for OpenAI-compatible chat completion messages. - */ - export interface ListOpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - } - - /** - * A message from the developer in an OpenAI-compatible chat completion request. - */ - export interface OpenAIDeveloperMessageParam { - /** - * The content of the developer message. - */ - content: string | Array; - - /** - * The name of the developer message participant. - */ - name?: string | null; - - /** - * Must be 'developer' to identify this as a developer message. - */ - role?: 'developer'; - } - - export namespace OpenAIDeveloperMessageParam { - /** - * Text content part for OpenAI-compatible chat completion messages. - */ - export interface ListOpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - } - /** * The log probabilities for the tokens in the message from an OpenAI-compatible * chat completion response. @@ -1425,54 +1003,54 @@ export namespace CompletionRetrieveResponse { } /** - * Usage information for OpenAI chat completion. + * Token usage information for the completion. */ export interface Usage { /** * Number of tokens in the completion. */ - completion_tokens: number; + completion_tokens?: number; /** - * Number of tokens in the prompt. + * Detailed breakdown of output token usage. */ - prompt_tokens: number; + completion_tokens_details?: Usage.CompletionTokensDetails; /** - * Total tokens used (prompt + completion). + * Number of tokens in the prompt. */ - total_tokens: number; + prompt_tokens?: number; /** - * Token details for output tokens in OpenAI chat completion usage. + * Detailed breakdown of input token usage. */ - completion_tokens_details?: Usage.CompletionTokensDetails | null; + prompt_tokens_details?: Usage.PromptTokensDetails; /** - * Token details for prompt tokens in OpenAI chat completion usage. + * Total tokens used (prompt + completion). */ - prompt_tokens_details?: Usage.PromptTokensDetails | null; + total_tokens?: number; } export namespace Usage { /** - * Token details for output tokens in OpenAI chat completion usage. + * Detailed breakdown of output token usage. */ export interface CompletionTokensDetails { /** * Number of tokens used for reasoning (o1/o3 models). */ - reasoning_tokens?: number | null; + reasoning_tokens?: number; } /** - * Token details for prompt tokens in OpenAI chat completion usage. + * Detailed breakdown of input token usage. */ export interface PromptTokensDetails { /** * Number of tokens retrieved from cache. */ - cached_tokens?: number | null; + cached_tokens?: number; } } } @@ -1546,9 +1124,14 @@ export namespace CompletionListResponse { object?: 'chat.completion'; /** - * Usage information for OpenAI chat completion. + * The service tier that was used for this response. */ - usage?: Data.Usage | null; + service_tier?: string | null; + + /** + * Token usage information for the completion. + */ + usage?: Data.Usage; } export namespace Data { @@ -1569,12 +1152,7 @@ export namespace CompletionListResponse { /** * The message from the model. */ - message: - | Choice.OpenAIUserMessageParamOutput - | Choice.OpenAISystemMessageParam - | Choice.OpenAIAssistantMessageParamOutput - | Choice.OpenAIToolMessageParam - | Choice.OpenAIDeveloperMessageParam; + message: Choice.Message; /** * The log probabilities for the tokens in the message from an OpenAI-compatible @@ -1585,195 +1163,59 @@ export namespace CompletionListResponse { export namespace Choice { /** - * A message from the user in an OpenAI-compatible chat completion request. - */ - export interface OpenAIUserMessageParamOutput { - /** - * The content of the message, which can include text and other media. - */ - content: - | string - | Array< - | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartTextParam - | OpenAIUserMessageParamOutput.OpenAIChatCompletionContentPartImageParam - | OpenAIUserMessageParamOutput.OpenAIFile - >; - - /** - * The name of the user message participant. - */ - name?: string | null; - - /** - * Must be 'user' to identify this as a user message. - */ - role?: 'user'; - } - - export namespace OpenAIUserMessageParamOutput { - /** - * Text content part for OpenAI-compatible chat completion messages. - */ - export interface OpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - - /** - * Image content part for OpenAI-compatible chat completion messages. - */ - export interface OpenAIChatCompletionContentPartImageParam { - /** - * Image URL specification and processing details. - */ - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - /** - * Must be 'image_url' to identify this as image content. - */ - type?: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - /** - * Image URL specification and processing details. - */ - export interface ImageURL { - /** - * URL of the image to include in the message. - */ - url: string; - - /** - * Level of detail for image processing. Can be 'low', 'high', or 'auto'. - */ - detail?: 'low' | 'high' | 'auto' | null; - } - } - - export interface OpenAIFile { - /** - * File specification. - */ - file: OpenAIFile.File; - - /** - * Must be 'file' to identify this as file content. - */ - type?: 'file'; - } - - export namespace OpenAIFile { - /** - * File specification. - */ - export interface File { - /** - * Base64-encoded file data. - */ - file_data?: string | null; - - /** - * ID of an uploaded file. - */ - file_id?: string | null; - - /** - * Name of the file. - */ - filename?: string | null; - } - } - } - - /** - * A system message providing instructions or context to the model. + * The message from the model. */ - export interface OpenAISystemMessageParam { - /** - * The content of the 'system prompt'. If multiple system messages are provided, - * they are concatenated. - */ - content: string | Array; - + export interface Message { /** - * The name of the system message participant. + * Annotations for the message, when applicable. */ - name?: string | null; + annotations?: Array<{ [key: string]: unknown }>; /** - * Must be 'system' to identify this as a system message. + * Audio response data when using audio output modality. */ - role?: 'system'; - } + audio?: { [key: string]: unknown } | null; - export namespace OpenAISystemMessageParam { /** - * Text content part for OpenAI-compatible chat completion messages. + * The content of the message. */ - export interface ListOpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - } + content?: string | null; - /** - * A message containing the model's (assistant) response in an OpenAI-compatible - * chat completion request. - */ - export interface OpenAIAssistantMessageParamOutput { /** - * The content of the model's response. + * Deprecated: the name and arguments of a function that should be called. */ - content?: - | string - | Array - | null; + function_call?: Message.FunctionCall; /** - * The name of the assistant message participant. + * The refusal message generated by the model. */ - name?: string | null; + refusal?: string | null; /** - * Must be 'assistant' to identify this as the model's response. + * The role of the message author, always 'assistant' in responses. */ role?: 'assistant'; /** - * List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object. + * The tool calls generated by the model. */ - tool_calls?: Array | null; + tool_calls?: Array; } - export namespace OpenAIAssistantMessageParamOutput { + export namespace Message { /** - * Text content part for OpenAI-compatible chat completion messages. + * Deprecated: the name and arguments of a function that should be called. */ - export interface ListOpenAIChatCompletionContentPartTextParam { + export interface FunctionCall { /** - * The text content of the message. + * Arguments to pass to the function as a JSON string. */ - text: string; + arguments?: string | null; /** - * Must be 'text' to identify this as text content. + * Name of the function to call. */ - type?: 'text'; + name?: string | null; } /** @@ -1819,81 +1261,6 @@ export namespace CompletionListResponse { } } - /** - * A message representing the result of a tool invocation in an OpenAI-compatible - * chat completion request. - */ - export interface OpenAIToolMessageParam { - /** - * The response content from the tool. - */ - content: string | Array; - - /** - * Unique identifier for the tool call this response is for. - */ - tool_call_id: string; - - /** - * Must be 'tool' to identify this as a tool response. - */ - role?: 'tool'; - } - - export namespace OpenAIToolMessageParam { - /** - * Text content part for OpenAI-compatible chat completion messages. - */ - export interface ListOpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - } - - /** - * A message from the developer in an OpenAI-compatible chat completion request. - */ - export interface OpenAIDeveloperMessageParam { - /** - * The content of the developer message. - */ - content: string | Array; - - /** - * The name of the developer message participant. - */ - name?: string | null; - - /** - * Must be 'developer' to identify this as a developer message. - */ - role?: 'developer'; - } - - export namespace OpenAIDeveloperMessageParam { - /** - * Text content part for OpenAI-compatible chat completion messages. - */ - export interface ListOpenAIChatCompletionContentPartTextParam { - /** - * The text content of the message. - */ - text: string; - - /** - * Must be 'text' to identify this as text content. - */ - type?: 'text'; - } - } - /** * The log probabilities for the tokens in the message from an OpenAI-compatible * chat completion response. @@ -2322,54 +1689,54 @@ export namespace CompletionListResponse { } /** - * Usage information for OpenAI chat completion. + * Token usage information for the completion. */ export interface Usage { /** * Number of tokens in the completion. */ - completion_tokens: number; + completion_tokens?: number; /** - * Number of tokens in the prompt. + * Detailed breakdown of output token usage. */ - prompt_tokens: number; + completion_tokens_details?: Usage.CompletionTokensDetails; /** - * Total tokens used (prompt + completion). + * Number of tokens in the prompt. */ - total_tokens: number; + prompt_tokens?: number; /** - * Token details for output tokens in OpenAI chat completion usage. + * Detailed breakdown of input token usage. */ - completion_tokens_details?: Usage.CompletionTokensDetails | null; + prompt_tokens_details?: Usage.PromptTokensDetails; /** - * Token details for prompt tokens in OpenAI chat completion usage. + * Total tokens used (prompt + completion). */ - prompt_tokens_details?: Usage.PromptTokensDetails | null; + total_tokens?: number; } export namespace Usage { /** - * Token details for output tokens in OpenAI chat completion usage. + * Detailed breakdown of output token usage. */ export interface CompletionTokensDetails { /** * Number of tokens used for reasoning (o1/o3 models). */ - reasoning_tokens?: number | null; + reasoning_tokens?: number; } /** - * Token details for prompt tokens in OpenAI chat completion usage. + * Detailed breakdown of input token usage. */ export interface PromptTokensDetails { /** * Number of tokens retrieved from cache. */ - cached_tokens?: number | null; + cached_tokens?: number; } } } @@ -2444,6 +1811,11 @@ export interface CompletionCreateParamsBase { */ presence_penalty?: number | null; + /** + * A key to use when reading from or writing to the prompt cache. + */ + prompt_cache_key?: string | null; + /** * The effort level for reasoning models. */ @@ -2468,6 +1840,11 @@ export interface CompletionCreateParamsBase { */ seed?: number | null; + /** + * The service tier for the request. + */ + service_tier?: 'auto' | 'default' | 'flex' | 'priority' | null; + /** * The stop tokens to use. */ @@ -2916,7 +2293,7 @@ export interface CompletionListParams { model?: string | null; /** - * Sort order for paginated responses. + * The order to sort the chat completions by: "asc" or "desc". Defaults to "desc". */ order?: 'asc' | 'desc' | null; } diff --git a/src/resources/files.ts b/src/resources/files.ts index f127f6d..6c016d3 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -186,12 +186,12 @@ export namespace FileCreateParams { export interface FileListParams extends OpenAICursorPageParams { /** - * Sort order for paginated responses. + * Sort order by created_at timestamp ('asc' or 'desc'). */ order?: 'asc' | 'desc' | null; /** - * Valid purpose values for OpenAI Files API. + * Filter files by purpose. */ purpose?: 'assistants' | 'batch' | null; } diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index 74e3c29..fc48c46 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -618,7 +618,7 @@ export interface InputItemListParams { limit?: number | null; /** - * Sort order for paginated responses. + * The order to return the input items in. */ order?: 'asc' | 'desc' | null; } diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 594651e..8680b22 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -104,6 +104,8 @@ export interface ResponseObject { store: boolean; + background?: boolean; + completed_at?: number | null; /** @@ -111,6 +113,11 @@ export interface ResponseObject { */ error?: ResponseObject.Error | null; + /** + * Details explaining why a response was incomplete. + */ + incomplete_details?: ResponseObject.IncompleteDetails | null; + instructions?: string | null; max_output_tokens?: number | null; @@ -130,6 +137,8 @@ export interface ResponseObject { */ prompt?: ResponseObject.Prompt | null; + prompt_cache_key?: string | null; + /** * Configuration for reasoning effort in OpenAI responses. * @@ -139,6 +148,8 @@ export interface ResponseObject { safety_identifier?: string | null; + service_tier?: string | null; + temperature?: number | null; /** @@ -499,6 +510,13 @@ export namespace ResponseObject { message: string; } + /** + * Details explaining why a response was incomplete. + */ + export interface IncompleteDetails { + reason: string; + } + /** * OpenAI compatible Prompt object that is used in OpenAI responses. */ @@ -2472,6 +2490,8 @@ export interface ResponseListResponse { store: boolean; + background?: boolean; + completed_at?: number | null; /** @@ -2479,6 +2499,11 @@ export interface ResponseListResponse { */ error?: ResponseListResponse.Error | null; + /** + * Details explaining why a response was incomplete. + */ + incomplete_details?: ResponseListResponse.IncompleteDetails | null; + instructions?: string | null; max_output_tokens?: number | null; @@ -2498,6 +2523,8 @@ export interface ResponseListResponse { */ prompt?: ResponseListResponse.Prompt | null; + prompt_cache_key?: string | null; + /** * Configuration for reasoning effort in OpenAI responses. * @@ -2507,6 +2534,8 @@ export interface ResponseListResponse { safety_identifier?: string | null; + service_tier?: string | null; + temperature?: number | null; /** @@ -3400,6 +3429,13 @@ export namespace ResponseListResponse { message: string; } + /** + * Details explaining why a response was incomplete. + */ + export interface IncompleteDetails { + reason: string; + } + /** * OpenAI compatible Prompt object that is used in OpenAI responses. */ @@ -3748,6 +3784,12 @@ export interface ResponseCreateParamsBase { */ model: string; + /** + * Whether to run the model response in the background. When true, returns + * immediately with status 'queued'. + */ + background?: boolean; + /** * Optional ID of a conversation to add the response to. */ @@ -3811,6 +3853,11 @@ export interface ResponseCreateParamsBase { */ prompt?: ResponseCreateParams.Prompt | null; + /** + * A key to use when reading from or writing to the prompt cache. + */ + prompt_cache_key?: string | null; + /** * Configuration for reasoning effort in OpenAI responses. * @@ -3823,6 +3870,11 @@ export interface ResponseCreateParamsBase { */ safety_identifier?: string | null; + /** + * The service tier for the request. + */ + service_tier?: 'auto' | 'default' | 'flex' | 'priority' | null; + /** * Whether to store the response in the database. */ @@ -3867,6 +3919,12 @@ export interface ResponseCreateParamsBase { | ResponseCreateParams.OpenAIResponseInputToolFunction | ResponseCreateParams.OpenAIResponseInputToolMcp > | null; + + /** + * Controls how the service truncates input when it exceeds the model context + * window. + */ + truncation?: 'auto' | 'disabled' | null; } export namespace ResponseCreateParams { @@ -4540,7 +4598,7 @@ export interface ResponseListParams extends OpenAICursorPageParams { model?: string | null; /** - * Sort order for paginated responses. + * The order to sort responses by when sorted by created_at ('asc' or 'desc'). */ order?: 'asc' | 'desc' | null; } diff --git a/src/resources/vector-stores/file-batches.ts b/src/resources/vector-stores/file-batches.ts index 0bd7fef..c6edd14 100644 --- a/src/resources/vector-stores/file-batches.ts +++ b/src/resources/vector-stores/file-batches.ts @@ -141,6 +141,7 @@ export interface FileBatchCreateParams { chunking_strategy?: | FileBatchCreateParams.VectorStoreChunkingStrategyAuto | FileBatchCreateParams.VectorStoreChunkingStrategyStatic + | FileBatchCreateParams.VectorStoreChunkingStrategyContextual | null; [k: string]: unknown; @@ -176,6 +177,62 @@ export namespace FileBatchCreateParams { max_chunk_size_tokens?: number; } } + + /** + * Contextual chunking strategy that uses an LLM to situate chunks within the + * document. + */ + export interface VectorStoreChunkingStrategyContextual { + /** + * Configuration for contextual chunking. + */ + contextual: VectorStoreChunkingStrategyContextual.Contextual; + + /** + * Strategy type identifier. + */ + type?: 'contextual'; + } + + export namespace VectorStoreChunkingStrategyContextual { + /** + * Configuration for contextual chunking. + */ + export interface Contextual { + /** + * Tokens to overlap between adjacent chunks. Must be less than + * max_chunk_size_tokens. + */ + chunk_overlap_tokens?: number; + + /** + * Prompt template for contextual retrieval. Uses WHOLE_DOCUMENT and CHUNK_CONTENT + * placeholders wrapped in double curly braces. + */ + context_prompt?: string; + + /** + * Maximum tokens per chunk. Suggested ~700 to allow room for prepended context. + */ + max_chunk_size_tokens?: number; + + /** + * Maximum concurrent LLM calls. Falls back to config default if not provided. + */ + max_concurrency?: number | null; + + /** + * LLM model for generating context. Falls back to + * VectorStoresConfig.contextual_retrieval_params.model if not provided. + */ + model_id?: string | null; + + /** + * Timeout per LLM call in seconds. Falls back to config default if not provided. + */ + timeout_seconds?: number | null; + } + } } export interface FileBatchListFilesParams extends OpenAICursorPageParams { diff --git a/src/resources/vector-stores/files.ts b/src/resources/vector-stores/files.ts index 06b63e0..a4ceebc 100644 --- a/src/resources/vector-stores/files.ts +++ b/src/resources/vector-stores/files.ts @@ -127,7 +127,8 @@ export interface VectorStoreFile { */ chunking_strategy: | VectorStoreFile.VectorStoreChunkingStrategyAuto - | VectorStoreFile.VectorStoreChunkingStrategyStatic; + | VectorStoreFile.VectorStoreChunkingStrategyStatic + | VectorStoreFile.VectorStoreChunkingStrategyContextual; created_at: number; @@ -185,6 +186,62 @@ export namespace VectorStoreFile { } } + /** + * Contextual chunking strategy that uses an LLM to situate chunks within the + * document. + */ + export interface VectorStoreChunkingStrategyContextual { + /** + * Configuration for contextual chunking. + */ + contextual: VectorStoreChunkingStrategyContextual.Contextual; + + /** + * Strategy type identifier. + */ + type?: 'contextual'; + } + + export namespace VectorStoreChunkingStrategyContextual { + /** + * Configuration for contextual chunking. + */ + export interface Contextual { + /** + * Tokens to overlap between adjacent chunks. Must be less than + * max_chunk_size_tokens. + */ + chunk_overlap_tokens?: number; + + /** + * Prompt template for contextual retrieval. Uses WHOLE_DOCUMENT and CHUNK_CONTENT + * placeholders wrapped in double curly braces. + */ + context_prompt?: string; + + /** + * Maximum tokens per chunk. Suggested ~700 to allow room for prepended context. + */ + max_chunk_size_tokens?: number; + + /** + * Maximum concurrent LLM calls. Falls back to config default if not provided. + */ + max_concurrency?: number | null; + + /** + * LLM model for generating context. Falls back to + * VectorStoresConfig.contextual_retrieval_params.model if not provided. + */ + model_id?: string | null; + + /** + * Timeout per LLM call in seconds. Falls back to config default if not provided. + */ + timeout_seconds?: number | null; + } + } + /** * Error information for failed vector store file processing. */ @@ -291,6 +348,7 @@ export interface FileCreateParams { chunking_strategy?: | FileCreateParams.VectorStoreChunkingStrategyAuto | FileCreateParams.VectorStoreChunkingStrategyStatic + | FileCreateParams.VectorStoreChunkingStrategyContextual | null; } @@ -324,6 +382,62 @@ export namespace FileCreateParams { max_chunk_size_tokens?: number; } } + + /** + * Contextual chunking strategy that uses an LLM to situate chunks within the + * document. + */ + export interface VectorStoreChunkingStrategyContextual { + /** + * Configuration for contextual chunking. + */ + contextual: VectorStoreChunkingStrategyContextual.Contextual; + + /** + * Strategy type identifier. + */ + type?: 'contextual'; + } + + export namespace VectorStoreChunkingStrategyContextual { + /** + * Configuration for contextual chunking. + */ + export interface Contextual { + /** + * Tokens to overlap between adjacent chunks. Must be less than + * max_chunk_size_tokens. + */ + chunk_overlap_tokens?: number; + + /** + * Prompt template for contextual retrieval. Uses WHOLE_DOCUMENT and CHUNK_CONTENT + * placeholders wrapped in double curly braces. + */ + context_prompt?: string; + + /** + * Maximum tokens per chunk. Suggested ~700 to allow room for prepended context. + */ + max_chunk_size_tokens?: number; + + /** + * Maximum concurrent LLM calls. Falls back to config default if not provided. + */ + max_concurrency?: number | null; + + /** + * LLM model for generating context. Falls back to + * VectorStoresConfig.contextual_retrieval_params.model if not provided. + */ + model_id?: string | null; + + /** + * Timeout per LLM call in seconds. Falls back to config default if not provided. + */ + timeout_seconds?: number | null; + } + } } export interface FileUpdateParams { diff --git a/src/resources/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts index 06897d2..b1a1a7d 100644 --- a/src/resources/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -266,6 +266,7 @@ export interface VectorStoreCreateParams { chunking_strategy?: | VectorStoreCreateParams.VectorStoreChunkingStrategyAuto | VectorStoreCreateParams.VectorStoreChunkingStrategyStatic + | VectorStoreCreateParams.VectorStoreChunkingStrategyContextual | null; expires_after?: { [key: string]: unknown } | null; @@ -309,6 +310,62 @@ export namespace VectorStoreCreateParams { max_chunk_size_tokens?: number; } } + + /** + * Contextual chunking strategy that uses an LLM to situate chunks within the + * document. + */ + export interface VectorStoreChunkingStrategyContextual { + /** + * Configuration for contextual chunking. + */ + contextual: VectorStoreChunkingStrategyContextual.Contextual; + + /** + * Strategy type identifier. + */ + type?: 'contextual'; + } + + export namespace VectorStoreChunkingStrategyContextual { + /** + * Configuration for contextual chunking. + */ + export interface Contextual { + /** + * Tokens to overlap between adjacent chunks. Must be less than + * max_chunk_size_tokens. + */ + chunk_overlap_tokens?: number; + + /** + * Prompt template for contextual retrieval. Uses WHOLE_DOCUMENT and CHUNK_CONTENT + * placeholders wrapped in double curly braces. + */ + context_prompt?: string; + + /** + * Maximum tokens per chunk. Suggested ~700 to allow room for prepended context. + */ + max_chunk_size_tokens?: number; + + /** + * Maximum concurrent LLM calls. Falls back to config default if not provided. + */ + max_concurrency?: number | null; + + /** + * LLM model for generating context. Falls back to + * VectorStoresConfig.contextual_retrieval_params.model if not provided. + */ + model_id?: string | null; + + /** + * Timeout per LLM call in seconds. Falls back to config default if not provided. + */ + timeout_seconds?: number | null; + } + } } export interface VectorStoreUpdateParams { diff --git a/src/streaming.ts b/src/streaming.ts index 9b25156..b62513c 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -39,7 +39,7 @@ export class Stream implements AsyncIterable { try { for await (const sse of _iterSSEMessages(response, controller)) { try { - yield JSON.parse(sse.data); + yield JSON.parse(sse.data) as Item; } catch (e) { console.error(`Could not parse message into JSON:`, sse.data); console.error(`From chunk:`, sse.raw); diff --git a/src/version.ts b/src/version.ts index 9fbc97f..23b3555 100644 --- a/src/version.ts +++ b/src/version.ts @@ -4,4 +4,4 @@ // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. -export const VERSION = '0.5.0-alpha.2'; // x-release-please-version +export const VERSION = '0.5.0-alpha.3'; // x-release-please-version diff --git a/tests/api-resources/alpha/post-training/job.test.ts b/tests/api-resources/alpha/post-training/job.test.ts index 65b8717..1cb9288 100644 --- a/tests/api-resources/alpha/post-training/job.test.ts +++ b/tests/api-resources/alpha/post-training/job.test.ts @@ -31,7 +31,7 @@ describe('resource job', () => { }); test('artifacts', async () => { - const responsePromise = client.alpha.postTraining.job.artifacts(); + const responsePromise = client.alpha.postTraining.job.artifacts('job_uuid'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -44,12 +44,12 @@ describe('resource job', () => { test('artifacts: request options instead of params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error await expect( - client.alpha.postTraining.job.artifacts({ path: '/_stainless_unknown_path' }), + client.alpha.postTraining.job.artifacts('job_uuid', { path: '/_stainless_unknown_path' }), ).rejects.toThrow(LlamaStackClient.NotFoundError); }); test('cancel', async () => { - const responsePromise = client.alpha.postTraining.job.cancel(); + const responsePromise = client.alpha.postTraining.job.cancel('job_uuid'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -61,13 +61,13 @@ describe('resource job', () => { test('cancel: request options instead of params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.alpha.postTraining.job.cancel({ path: '/_stainless_unknown_path' })).rejects.toThrow( - LlamaStackClient.NotFoundError, - ); + await expect( + client.alpha.postTraining.job.cancel('job_uuid', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(LlamaStackClient.NotFoundError); }); test('status', async () => { - const responsePromise = client.alpha.postTraining.job.status(); + const responsePromise = client.alpha.postTraining.job.status('job_uuid'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -79,8 +79,8 @@ describe('resource job', () => { test('status: request options instead of params are passed correctly', async () => { // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.alpha.postTraining.job.status({ path: '/_stainless_unknown_path' })).rejects.toThrow( - LlamaStackClient.NotFoundError, - ); + await expect( + client.alpha.postTraining.job.status('job_uuid', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(LlamaStackClient.NotFoundError); }); }); diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index 204665d..10c71b7 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -46,10 +46,12 @@ describe('resource completions', () => { n: 1, parallel_tool_calls: true, presence_penalty: -2, + prompt_cache_key: 'prompt_cache_key', reasoning_effort: 'none', response_format: { type: 'text' }, safety_identifier: 'safety_identifier', seed: 0, + service_tier: 'auto', stop: 'string', stream: false, stream_options: { foo: 'bar' }, diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index a3d8d40..771edaf 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -27,6 +27,7 @@ describe('resource responses', () => { const response = await client.responses.create({ input: 'string', model: 'model', + background: true, conversation: 'conversation', guardrails: ['string'], include: ['web_search_call.action.sources'], @@ -42,8 +43,10 @@ describe('resource responses', () => { variables: { foo: { text: 'text', type: 'input_text' } }, version: 'version', }, + prompt_cache_key: 'prompt_cache_key', reasoning: { effort: 'none' }, safety_identifier: 'safety_identifier', + service_tier: 'auto', store: true, stream: false, temperature: 0, @@ -58,6 +61,7 @@ describe('resource responses', () => { }, tool_choice: 'auto', tools: [{ search_context_size: 'S?oC"high', type: 'web_search' }], + truncation: 'auto', }); }); diff --git a/tests/api-resources/vector-stores/file-batches.test.ts b/tests/api-resources/vector-stores/file-batches.test.ts index 119ff19..effbf70 100644 --- a/tests/api-resources/vector-stores/file-batches.test.ts +++ b/tests/api-resources/vector-stores/file-batches.test.ts @@ -103,7 +103,7 @@ describe('resource fileBatches', () => { after: 'after', before: 'before', filter: 'filter', - limit: 0, + limit: 1, order: 'order', }, { path: '/_stainless_unknown_path' }, diff --git a/tests/api-resources/vector-stores/files.test.ts b/tests/api-resources/vector-stores/files.test.ts index 9fc72a0..860e9b0 100644 --- a/tests/api-resources/vector-stores/files.test.ts +++ b/tests/api-resources/vector-stores/files.test.ts @@ -95,7 +95,7 @@ describe('resource files', () => { after: 'after', before: 'before', filter: 'completed', - limit: 0, + limit: 1, order: 'order', }, { path: '/_stainless_unknown_path' }, diff --git a/tests/api-resources/vector-stores/vector-stores.test.ts b/tests/api-resources/vector-stores/vector-stores.test.ts index c089ca8..88c9f33 100644 --- a/tests/api-resources/vector-stores/vector-stores.test.ts +++ b/tests/api-resources/vector-stores/vector-stores.test.ts @@ -77,7 +77,7 @@ describe('resource vectorStores', () => { { after: 'after', before: 'before', - limit: 0, + limit: 1, order: 'order', }, { path: '/_stainless_unknown_path' },