diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 17473a2..ca1d94e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.3" + ".": "0.2.17" } diff --git a/.stats.yml b/.stats.yml index fe4493c..bd77bef 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-df7a19394e9124c18ec4e888e2856d22b5ebfd6fe6fe6e929ff6cfadb2ae7e2a.yml -openapi_spec_hash: 9428682672fdd7e2afee7af9ef849dc9 -config_hash: e1d37a77a6e8ca86fb6bccb4b0f172c9 +configured_endpoints: 106 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f59f1c7d33001d60b5190f68aa49eacec90f05dbe694620b8916152c3922051d.yml +openapi_spec_hash: 804edd2e834493906dc430145402be3b +config_hash: de16e52db65de71ac35adcdb665a74f5 diff --git a/CHANGELOG.md b/CHANGELOG.md index ae26d60..f3992c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,48 @@ # Changelog +## 0.2.17 (2025-08-06) + +Full Changelog: [v0.2.15...v0.2.17](https://github.com/llamastack/llama-stack-client-typescript/compare/v0.2.15...v0.2.17) + +### Features + +* **api:** update via SDK Studio ([9803419](https://github.com/llamastack/llama-stack-client-typescript/commit/98034195897ff31be9164761450bcab933e381cc)) +* **api:** update via SDK Studio ([57bb86c](https://github.com/llamastack/llama-stack-client-typescript/commit/57bb86c95fa5925661f243fb9c9e953ac451a392)) +* **api:** update via SDK Studio ([40c2189](https://github.com/llamastack/llama-stack-client-typescript/commit/40c218958db8991a7483ed9ace4242d171770d42)) +* **api:** update via SDK Studio ([26b572d](https://github.com/llamastack/llama-stack-client-typescript/commit/26b572d92a150ef1ee25ec6efd0e9bd38f321072)) +* **api:** update via SDK Studio ([8a48a6f](https://github.com/llamastack/llama-stack-client-typescript/commit/8a48a6fe63d13817953c2acb4fbf5b4ab6136f4a)) +* **api:** update via SDK Studio ([3ea8a73](https://github.com/llamastack/llama-stack-client-typescript/commit/3ea8a73c9d8e66bbc3650aa7e6a19a4ce07f30c5)) +* **api:** update via SDK Studio ([cddd18f](https://github.com/llamastack/llama-stack-client-typescript/commit/cddd18fb70e3830d7062d12aab4754c3e598bbd2)) +* **api:** update via SDK Studio ([fc4fbf9](https://github.com/llamastack/llama-stack-client-typescript/commit/fc4fbf94810db7f89288cc36780d2616c8fc715a)) +* **api:** update via SDK Studio ([2a981d4](https://github.com/llamastack/llama-stack-client-typescript/commit/2a981d45f801bdf82e43c6d7d7c6674cc03cadc3)) +* **api:** update via SDK Studio ([14544ce](https://github.com/llamastack/llama-stack-client-typescript/commit/14544ce36d7a33509af85783a421d9c1995e22d1)) +* **api:** update via SDK Studio ([57c0764](https://github.com/llamastack/llama-stack-client-typescript/commit/57c07641906fc04eb9eadfd12f672e28a3a2efbc)) +* **api:** update via SDK Studio ([426728c](https://github.com/llamastack/llama-stack-client-typescript/commit/426728c7f86ce3385eb8c116f41a5b192abd5d0c)) + + +### Bug Fixes + +* **ci:** update version, skip a failing test ([#4](https://github.com/llamastack/llama-stack-client-typescript/issues/4)) ([7a5dbe7](https://github.com/llamastack/llama-stack-client-typescript/commit/7a5dbe7ed59b24feda5d73df8808fde2d337fc2a)) +* **client:** don't send `Content-Type` for bodyless methods ([6806e8e](https://github.com/llamastack/llama-stack-client-typescript/commit/6806e8ef31302a0f2ca0ab9ae36e4781e5f0adf7)) + + +### Chores + +* **internal:** codegen related update ([267a378](https://github.com/llamastack/llama-stack-client-typescript/commit/267a378b1999abd5f17f08b5792ee99d9c405439)) +* **internal:** codegen related update ([79e7896](https://github.com/llamastack/llama-stack-client-typescript/commit/79e78969a31df16ef35901c3ce4c003f70d59778)) +* **internal:** remove redundant imports config ([f19eb25](https://github.com/llamastack/llama-stack-client-typescript/commit/f19eb258d836c7de4fb719c62dabcbfb502ecc6c)) +* make some internal functions async ([e2797ae](https://github.com/llamastack/llama-stack-client-typescript/commit/e2797ae1e88960ffa5b13a89103d4ee9972803f9)) +* **mcp:** rework imports in tools ([9486e73](https://github.com/llamastack/llama-stack-client-typescript/commit/9486e7319d36cb8efe86568884057c65e91d84b2)) +* mention unit type in timeout docs ([c2b9867](https://github.com/llamastack/llama-stack-client-typescript/commit/c2b986793dd9f2fa55e8f4ce9c463a4d99635ab4)) + + +### Build System + +* Bump version to 0.2.14 ([4d2c696](https://github.com/llamastack/llama-stack-client-typescript/commit/4d2c696b916c9868be61fff31f008442cb346eca)) +* Bump version to 0.2.15 ([6645f62](https://github.com/llamastack/llama-stack-client-typescript/commit/6645f629844fd24b7e8b8fab9089cf1ba7cb9352)) +* Bump version to 0.2.16 ([fe9ab2e](https://github.com/llamastack/llama-stack-client-typescript/commit/fe9ab2e081df8f9f254b74e3bc42ac880dda765f)) +* Bump version to 0.2.17 ([7da4cca](https://github.com/llamastack/llama-stack-client-typescript/commit/7da4cca39c982d6f3f07fa09a9428983d233bc5e)) + ## 0.1.0-alpha.3 (2025-06-28) Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/llamastack/llama-stack-client-typescript/compare/v0.1.0-alpha.2...v0.1.0-alpha.3) diff --git a/LICENSE b/LICENSE index f90a0a8..1ace7ad 100644 --- a/LICENSE +++ b/LICENSE @@ -1,201 +1,7 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ +Copyright 2025 llama-stack-client - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +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: - 1. Definitions. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2025 Llama Stack Client - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/api.md b/api.md index f89c31c..df16b33 100644 --- a/api.md +++ b/api.md @@ -403,6 +403,16 @@ Methods: - client.routes.list() -> RouteListResponse +# Moderations + +Types: + +- CreateResponse + +Methods: + +- client.moderations.create({ ...params }) -> CreateResponse + # Safety Types: diff --git a/package.json b/package.json index a4e710f..19cb1a3 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "main": "dist/index.js", "type": "commonjs", "repository": "github:llamastack/llama-stack-client-typescript", - "license": "Apache-2.0", + "license": "MIT", "packageManager": "yarn@1.22.22", "files": [ "**/*" @@ -58,10 +58,6 @@ "./shims/web.js", "./shims/web.mjs" ], - "imports": { - "llama-stack-client": ".", - "llama-stack-client/*": "./src/*" - }, "exports": { "./_shims/auto/*": { "deno": { diff --git a/src/core.ts b/src/core.ts index 6cd9d53..19986c7 100644 --- a/src/core.ts +++ b/src/core.ts @@ -231,7 +231,7 @@ export abstract class APIClient { protected defaultHeaders(opts: FinalRequestOptions): Headers { return { Accept: 'application/json', - 'Content-Type': 'application/json', + ...(['head', 'get'].includes(opts.method) ? {} : { 'Content-Type': 'application/json' }), 'User-Agent': this.getUserAgent(), ...getPlatformHeaders(), ...this.authHeaders(opts), @@ -313,10 +313,10 @@ export abstract class APIClient { return null; } - buildRequest( + async buildRequest( inputOptions: FinalRequestOptions, { retryCount = 0 }: { retryCount?: number } = {}, - ): { req: RequestInit; url: string; timeout: number } { + ): Promise<{ req: RequestInit; url: string; timeout: number }> { const options = { ...inputOptions }; const { method, path, query, defaultBaseURL, headers: headers = {} } = options; @@ -464,7 +464,9 @@ export abstract class APIClient { await this.prepareOptions(options); - const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining }); + const { req, url, timeout } = await this.buildRequest(options, { + retryCount: maxRetries - retriesRemaining, + }); await this.prepareRequest(req, { url, options }); diff --git a/src/index.ts b/src/index.ts index 37945eb..042239d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -68,6 +68,7 @@ import { ModelRegisterParams, Models, } from './resources/models'; +import { CreateResponse, ModerationCreateParams, Moderations } from './resources/moderations'; import { ListProvidersResponse, ProviderListResponse, Providers } from './resources/providers'; import { ListRoutesResponse, RouteListResponse, Routes } from './resources/routes'; import { RunShieldResponse, Safety, SafetyRunShieldParams } from './resources/safety'; @@ -219,6 +220,8 @@ export interface ClientOptions { * * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. + * + * @unit milliseconds */ timeout?: number | undefined; @@ -327,6 +330,7 @@ export class LlamaStackClient extends Core.APIClient { postTraining: API.PostTraining = new API.PostTraining(this); providers: API.Providers = new API.Providers(this); routes: API.Routes = new API.Routes(this); + moderations: API.Moderations = new API.Moderations(this); safety: API.Safety = new API.Safety(this); shields: API.Shields = new API.Shields(this); syntheticDataGeneration: API.SyntheticDataGeneration = new API.SyntheticDataGeneration(this); @@ -405,6 +409,7 @@ LlamaStackClient.Models = Models; LlamaStackClient.PostTraining = PostTraining; LlamaStackClient.Providers = Providers; LlamaStackClient.Routes = Routes; +LlamaStackClient.Moderations = Moderations; LlamaStackClient.Safety = Safety; LlamaStackClient.Shields = Shields; LlamaStackClient.SyntheticDataGeneration = SyntheticDataGeneration; @@ -595,6 +600,12 @@ export declare namespace LlamaStackClient { type RouteListResponse as RouteListResponse, }; + export { + Moderations as Moderations, + type CreateResponse as CreateResponse, + type ModerationCreateParams as ModerationCreateParams, + }; + export { Safety as Safety, type RunShieldResponse as RunShieldResponse, diff --git a/src/resources/agents/agents.ts b/src/resources/agents/agents.ts index d845b30..35a4d62 100644 --- a/src/resources/agents/agents.ts +++ b/src/resources/agents/agents.ts @@ -226,31 +226,58 @@ export interface ToolExecutionStep { started_at?: string; } +/** + * Response from a tool invocation. + */ export interface ToolResponse { + /** + * Unique identifier for the tool call this response is for + */ call_id: string; /** - * A image content item + * The response content from the tool */ content: Shared.InterleavedContent; + /** + * Name of the tool that was invoked + */ tool_name: 'brave_search' | 'wolfram_alpha' | 'photogen' | 'code_interpreter' | (string & {}); + /** + * (Optional) Additional metadata about the tool response + */ metadata?: { [key: string]: boolean | number | string | Array | unknown | null }; } +/** + * Response returned when creating a new agent. + */ export interface AgentCreateResponse { + /** + * Unique identifier for the created agent + */ agent_id: string; } +/** + * An agent instance with configuration and metadata. + */ export interface AgentRetrieveResponse { /** - * Configuration for an agent. + * Configuration settings for the agent */ agent_config: Shared.AgentConfig; + /** + * Unique identifier for the agent + */ agent_id: string; + /** + * Timestamp when the agent was created + */ created_at: string; } diff --git a/src/resources/agents/session.ts b/src/resources/agents/session.ts index fa6a6c2..35c8511 100644 --- a/src/resources/agents/session.ts +++ b/src/resources/agents/session.ts @@ -74,16 +74,34 @@ export class SessionResource extends APIResource { * A single session of an interaction with an Agentic System. */ export interface Session { + /** + * Unique identifier for the conversation session + */ session_id: string; + /** + * Human-readable name for the session + */ session_name: string; + /** + * Timestamp when the session was created + */ started_at: string; + /** + * List of all turns that have occurred in this session + */ turns: Array; } +/** + * Response returned when creating a new agent session. + */ export interface SessionCreateResponse { + /** + * Unique identifier for the created session + */ session_id: string; } diff --git a/src/resources/agents/steps.ts b/src/resources/agents/steps.ts index 1abf04b..8d2d821 100644 --- a/src/resources/agents/steps.ts +++ b/src/resources/agents/steps.ts @@ -22,9 +22,12 @@ export class Steps extends APIResource { } } +/** + * Response containing details of a specific agent step. + */ export interface StepRetrieveResponse { /** - * An inference step in an agent turn. + * The complete step data and execution details */ step: | AgentsAPI.InferenceStep diff --git a/src/resources/agents/turn.ts b/src/resources/agents/turn.ts index 8263743..0273625 100644 --- a/src/resources/agents/turn.ts +++ b/src/resources/agents/turn.ts @@ -98,9 +98,12 @@ export class TurnResource extends APIResource { } /** - * streamed agent turn completion response. + * Streamed agent turn completion response. */ export interface AgentTurnResponseStreamChunk { + /** + * Individual event in the agent turn response stream + */ event: TurnResponseEvent; } @@ -108,17 +111,29 @@ export interface AgentTurnResponseStreamChunk { * A single turn in an interaction with an Agentic System. */ export interface Turn { + /** + * List of messages that initiated this turn + */ input_messages: Array; /** - * A message containing the model's (assistant) response in a chat conversation. + * The model's generated response containing content and metadata */ output_message: Shared.CompletionMessage; + /** + * Unique identifier for the conversation session + */ session_id: string; + /** + * Timestamp when the turn began + */ started_at: string; + /** + * Ordered list of processing steps executed during this turn + */ steps: Array< | AgentsAPI.InferenceStep | AgentsAPI.ToolExecutionStep @@ -126,10 +141,19 @@ export interface Turn { | AgentsAPI.MemoryRetrievalStep >; + /** + * Unique identifier for the turn within a session + */ turn_id: string; + /** + * (Optional) Timestamp when the turn finished, if completed + */ completed_at?: string; + /** + * (Optional) Files or media attached to the agent's response + */ output_attachments?: Array; } @@ -193,6 +217,9 @@ export namespace Turn { * Note that URL could have length limits. */ export interface URL { + /** + * The URL string pointing to the resource + */ uri: string; } } @@ -213,16 +240,31 @@ export namespace Turn { type: 'text'; } + /** + * A URL reference to external content. + */ export interface URL { + /** + * The URL string pointing to the resource + */ uri: string; } } } +/** + * An event in an agent turn response stream. + */ export interface TurnResponseEvent { + /** + * Event-specific payload containing event data + */ payload: TurnResponseEventPayload; } +/** + * Payload for step start events in agent turn responses. + */ export type TurnResponseEventPayload = | TurnResponseEventPayload.AgentTurnResponseStepStartPayload | TurnResponseEventPayload.AgentTurnResponseStepProgressPayload @@ -232,37 +274,67 @@ export type TurnResponseEventPayload = | TurnResponseEventPayload.AgentTurnResponseTurnAwaitingInputPayload; export namespace TurnResponseEventPayload { + /** + * Payload for step start events in agent turn responses. + */ export interface AgentTurnResponseStepStartPayload { + /** + * Type of event being reported + */ event_type: 'step_start'; + /** + * Unique identifier for the step within a turn + */ step_id: string; /** - * Type of the step in an agent turn. + * Type of step being executed */ step_type: 'inference' | 'tool_execution' | 'shield_call' | 'memory_retrieval'; + /** + * (Optional) Additional metadata for the step + */ metadata?: { [key: string]: boolean | number | string | Array | unknown | null }; } + /** + * Payload for step progress events in agent turn responses. + */ export interface AgentTurnResponseStepProgressPayload { + /** + * Incremental content changes during step execution + */ delta: Shared.ContentDelta; + /** + * Type of event being reported + */ event_type: 'step_progress'; + /** + * Unique identifier for the step within a turn + */ step_id: string; /** - * Type of the step in an agent turn. + * Type of step being executed */ step_type: 'inference' | 'tool_execution' | 'shield_call' | 'memory_retrieval'; } + /** + * Payload for step completion events in agent turn responses. + */ export interface AgentTurnResponseStepCompletePayload { + /** + * Type of event being reported + */ event_type: 'step_complete'; /** - * An inference step in an agent turn. + * Complete details of the executed step */ step_details: | AgentsAPI.InferenceStep @@ -270,34 +342,58 @@ export namespace TurnResponseEventPayload { | AgentsAPI.ShieldCallStep | AgentsAPI.MemoryRetrievalStep; + /** + * Unique identifier for the step within a turn + */ step_id: string; /** - * Type of the step in an agent turn. + * Type of step being executed */ step_type: 'inference' | 'tool_execution' | 'shield_call' | 'memory_retrieval'; } + /** + * Payload for turn start events in agent turn responses. + */ export interface AgentTurnResponseTurnStartPayload { + /** + * Type of event being reported + */ event_type: 'turn_start'; + /** + * Unique identifier for the turn within a session + */ turn_id: string; } + /** + * Payload for turn completion events in agent turn responses. + */ export interface AgentTurnResponseTurnCompletePayload { + /** + * Type of event being reported + */ event_type: 'turn_complete'; /** - * A single turn in an interaction with an Agentic System. + * Complete turn data including all steps and results */ turn: TurnAPI.Turn; } + /** + * Payload for turn awaiting input events in agent turn responses. + */ export interface AgentTurnResponseTurnAwaitingInputPayload { + /** + * Type of event being reported + */ event_type: 'turn_awaiting_input'; /** - * A single turn in an interaction with an Agentic System. + * Turn data when waiting for external tool responses */ turn: TurnAPI.Turn; } @@ -395,6 +491,9 @@ export namespace TurnCreateParams { * Note that URL could have length limits. */ export interface URL { + /** + * The URL string pointing to the resource + */ uri: string; } } @@ -415,7 +514,13 @@ export namespace TurnCreateParams { type: 'text'; } + /** + * A URL reference to external content. + */ export interface URL { + /** + * The URL string pointing to the resource + */ uri: string; } } diff --git a/src/resources/benchmarks.ts b/src/resources/benchmarks.ts index a95494f..b6b8363 100644 --- a/src/resources/benchmarks.ts +++ b/src/resources/benchmarks.ts @@ -32,17 +32,32 @@ export class Benchmarks extends APIResource { } } +/** + * A benchmark resource for evaluating model performance. + */ export interface Benchmark { + /** + * Identifier of the dataset to use for the benchmark evaluation + */ dataset_id: string; identifier: string; + /** + * Metadata for this evaluation task + */ metadata: { [key: string]: boolean | number | string | Array | unknown | null }; provider_id: string; + /** + * List of scoring function identifiers to apply during evaluation + */ scoring_functions: Array; + /** + * The resource type, always benchmark + */ type: 'benchmark'; provider_resource_id?: string; diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 3c693ee..a38445d 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -100,20 +100,44 @@ export namespace ChatCompletionChunk { } export namespace Delta { + /** + * Tool call specification for OpenAI-compatible chat completion responses. + */ export interface ToolCall { + /** + * Must be "function" to identify this as a function call + */ type: 'function'; + /** + * (Optional) Unique identifier for the tool call + */ id?: string; + /** + * (Optional) Function call details + */ function?: ToolCall.Function; + /** + * (Optional) Index of the tool call in the list + */ index?: number; } export namespace ToolCall { + /** + * (Optional) Function call details + */ export interface Function { + /** + * (Optional) Arguments to pass to the function as a JSON string + */ arguments?: string; + /** + * (Optional) Name of the function to call + */ name?: string; } } diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index d103bb7..6331b0a 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -141,6 +141,7 @@ export namespace CompletionCreateResponse { | Array< | OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam + | OpenAIUserMessageParam.OpenAIFile >; /** @@ -155,25 +156,68 @@ export namespace CompletionCreateResponse { } export namespace OpenAIUserMessageParam { + /** + * 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; + /** + * (Optional) Level of detail for image processing. Can be "low", "high", or "auto" + */ detail?: string; } } + + export interface OpenAIFile { + file: OpenAIFile.File; + + type: 'file'; + } + + export namespace OpenAIFile { + export interface File { + file_data?: string; + + file_id?: string; + + filename?: string; + } + } } /** @@ -185,12 +229,7 @@ export namespace CompletionCreateResponse { * they are concatenated. The underlying Llama Stack code may also add other system * messages (for example, for formatting tool definitions). */ - content: - | string - | Array< - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "system" to identify this as a system message @@ -204,25 +243,20 @@ export namespace CompletionCreateResponse { } export namespace OpenAISystemMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -238,12 +272,7 @@ export namespace CompletionCreateResponse { /** * The content of the model's response */ - content?: - | string - | Array< - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content?: string | Array; /** * (Optional) The name of the assistant message participant. @@ -257,40 +286,59 @@ export namespace CompletionCreateResponse { } export namespace OpenAIAssistantMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } - + /** + * Tool call specification for OpenAI-compatible chat completion responses. + */ export interface ToolCall { + /** + * Must be "function" to identify this as a function call + */ type: 'function'; + /** + * (Optional) Unique identifier for the tool call + */ id?: string; + /** + * (Optional) Function call details + */ function?: ToolCall.Function; + /** + * (Optional) Index of the tool call in the list + */ index?: number; } export namespace ToolCall { + /** + * (Optional) Function call details + */ export interface Function { + /** + * (Optional) Arguments to pass to the function as a JSON string + */ arguments?: string; + /** + * (Optional) Name of the function to call + */ name?: string; } } @@ -304,12 +352,7 @@ export namespace CompletionCreateResponse { /** * The response content from the tool */ - content: - | string - | Array< - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "tool" to identify this as a tool response @@ -323,25 +366,20 @@ export namespace CompletionCreateResponse { } export namespace OpenAIToolMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -351,12 +389,7 @@ export namespace CompletionCreateResponse { /** * The content of the developer message */ - content: - | string - | Array< - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "developer" to identify this as a developer message @@ -370,25 +403,20 @@ export namespace CompletionCreateResponse { } export namespace OpenAIDeveloperMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -546,6 +574,7 @@ export namespace CompletionRetrieveResponse { | Array< | OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam + | OpenAIUserMessageParam.OpenAIFile >; /** @@ -560,25 +589,68 @@ export namespace CompletionRetrieveResponse { } export namespace OpenAIUserMessageParam { + /** + * 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; + /** + * (Optional) Level of detail for image processing. Can be "low", "high", or "auto" + */ detail?: string; } } + + export interface OpenAIFile { + file: OpenAIFile.File; + + type: 'file'; + } + + export namespace OpenAIFile { + export interface File { + file_data?: string; + + file_id?: string; + + filename?: string; + } + } } /** @@ -590,12 +662,7 @@ export namespace CompletionRetrieveResponse { * they are concatenated. The underlying Llama Stack code may also add other system * messages (for example, for formatting tool definitions). */ - content: - | string - | Array< - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "system" to identify this as a system message @@ -609,25 +676,20 @@ export namespace CompletionRetrieveResponse { } export namespace OpenAISystemMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -643,12 +705,7 @@ export namespace CompletionRetrieveResponse { /** * The content of the model's response */ - content?: - | string - | Array< - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content?: string | Array; /** * (Optional) The name of the assistant message participant. @@ -662,40 +719,59 @@ export namespace CompletionRetrieveResponse { } export namespace OpenAIAssistantMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } - + /** + * Tool call specification for OpenAI-compatible chat completion responses. + */ export interface ToolCall { + /** + * Must be "function" to identify this as a function call + */ type: 'function'; + /** + * (Optional) Unique identifier for the tool call + */ id?: string; + /** + * (Optional) Function call details + */ function?: ToolCall.Function; + /** + * (Optional) Index of the tool call in the list + */ index?: number; } export namespace ToolCall { + /** + * (Optional) Function call details + */ export interface Function { + /** + * (Optional) Arguments to pass to the function as a JSON string + */ arguments?: string; + /** + * (Optional) Name of the function to call + */ name?: string; } } @@ -709,12 +785,7 @@ export namespace CompletionRetrieveResponse { /** * The response content from the tool */ - content: - | string - | Array< - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "tool" to identify this as a tool response @@ -728,25 +799,20 @@ export namespace CompletionRetrieveResponse { } export namespace OpenAIToolMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -756,12 +822,7 @@ export namespace CompletionRetrieveResponse { /** * The content of the developer message */ - content: - | string - | Array< - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "developer" to identify this as a developer message @@ -775,24 +836,19 @@ export namespace CompletionRetrieveResponse { } export namespace OpenAIDeveloperMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { - text: string; - - type: 'text'; - } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ + text: string; - detail?: string; - } + /** + * Must be "text" to identify this as text content + */ + type: 'text'; } } @@ -882,6 +938,7 @@ export namespace CompletionRetrieveResponse { | Array< | OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam + | OpenAIUserMessageParam.OpenAIFile >; /** @@ -896,25 +953,68 @@ export namespace CompletionRetrieveResponse { } export namespace OpenAIUserMessageParam { + /** + * 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; + /** + * (Optional) Level of detail for image processing. Can be "low", "high", or "auto" + */ detail?: string; } } + + export interface OpenAIFile { + file: OpenAIFile.File; + + type: 'file'; + } + + export namespace OpenAIFile { + export interface File { + file_data?: string; + + file_id?: string; + + filename?: string; + } + } } /** @@ -926,12 +1026,7 @@ export namespace CompletionRetrieveResponse { * they are concatenated. The underlying Llama Stack code may also add other system * messages (for example, for formatting tool definitions). */ - content: - | string - | Array< - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "system" to identify this as a system message @@ -945,25 +1040,20 @@ export namespace CompletionRetrieveResponse { } export namespace OpenAISystemMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -979,12 +1069,7 @@ export namespace CompletionRetrieveResponse { /** * The content of the model's response */ - content?: - | string - | Array< - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content?: string | Array; /** * (Optional) The name of the assistant message participant. @@ -998,40 +1083,59 @@ export namespace CompletionRetrieveResponse { } export namespace OpenAIAssistantMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } - + /** + * Tool call specification for OpenAI-compatible chat completion responses. + */ export interface ToolCall { + /** + * Must be "function" to identify this as a function call + */ type: 'function'; + /** + * (Optional) Unique identifier for the tool call + */ id?: string; + /** + * (Optional) Function call details + */ function?: ToolCall.Function; + /** + * (Optional) Index of the tool call in the list + */ index?: number; } export namespace ToolCall { + /** + * (Optional) Function call details + */ export interface Function { + /** + * (Optional) Arguments to pass to the function as a JSON string + */ arguments?: string; + /** + * (Optional) Name of the function to call + */ name?: string; } } @@ -1045,12 +1149,7 @@ export namespace CompletionRetrieveResponse { /** * The response content from the tool */ - content: - | string - | Array< - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "tool" to identify this as a tool response @@ -1064,25 +1163,20 @@ export namespace CompletionRetrieveResponse { } export namespace OpenAIToolMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -1092,12 +1186,7 @@ export namespace CompletionRetrieveResponse { /** * The content of the developer message */ - content: - | string - | Array< - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "developer" to identify this as a developer message @@ -1111,37 +1200,50 @@ export namespace CompletionRetrieveResponse { } export namespace OpenAIDeveloperMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } } +/** + * Response from listing OpenAI-compatible chat completions. + */ export interface CompletionListResponse { + /** + * List of chat completion objects with their input messages + */ data: Array; + /** + * ID of the first completion in this list + */ first_id: string; + /** + * Whether there are more completions available beyond this list + */ has_more: boolean; + /** + * ID of the last completion in this list + */ last_id: string; + /** + * Must be "list" to identify this as a list response + */ object: 'list'; } @@ -1225,6 +1327,7 @@ export namespace CompletionListResponse { | Array< | OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam + | OpenAIUserMessageParam.OpenAIFile >; /** @@ -1239,25 +1342,68 @@ export namespace CompletionListResponse { } export namespace OpenAIUserMessageParam { + /** + * 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; + /** + * (Optional) Level of detail for image processing. Can be "low", "high", or "auto" + */ detail?: string; } } + + export interface OpenAIFile { + file: OpenAIFile.File; + + type: 'file'; + } + + export namespace OpenAIFile { + export interface File { + file_data?: string; + + file_id?: string; + + filename?: string; + } + } } /** @@ -1269,12 +1415,7 @@ export namespace CompletionListResponse { * they are concatenated. The underlying Llama Stack code may also add other system * messages (for example, for formatting tool definitions). */ - content: - | string - | Array< - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "system" to identify this as a system message @@ -1288,25 +1429,20 @@ export namespace CompletionListResponse { } export namespace OpenAISystemMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -1322,12 +1458,7 @@ export namespace CompletionListResponse { /** * The content of the model's response */ - content?: - | string - | Array< - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content?: string | Array; /** * (Optional) The name of the assistant message participant. @@ -1341,40 +1472,59 @@ export namespace CompletionListResponse { } export namespace OpenAIAssistantMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } - + /** + * Tool call specification for OpenAI-compatible chat completion responses. + */ export interface ToolCall { + /** + * Must be "function" to identify this as a function call + */ type: 'function'; + /** + * (Optional) Unique identifier for the tool call + */ id?: string; + /** + * (Optional) Function call details + */ function?: ToolCall.Function; + /** + * (Optional) Index of the tool call in the list + */ index?: number; } export namespace ToolCall { + /** + * (Optional) Function call details + */ export interface Function { + /** + * (Optional) Arguments to pass to the function as a JSON string + */ arguments?: string; + /** + * (Optional) Name of the function to call + */ name?: string; } } @@ -1388,12 +1538,7 @@ export namespace CompletionListResponse { /** * The response content from the tool */ - content: - | string - | Array< - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "tool" to identify this as a tool response @@ -1407,25 +1552,20 @@ export namespace CompletionListResponse { } export namespace OpenAIToolMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -1435,12 +1575,7 @@ export namespace CompletionListResponse { /** * The content of the developer message */ - content: - | string - | Array< - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "developer" to identify this as a developer message @@ -1454,25 +1589,20 @@ export namespace CompletionListResponse { } export namespace OpenAIDeveloperMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -1561,6 +1691,7 @@ export namespace CompletionListResponse { | Array< | OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam + | OpenAIUserMessageParam.OpenAIFile >; /** @@ -1575,25 +1706,68 @@ export namespace CompletionListResponse { } export namespace OpenAIUserMessageParam { + /** + * 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; + /** + * (Optional) Level of detail for image processing. Can be "low", "high", or "auto" + */ detail?: string; } } + + export interface OpenAIFile { + file: OpenAIFile.File; + + type: 'file'; + } + + export namespace OpenAIFile { + export interface File { + file_data?: string; + + file_id?: string; + + filename?: string; + } + } } /** @@ -1605,12 +1779,7 @@ export namespace CompletionListResponse { * they are concatenated. The underlying Llama Stack code may also add other system * messages (for example, for formatting tool definitions). */ - content: - | string - | Array< - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "system" to identify this as a system message @@ -1624,25 +1793,20 @@ export namespace CompletionListResponse { } export namespace OpenAISystemMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -1658,12 +1822,7 @@ export namespace CompletionListResponse { /** * The content of the model's response */ - content?: - | string - | Array< - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content?: string | Array; /** * (Optional) The name of the assistant message participant. @@ -1677,40 +1836,59 @@ export namespace CompletionListResponse { } export namespace OpenAIAssistantMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } - + /** + * Tool call specification for OpenAI-compatible chat completion responses. + */ export interface ToolCall { + /** + * Must be "function" to identify this as a function call + */ type: 'function'; + /** + * (Optional) Unique identifier for the tool call + */ id?: string; + /** + * (Optional) Function call details + */ function?: ToolCall.Function; + /** + * (Optional) Index of the tool call in the list + */ index?: number; } export namespace ToolCall { + /** + * (Optional) Function call details + */ export interface Function { + /** + * (Optional) Arguments to pass to the function as a JSON string + */ arguments?: string; + /** + * (Optional) Name of the function to call + */ name?: string; } } @@ -1724,12 +1902,7 @@ export namespace CompletionListResponse { /** * The response content from the tool */ - content: - | string - | Array< - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "tool" to identify this as a tool response @@ -1743,25 +1916,20 @@ export namespace CompletionListResponse { } export namespace OpenAIToolMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -1771,12 +1939,7 @@ export namespace CompletionListResponse { /** * The content of the developer message */ - content: - | string - | Array< - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "developer" to identify this as a developer message @@ -1790,25 +1953,20 @@ export namespace CompletionListResponse { } export namespace OpenAIDeveloperMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } } } @@ -1955,6 +2113,7 @@ export namespace CompletionCreateParams { | Array< | OpenAIUserMessageParam.OpenAIChatCompletionContentPartTextParam | OpenAIUserMessageParam.OpenAIChatCompletionContentPartImageParam + | OpenAIUserMessageParam.OpenAIFile >; /** @@ -1969,25 +2128,68 @@ export namespace CompletionCreateParams { } export namespace OpenAIUserMessageParam { + /** + * 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; + /** + * (Optional) Level of detail for image processing. Can be "low", "high", or "auto" + */ detail?: string; } } + + export interface OpenAIFile { + file: OpenAIFile.File; + + type: 'file'; + } + + export namespace OpenAIFile { + export interface File { + file_data?: string; + + file_id?: string; + + filename?: string; + } + } } /** @@ -1999,12 +2201,7 @@ export namespace CompletionCreateParams { * they are concatenated. The underlying Llama Stack code may also add other system * messages (for example, for formatting tool definitions). */ - content: - | string - | Array< - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAISystemMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "system" to identify this as a system message @@ -2018,25 +2215,20 @@ export namespace CompletionCreateParams { } export namespace OpenAISystemMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -2052,12 +2244,7 @@ export namespace CompletionCreateParams { /** * The content of the model's response */ - content?: - | string - | Array< - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIAssistantMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content?: string | Array; /** * (Optional) The name of the assistant message participant. @@ -2071,40 +2258,59 @@ export namespace CompletionCreateParams { } export namespace OpenAIAssistantMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } - + /** + * Tool call specification for OpenAI-compatible chat completion responses. + */ export interface ToolCall { + /** + * Must be "function" to identify this as a function call + */ type: 'function'; + /** + * (Optional) Unique identifier for the tool call + */ id?: string; + /** + * (Optional) Function call details + */ function?: ToolCall.Function; + /** + * (Optional) Index of the tool call in the list + */ index?: number; } export namespace ToolCall { + /** + * (Optional) Function call details + */ export interface Function { + /** + * (Optional) Arguments to pass to the function as a JSON string + */ arguments?: string; + /** + * (Optional) Name of the function to call + */ name?: string; } } @@ -2118,12 +2324,7 @@ export namespace CompletionCreateParams { /** * The response content from the tool */ - content: - | string - | Array< - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIToolMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "tool" to identify this as a tool response @@ -2137,25 +2338,20 @@ export namespace CompletionCreateParams { } export namespace OpenAIToolMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } /** @@ -2165,12 +2361,7 @@ export namespace CompletionCreateParams { /** * The content of the developer message */ - content: - | string - | Array< - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartTextParam - | OpenAIDeveloperMessageParam.OpenAIChatCompletionContentPartImageParam - >; + content: string | Array; /** * Must be "developer" to identify this as a developer message @@ -2184,50 +2375,81 @@ export namespace CompletionCreateParams { } export namespace OpenAIDeveloperMessageParam { - export interface OpenAIChatCompletionContentPartTextParam { + /** + * Text content part for OpenAI-compatible chat completion messages. + */ + export interface UnionMember1 { + /** + * The text content of the message + */ text: string; + /** + * Must be "text" to identify this as text content + */ type: 'text'; } - - export interface OpenAIChatCompletionContentPartImageParam { - image_url: OpenAIChatCompletionContentPartImageParam.ImageURL; - - type: 'image_url'; - } - - export namespace OpenAIChatCompletionContentPartImageParam { - export interface ImageURL { - url: string; - - detail?: string; - } - } } + /** + * Text response format for OpenAI-compatible chat completion requests. + */ export interface OpenAIResponseFormatText { + /** + * Must be "text" to indicate plain text response format + */ type: 'text'; } + /** + * JSON schema response format for OpenAI-compatible chat completion requests. + */ export interface OpenAIResponseFormatJsonSchema { + /** + * The JSON schema specification for the response + */ json_schema: OpenAIResponseFormatJsonSchema.JsonSchema; + /** + * Must be "json_schema" to indicate structured JSON response format + */ type: 'json_schema'; } export namespace OpenAIResponseFormatJsonSchema { + /** + * The JSON schema specification for the response + */ export interface JsonSchema { + /** + * Name of the schema + */ name: string; + /** + * (Optional) Description of the schema + */ description?: string; + /** + * (Optional) The JSON schema definition + */ schema?: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * (Optional) Whether to enforce strict adherence to the schema + */ strict?: boolean; } } + /** + * JSON object response format for OpenAI-compatible chat completion requests. + */ export interface OpenAIResponseFormatJsonObject { + /** + * Must be "json_object" to indicate generic JSON object response format + */ type: 'json_object'; } diff --git a/src/resources/datasets.ts b/src/resources/datasets.ts index c875e35..5ed6661 100644 --- a/src/resources/datasets.ts +++ b/src/resources/datasets.ts @@ -85,27 +85,42 @@ export class Datasets extends APIResource { } } +/** + * Response from listing datasets. + */ export interface ListDatasetsResponse { + /** + * List of datasets + */ data: DatasetListResponse; } +/** + * Dataset resource for storing and accessing training or evaluation data. + */ export interface DatasetRetrieveResponse { identifier: string; + /** + * Additional metadata for the dataset + */ metadata: { [key: string]: boolean | number | string | Array | unknown | null }; provider_id: string; /** - * Purpose of the dataset. Each purpose has a required input data schema. + * Purpose of the dataset indicating its intended use */ purpose: 'post-training/messages' | 'eval/question-answer' | 'eval/messages-answer'; /** - * A dataset that can be obtained from a URI. + * Data source configuration for the dataset */ source: DatasetRetrieveResponse.UriDataSource | DatasetRetrieveResponse.RowsDataSource; + /** + * Type of resource, always 'dataset' for datasets + */ type: 'dataset'; provider_resource_id?: string; @@ -141,26 +156,38 @@ export namespace DatasetRetrieveResponse { } } +/** + * List of datasets + */ export type DatasetListResponse = Array; export namespace DatasetListResponse { + /** + * Dataset resource for storing and accessing training or evaluation data. + */ export interface DatasetListResponseItem { identifier: string; + /** + * Additional metadata for the dataset + */ metadata: { [key: string]: boolean | number | string | Array | unknown | null }; provider_id: string; /** - * Purpose of the dataset. Each purpose has a required input data schema. + * Purpose of the dataset indicating its intended use */ purpose: 'post-training/messages' | 'eval/question-answer' | 'eval/messages-answer'; /** - * A dataset that can be obtained from a URI. + * Data source configuration for the dataset */ source: DatasetListResponseItem.UriDataSource | DatasetListResponseItem.RowsDataSource; + /** + * Type of resource, always 'dataset' for datasets + */ type: 'dataset'; provider_resource_id?: string; @@ -217,23 +244,32 @@ export interface DatasetIterrowsResponse { url?: string; } +/** + * Dataset resource for storing and accessing training or evaluation data. + */ export interface DatasetRegisterResponse { identifier: string; + /** + * Additional metadata for the dataset + */ metadata: { [key: string]: boolean | number | string | Array | unknown | null }; provider_id: string; /** - * Purpose of the dataset. Each purpose has a required input data schema. + * Purpose of the dataset indicating its intended use */ purpose: 'post-training/messages' | 'eval/question-answer' | 'eval/messages-answer'; /** - * A dataset that can be obtained from a URI. + * Data source configuration for the dataset */ source: DatasetRegisterResponse.UriDataSource | DatasetRegisterResponse.RowsDataSource; + /** + * Type of resource, always 'dataset' for datasets + */ type: 'dataset'; provider_resource_id?: string; diff --git a/src/resources/eval/eval.ts b/src/resources/eval/eval.ts index a2f277e..961b24e 100644 --- a/src/resources/eval/eval.ts +++ b/src/resources/eval/eval.ts @@ -129,9 +129,18 @@ export interface EvaluateResponse { scores: { [key: string]: Shared.ScoringResult }; } +/** + * A job execution instance with status tracking. + */ export interface Job { + /** + * Unique identifier for the job + */ job_id: string; + /** + * Current execution status of the job + */ status: 'completed' | 'in_progress' | 'failed' | 'scheduled' | 'cancelled'; } diff --git a/src/resources/files.ts b/src/resources/files.ts index 3141c6c..7671fc4 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -122,10 +122,19 @@ export interface ListFilesResponse { */ data: Array; + /** + * ID of the first file in the list for pagination + */ first_id: string; + /** + * Whether there are more files available beyond this page + */ has_more: boolean; + /** + * ID of the last file in the list for pagination + */ last_id: string; /** diff --git a/src/resources/index.ts b/src/resources/index.ts index 743bbd9..ceba761 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -86,6 +86,7 @@ export { type ModelListResponse, type ModelRegisterParams, } from './models'; +export { Moderations, type CreateResponse, type ModerationCreateParams } from './moderations'; export { PostTraining, type AlgorithmConfig, diff --git a/src/resources/inference.ts b/src/resources/inference.ts index bdf6ee7..ae1088b 100644 --- a/src/resources/inference.ts +++ b/src/resources/inference.ts @@ -30,6 +30,8 @@ export class Inference extends APIResource { /** * Generate a chat completion for the given messages using the specified model. + * + * @deprecated /v1/inference/chat-completion is deprecated. Please use /v1/openai/v1/chat/completions. */ chatCompletion( body: InferenceChatCompletionParamsNonStreaming, @@ -56,6 +58,8 @@ export class Inference extends APIResource { /** * Generate a completion for the given content using the specified model. + * + * @deprecated /v1/inference/completion is deprecated. Please use /v1/openai/v1/completions. */ completion( body: InferenceCompletionParamsNonStreaming, @@ -82,6 +86,8 @@ export class Inference extends APIResource { /** * Generate embeddings for content pieces using the specified model. + * + * @deprecated /v1/inference/embeddings is deprecated. Please use /v1/openai/v1/embeddings. */ embeddings( body: InferenceEmbeddingsParams, @@ -100,6 +106,9 @@ export interface ChatCompletionResponseStreamChunk { */ event: ChatCompletionResponseStreamChunk.Event; + /** + * (Optional) List of metrics associated with the API response + */ metrics?: Array; } @@ -130,11 +139,23 @@ export namespace ChatCompletionResponseStreamChunk { stop_reason?: 'end_of_turn' | 'end_of_message' | 'out_of_tokens'; } + /** + * A metric value included in API responses. + */ export interface Metric { + /** + * The name of the metric + */ metric: string; + /** + * The numeric value of the metric + */ value: number; + /** + * (Optional) The unit of measurement for the metric value + */ unit?: string; } } @@ -158,15 +179,30 @@ export interface CompletionResponse { */ logprobs?: Array; + /** + * (Optional) List of metrics associated with the API response + */ metrics?: Array; } export namespace CompletionResponse { + /** + * A metric value included in API responses. + */ export interface Metric { + /** + * The name of the metric + */ metric: string; + /** + * The numeric value of the metric + */ value: number; + /** + * (Optional) The unit of measurement for the metric value + */ unit?: string; } } @@ -193,7 +229,13 @@ export interface TokenLogProbs { logprobs_by_token: { [key: string]: number }; } +/** + * Response from a batch chat completion request. + */ export interface InferenceBatchChatCompletionResponse { + /** + * List of chat completion responses, one for each conversation in the batch + */ batch: Array; } diff --git a/src/resources/inspect.ts b/src/resources/inspect.ts index b84d8f2..4e5d87c 100644 --- a/src/resources/inspect.ts +++ b/src/resources/inspect.ts @@ -5,7 +5,7 @@ import * as Core from '../core'; export class Inspect extends APIResource { /** - * Get the health of the service. + * Get the current health status of the service. */ health(options?: Core.RequestOptions): Core.APIPromise { return this._client.get('/v1/health', options); @@ -19,31 +19,75 @@ export class Inspect extends APIResource { } } +/** + * Health status information for the service. + */ export interface HealthInfo { + /** + * Current health status of the service + */ status: 'OK' | 'Error' | 'Not Implemented'; } +/** + * Information about a registered provider including its configuration and health + * status. + */ export interface ProviderInfo { + /** + * The API name this provider implements + */ api: string; + /** + * Configuration parameters for the provider + */ config: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * Current health status of the provider + */ health: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * Unique identifier for the provider + */ provider_id: string; + /** + * The type of provider implementation + */ provider_type: string; } +/** + * Information about an API route including its path, method, and implementing + * providers. + */ export interface RouteInfo { + /** + * HTTP method for the route + */ method: string; + /** + * List of provider types that implement this route + */ provider_types: Array; + /** + * The API endpoint path + */ route: string; } +/** + * Version information for the service. + */ export interface VersionInfo { + /** + * Version number of the service + */ version: string; } diff --git a/src/resources/models.ts b/src/resources/models.ts index a6d5474..555a7a7 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -42,17 +42,38 @@ export interface ListModelsResponse { data: ModelListResponse; } +/** + * A model resource representing an AI model registered in Llama Stack. + */ export interface Model { + /** + * Unique identifier for this resource in llama stack + */ identifier: string; + /** + * Any additional metadata for this model + */ metadata: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * The type of model (LLM or embedding model) + */ model_type: 'llm' | 'embedding'; + /** + * ID of the provider that owns this resource + */ provider_id: string; + /** + * The resource type, always 'model' for model resources + */ type: 'model'; + /** + * Unique identifier for this resource in the provider + */ provider_resource_id?: string; } diff --git a/src/resources/moderations.ts b/src/resources/moderations.ts new file mode 100644 index 0000000..aee9b57 --- /dev/null +++ b/src/resources/moderations.ts @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../resource'; +import * as Core from '../core'; + +export class Moderations extends APIResource { + /** + * Classifies if text and/or image inputs are potentially harmful. + */ + create(body: ModerationCreateParams, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post('/v1/openai/v1/moderations', { body, ...options }); + } +} + +/** + * A moderation object. + */ +export interface CreateResponse { + /** + * The unique identifier for the moderation request. + */ + id: string; + + /** + * The model used to generate the moderation results. + */ + model: string; + + /** + * A list of moderation objects + */ + results: Array; +} + +export namespace CreateResponse { + /** + * A moderation object. + */ + export interface Result { + /** + * Whether any of the below categories are flagged. + */ + flagged: boolean; + + metadata: { [key: string]: boolean | number | string | Array | unknown | null }; + + /** + * A list of the categories, and whether they are flagged or not. + */ + categories?: { [key: string]: boolean }; + + /** + * A list of the categories along with the input type(s) that the score applies to. + */ + category_applied_input_types?: { [key: string]: Array }; + + /** + * A list of the categories along with their scores as predicted by model. Required + * set of categories that need to be in response - violence - violence/graphic - + * harassment - harassment/threatening - hate - hate/threatening - illicit - + * illicit/violent - sexual - sexual/minors - self-harm - self-harm/intent - + * self-harm/instructions + */ + category_scores?: { [key: string]: number }; + + user_message?: string; + } +} + +export interface ModerationCreateParams { + /** + * Input (or inputs) to classify. Can be a single string, an array of strings, or + * an array of multi-modal input objects similar to other models. + */ + input: string | Array; + + /** + * The content moderation model you would like to use. + */ + model: string; +} + +export declare namespace Moderations { + export { type CreateResponse as CreateResponse, type ModerationCreateParams as ModerationCreateParams }; +} diff --git a/src/resources/post-training/job.ts b/src/resources/post-training/job.ts index cb2c48e..a250ac9 100644 --- a/src/resources/post-training/job.ts +++ b/src/resources/post-training/job.ts @@ -56,30 +56,185 @@ export namespace JobListResponse { * Artifacts of a finetuning job. */ export interface JobArtifactsResponse { - checkpoints: Array; + /** + * List of model checkpoints created during training + */ + checkpoints: Array; + /** + * Unique identifier for the training job + */ job_uuid: string; } +export namespace JobArtifactsResponse { + /** + * Checkpoint created during training runs. + */ + export interface Checkpoint { + /** + * Timestamp when the checkpoint was created + */ + created_at: string; + + /** + * Training epoch when the checkpoint was saved + */ + epoch: number; + + /** + * Unique identifier for the checkpoint + */ + identifier: string; + + /** + * File system path where the checkpoint is stored + */ + path: string; + + /** + * Identifier of the training job that created this checkpoint + */ + post_training_job_id: string; + + /** + * (Optional) Training metrics associated with this checkpoint + */ + training_metrics?: Checkpoint.TrainingMetrics; + } + + export namespace Checkpoint { + /** + * (Optional) Training metrics associated with this checkpoint + */ + export interface TrainingMetrics { + /** + * Training epoch number + */ + epoch: number; + + /** + * Perplexity metric indicating model confidence + */ + perplexity: number; + + /** + * Loss value on the training dataset + */ + train_loss: number; + + /** + * Loss value on the validation dataset + */ + validation_loss: number; + } + } +} + /** * Status of a finetuning job. */ export interface JobStatusResponse { - checkpoints: Array; + /** + * List of model checkpoints created during training + */ + checkpoints: Array; + /** + * Unique identifier for the training job + */ job_uuid: string; + /** + * Current status of the training job + */ status: 'completed' | 'in_progress' | 'failed' | 'scheduled' | 'cancelled'; + /** + * (Optional) Timestamp when the job finished, if completed + */ completed_at?: string; + /** + * (Optional) Information about computational resources allocated to the job + */ resources_allocated?: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * (Optional) Timestamp when the job was scheduled + */ scheduled_at?: string; + /** + * (Optional) Timestamp when the job execution began + */ started_at?: string; } +export namespace JobStatusResponse { + /** + * Checkpoint created during training runs. + */ + export interface Checkpoint { + /** + * Timestamp when the checkpoint was created + */ + created_at: string; + + /** + * Training epoch when the checkpoint was saved + */ + epoch: number; + + /** + * Unique identifier for the checkpoint + */ + identifier: string; + + /** + * File system path where the checkpoint is stored + */ + path: string; + + /** + * Identifier of the training job that created this checkpoint + */ + post_training_job_id: string; + + /** + * (Optional) Training metrics associated with this checkpoint + */ + training_metrics?: Checkpoint.TrainingMetrics; + } + + export namespace Checkpoint { + /** + * (Optional) Training metrics associated with this checkpoint + */ + export interface TrainingMetrics { + /** + * Training epoch number + */ + epoch: number; + + /** + * Perplexity metric indicating model confidence + */ + perplexity: number; + + /** + * Loss value on the training dataset + */ + train_loss: number; + + /** + * Loss value on the validation dataset + */ + validation_loss: number; + } + } +} + export interface JobArtifactsParams { /** * The UUID of the job to get the artifacts of. diff --git a/src/resources/post-training/post-training.ts b/src/resources/post-training/post-training.ts index 11d14c0..8f6eb3f 100644 --- a/src/resources/post-training/post-training.ts +++ b/src/resources/post-training/post-training.ts @@ -37,32 +37,74 @@ export class PostTraining extends APIResource { } } +/** + * Configuration for Low-Rank Adaptation (LoRA) fine-tuning. + */ export type AlgorithmConfig = AlgorithmConfig.LoraFinetuningConfig | AlgorithmConfig.QatFinetuningConfig; export namespace AlgorithmConfig { + /** + * Configuration for Low-Rank Adaptation (LoRA) fine-tuning. + */ export interface LoraFinetuningConfig { + /** + * LoRA scaling parameter that controls adaptation strength + */ alpha: number; + /** + * Whether to apply LoRA to MLP layers + */ apply_lora_to_mlp: boolean; + /** + * Whether to apply LoRA to output projection layers + */ apply_lora_to_output: boolean; + /** + * List of attention module names to apply LoRA to + */ lora_attn_modules: Array; + /** + * Rank of the LoRA adaptation (lower rank = fewer parameters) + */ rank: number; + /** + * Algorithm type identifier, always "LoRA" + */ type: 'LoRA'; + /** + * (Optional) Whether to quantize the base model weights + */ quantize_base?: boolean; + /** + * (Optional) Whether to use DoRA (Weight-Decomposed Low-Rank Adaptation) + */ use_dora?: boolean; } + /** + * Configuration for Quantization-Aware Training (QAT) fine-tuning. + */ export interface QatFinetuningConfig { + /** + * Size of groups for grouped quantization + */ group_size: number; + /** + * Name of the quantization algorithm to use + */ quantizer_name: string; + /** + * Algorithm type identifier, always "QAT" + */ type: 'QAT'; } } @@ -118,70 +160,151 @@ export namespace PostTrainingPreferenceOptimizeParams { * The algorithm configuration. */ export interface AlgorithmConfig { - epsilon: number; - - gamma: number; - - reward_clip: number; - - reward_scale: number; + /** + * Temperature parameter for the DPO loss + */ + beta: number; + + /** + * The type of loss function to use for DPO + */ + loss_type: 'sigmoid' | 'hinge' | 'ipo' | 'kto_pair'; } /** * The training configuration. */ export interface TrainingConfig { + /** + * Number of steps to accumulate gradients before updating + */ gradient_accumulation_steps: number; + /** + * Maximum number of steps to run per epoch + */ max_steps_per_epoch: number; + /** + * Number of training epochs to run + */ n_epochs: number; + /** + * (Optional) Configuration for data loading and formatting + */ data_config?: TrainingConfig.DataConfig; + /** + * (Optional) Data type for model parameters (bf16, fp16, fp32) + */ dtype?: string; + /** + * (Optional) Configuration for memory and compute optimizations + */ efficiency_config?: TrainingConfig.EfficiencyConfig; + /** + * (Optional) Maximum number of validation steps per epoch + */ max_validation_steps?: number; + /** + * (Optional) Configuration for the optimization algorithm + */ optimizer_config?: TrainingConfig.OptimizerConfig; } export namespace TrainingConfig { + /** + * (Optional) Configuration for data loading and formatting + */ export interface DataConfig { + /** + * Number of samples per training batch + */ batch_size: number; + /** + * Format of the dataset (instruct or dialog) + */ data_format: 'instruct' | 'dialog'; + /** + * Unique identifier for the training dataset + */ dataset_id: string; + /** + * Whether to shuffle the dataset during training + */ shuffle: boolean; + /** + * (Optional) Whether to pack multiple samples into a single sequence for + * efficiency + */ packed?: boolean; + /** + * (Optional) Whether to compute loss on input tokens as well as output tokens + */ train_on_input?: boolean; + /** + * (Optional) Unique identifier for the validation dataset + */ validation_dataset_id?: string; } + /** + * (Optional) Configuration for memory and compute optimizations + */ export interface EfficiencyConfig { + /** + * (Optional) Whether to use activation checkpointing to reduce memory usage + */ enable_activation_checkpointing?: boolean; + /** + * (Optional) Whether to offload activations to CPU to save GPU memory + */ enable_activation_offloading?: boolean; + /** + * (Optional) Whether to offload FSDP parameters to CPU + */ fsdp_cpu_offload?: boolean; + /** + * (Optional) Whether to use memory-efficient FSDP wrapping + */ memory_efficient_fsdp_wrap?: boolean; } + /** + * (Optional) Configuration for the optimization algorithm + */ export interface OptimizerConfig { + /** + * Learning rate for the optimizer + */ lr: number; + /** + * Number of steps for learning rate warmup + */ num_warmup_steps: number; + /** + * Type of optimizer to use (adam, adamw, or sgd) + */ optimizer_type: 'adam' | 'adamw' | 'sgd'; + /** + * Weight decay coefficient for regularization + */ weight_decay: number; } } @@ -229,57 +352,136 @@ export namespace PostTrainingSupervisedFineTuneParams { * The training configuration. */ export interface TrainingConfig { + /** + * Number of steps to accumulate gradients before updating + */ gradient_accumulation_steps: number; + /** + * Maximum number of steps to run per epoch + */ max_steps_per_epoch: number; + /** + * Number of training epochs to run + */ n_epochs: number; + /** + * (Optional) Configuration for data loading and formatting + */ data_config?: TrainingConfig.DataConfig; + /** + * (Optional) Data type for model parameters (bf16, fp16, fp32) + */ dtype?: string; + /** + * (Optional) Configuration for memory and compute optimizations + */ efficiency_config?: TrainingConfig.EfficiencyConfig; + /** + * (Optional) Maximum number of validation steps per epoch + */ max_validation_steps?: number; + /** + * (Optional) Configuration for the optimization algorithm + */ optimizer_config?: TrainingConfig.OptimizerConfig; } export namespace TrainingConfig { + /** + * (Optional) Configuration for data loading and formatting + */ export interface DataConfig { + /** + * Number of samples per training batch + */ batch_size: number; + /** + * Format of the dataset (instruct or dialog) + */ data_format: 'instruct' | 'dialog'; + /** + * Unique identifier for the training dataset + */ dataset_id: string; + /** + * Whether to shuffle the dataset during training + */ shuffle: boolean; + /** + * (Optional) Whether to pack multiple samples into a single sequence for + * efficiency + */ packed?: boolean; + /** + * (Optional) Whether to compute loss on input tokens as well as output tokens + */ train_on_input?: boolean; + /** + * (Optional) Unique identifier for the validation dataset + */ validation_dataset_id?: string; } + /** + * (Optional) Configuration for memory and compute optimizations + */ export interface EfficiencyConfig { + /** + * (Optional) Whether to use activation checkpointing to reduce memory usage + */ enable_activation_checkpointing?: boolean; + /** + * (Optional) Whether to offload activations to CPU to save GPU memory + */ enable_activation_offloading?: boolean; + /** + * (Optional) Whether to offload FSDP parameters to CPU + */ fsdp_cpu_offload?: boolean; + /** + * (Optional) Whether to use memory-efficient FSDP wrapping + */ memory_efficient_fsdp_wrap?: boolean; } + /** + * (Optional) Configuration for the optimization algorithm + */ export interface OptimizerConfig { + /** + * Learning rate for the optimizer + */ lr: number; + /** + * Number of steps for learning rate warmup + */ num_warmup_steps: number; + /** + * Type of optimizer to use (adam, adamw, or sgd) + */ optimizer_type: 'adam' | 'adamw' | 'sgd'; + /** + * Weight decay coefficient for regularization + */ weight_decay: number; } } diff --git a/src/resources/providers.ts b/src/resources/providers.ts index dd37a42..d27b9ab 100644 --- a/src/resources/providers.ts +++ b/src/resources/providers.ts @@ -22,10 +22,19 @@ export class Providers extends APIResource { } } +/** + * Response containing a list of all available providers. + */ export interface ListProvidersResponse { + /** + * List of provider information objects + */ data: ProviderListResponse; } +/** + * List of provider information objects + */ export type ProviderListResponse = Array; export declare namespace Providers { diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index 9f1303d..ff21948 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -26,7 +26,13 @@ export class InputItems extends APIResource { } } +/** + * List container for OpenAI response input items. + */ export interface InputItemListResponse { + /** + * List of input items + */ data: Array< | InputItemListResponse.OpenAIResponseOutputMessageWebSearchToolCall | InputItemListResponse.OpenAIResponseOutputMessageFileSearchToolCall @@ -35,41 +41,95 @@ export interface InputItemListResponse { | InputItemListResponse.OpenAIResponseMessage >; + /** + * Object type identifier, always "list" + */ object: 'list'; } export namespace InputItemListResponse { + /** + * Web search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageWebSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * Current status of the web search operation + */ status: string; + /** + * Tool call type identifier, always "web_search_call" + */ type: 'web_search_call'; } + /** + * File search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFileSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * List of search queries executed + */ queries: Array; + /** + * Current status of the file search operation + */ status: string; + /** + * Tool call type identifier, always "file_search_call" + */ type: 'file_search_call'; + /** + * (Optional) Search results returned by the file search operation + */ results?: Array<{ [key: string]: boolean | number | string | Array | unknown | null }>; } + /** + * Function tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFunctionToolCall { + /** + * JSON string containing the function arguments + */ arguments: string; + /** + * Unique identifier for the function call + */ call_id: string; + /** + * Name of the function being called + */ name: string; + /** + * Tool call type identifier, always "function_call" + */ type: 'function_call'; + /** + * (Optional) Additional identifier for the tool call + */ id?: string; + /** + * (Optional) Current status of the function call execution + */ status?: string; } @@ -113,17 +173,38 @@ export namespace InputItemListResponse { } export namespace OpenAIResponseMessage { + /** + * Text content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentText { + /** + * The text content of the input message + */ text: string; + /** + * Content type identifier, always "input_text" + */ type: 'input_text'; } + /** + * Image content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentImage { + /** + * Level of detail for image processing, can be "low", "high", or "auto" + */ detail: 'low' | 'high' | 'auto'; + /** + * Content type identifier, always "input_image" + */ type: 'input_image'; + /** + * (Optional) URL of the image content + */ image_url?: string; } @@ -141,25 +222,58 @@ export namespace InputItemListResponse { } export namespace UnionMember2 { + /** + * File citation annotation for referencing specific files in response content. + */ export interface OpenAIResponseAnnotationFileCitation { + /** + * Unique identifier of the referenced file + */ file_id: string; + /** + * Name of the referenced file + */ filename: string; + /** + * Position index of the citation within the content + */ index: number; + /** + * Annotation type identifier, always "file_citation" + */ type: 'file_citation'; } + /** + * URL citation annotation for referencing external web resources. + */ export interface OpenAIResponseAnnotationCitation { + /** + * End position of the citation span in the content + */ end_index: number; + /** + * Start position of the citation span in the content + */ start_index: number; + /** + * Title of the referenced web resource + */ title: string; + /** + * Annotation type identifier, always "url_citation" + */ type: 'url_citation'; + /** + * URL of the referenced web resource + */ url: string; } diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 6dc465b..f0d4d20 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -58,15 +58,33 @@ export class Responses extends APIResource { } } +/** + * Complete OpenAI response object containing generation results and metadata. + */ export interface ResponseObject { + /** + * Unique identifier for this response + */ id: string; + /** + * Unix timestamp when the response was created + */ created_at: number; + /** + * Model identifier used for generation + */ model: string; + /** + * Object type identifier, always "response" + */ object: 'response'; + /** + * List of generated output items (messages, tool calls, etc.) + */ output: Array< | ResponseObject.OpenAIResponseMessage | ResponseObject.OpenAIResponseOutputMessageWebSearchToolCall @@ -76,22 +94,49 @@ export interface ResponseObject { | ResponseObject.OpenAIResponseOutputMessageMcpListTools >; + /** + * Whether tool calls can be executed in parallel + */ parallel_tool_calls: boolean; + /** + * Current status of the response generation + */ status: string; + /** + * Text formatting configuration for the response + */ text: ResponseObject.Text; + /** + * (Optional) Error details if the response generation failed + */ error?: ResponseObject.Error; + /** + * (Optional) ID of the previous response in a conversation + */ previous_response_id?: string; + /** + * (Optional) Sampling temperature used for generation + */ temperature?: number; + /** + * (Optional) Nucleus sampling parameter used for generation + */ top_p?: number; + /** + * (Optional) Truncation strategy applied to the response + */ truncation?: string; + /** + * (Optional) User identifier associated with the request + */ user?: string; } @@ -120,17 +165,38 @@ export namespace ResponseObject { } export namespace OpenAIResponseMessage { + /** + * Text content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentText { + /** + * The text content of the input message + */ text: string; + /** + * Content type identifier, always "input_text" + */ type: 'input_text'; } + /** + * Image content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentImage { + /** + * Level of detail for image processing, can be "low", "high", or "auto" + */ detail: 'low' | 'high' | 'auto'; + /** + * Content type identifier, always "input_image" + */ type: 'input_image'; + /** + * (Optional) URL of the image content + */ image_url?: string; } @@ -148,25 +214,58 @@ export namespace ResponseObject { } export namespace UnionMember2 { + /** + * File citation annotation for referencing specific files in response content. + */ export interface OpenAIResponseAnnotationFileCitation { + /** + * Unique identifier of the referenced file + */ file_id: string; + /** + * Name of the referenced file + */ filename: string; + /** + * Position index of the citation within the content + */ index: number; + /** + * Annotation type identifier, always "file_citation" + */ type: 'file_citation'; } + /** + * URL citation annotation for referencing external web resources. + */ export interface OpenAIResponseAnnotationCitation { + /** + * End position of the citation span in the content + */ end_index: number; + /** + * Start position of the citation span in the content + */ start_index: number; + /** + * Title of the referenced web resource + */ title: string; + /** + * Annotation type identifier, always "url_citation" + */ type: 'url_citation'; + /** + * URL of the referenced web resource + */ url: string; } @@ -194,86 +293,191 @@ export namespace ResponseObject { } } + /** + * Web search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageWebSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * Current status of the web search operation + */ status: string; + /** + * Tool call type identifier, always "web_search_call" + */ type: 'web_search_call'; } + /** + * File search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFileSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * List of search queries executed + */ queries: Array; + /** + * Current status of the file search operation + */ status: string; + /** + * Tool call type identifier, always "file_search_call" + */ type: 'file_search_call'; + /** + * (Optional) Search results returned by the file search operation + */ results?: Array<{ [key: string]: boolean | number | string | Array | unknown | null }>; } + /** + * Function tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFunctionToolCall { + /** + * JSON string containing the function arguments + */ arguments: string; + /** + * Unique identifier for the function call + */ call_id: string; + /** + * Name of the function being called + */ name: string; + /** + * Tool call type identifier, always "function_call" + */ type: 'function_call'; + /** + * (Optional) Additional identifier for the tool call + */ id?: string; + /** + * (Optional) Current status of the function call execution + */ status?: string; } + /** + * Model Context Protocol (MCP) call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageMcpCall { + /** + * Unique identifier for this MCP call + */ id: string; + /** + * JSON string containing the MCP call arguments + */ arguments: string; + /** + * Name of the MCP method being called + */ name: string; + /** + * Label identifying the MCP server handling the call + */ server_label: string; + /** + * Tool call type identifier, always "mcp_call" + */ type: 'mcp_call'; + /** + * (Optional) Error message if the MCP call failed + */ error?: string; + /** + * (Optional) Output result from the successful MCP call + */ output?: string; } + /** + * MCP list tools output message containing available tools from an MCP server. + */ export interface OpenAIResponseOutputMessageMcpListTools { + /** + * Unique identifier for this MCP list tools operation + */ id: string; + /** + * Label identifying the MCP server providing the tools + */ server_label: string; + /** + * List of available tools provided by the MCP server + */ tools: Array; + /** + * Tool call type identifier, always "mcp_list_tools" + */ type: 'mcp_list_tools'; } export namespace OpenAIResponseOutputMessageMcpListTools { + /** + * Tool definition returned by MCP list tools operation. + */ export interface Tool { + /** + * JSON schema defining the tool's input parameters + */ input_schema: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * Name of the tool + */ name: string; + /** + * (Optional) Description of what the tool does + */ description?: string; } } + /** + * Text formatting configuration for the response + */ export interface Text { /** - * Configuration for Responses API text format. + * (Optional) Text format configuration specifying output format requirements */ format?: Text.Format; } export namespace Text { /** - * Configuration for Responses API text format. + * (Optional) Text format configuration specifying output format requirements */ export interface Format { /** @@ -305,13 +509,25 @@ export namespace ResponseObject { } } + /** + * (Optional) Error details if the response generation failed + */ export interface Error { + /** + * Error code identifying the type of failure + */ code: string; + /** + * Human-readable error message describing the failure + */ message: string; } } +/** + * Streaming event indicating a new response has been created. + */ export type ResponseObjectStream = | ResponseObjectStream.OpenAIResponseObjectStreamResponseCreated | ResponseObjectStream.OpenAIResponseObjectStreamResponseOutputItemAdded @@ -334,17 +550,27 @@ export type ResponseObjectStream = | ResponseObjectStream.OpenAIResponseObjectStreamResponseCompleted; export namespace ResponseObjectStream { + /** + * Streaming event indicating a new response has been created. + */ export interface OpenAIResponseObjectStreamResponseCreated { + /** + * The newly created response object + */ response: ResponsesAPI.ResponseObject; + /** + * Event type identifier, always "response.created" + */ type: 'response.created'; } + /** + * Streaming event for when a new output item is added to the response. + */ export interface OpenAIResponseObjectStreamResponseOutputItemAdded { /** - * Corresponds to the various Message types in the Responses API. They are all - * under one type because the Responses API gives them all the same "type" value, - * and there is no way to tell them apart in certain scenarios. + * The output item that was added (message, tool call, etc.) */ item: | OpenAIResponseObjectStreamResponseOutputItemAdded.OpenAIResponseMessage @@ -354,12 +580,24 @@ export namespace ResponseObjectStream { | OpenAIResponseObjectStreamResponseOutputItemAdded.OpenAIResponseOutputMessageMcpCall | OpenAIResponseObjectStreamResponseOutputItemAdded.OpenAIResponseOutputMessageMcpListTools; + /** + * Index position of this item in the output list + */ output_index: number; + /** + * Unique identifier of the response containing this output + */ response_id: string; + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Event type identifier, always "response.output_item.added" + */ type: 'response.output_item.added'; } @@ -388,17 +626,38 @@ export namespace ResponseObjectStream { } export namespace OpenAIResponseMessage { + /** + * Text content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentText { + /** + * The text content of the input message + */ text: string; + /** + * Content type identifier, always "input_text" + */ type: 'input_text'; } + /** + * Image content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentImage { + /** + * Level of detail for image processing, can be "low", "high", or "auto" + */ detail: 'low' | 'high' | 'auto'; + /** + * Content type identifier, always "input_image" + */ type: 'input_image'; + /** + * (Optional) URL of the image content + */ image_url?: string; } @@ -416,25 +675,58 @@ export namespace ResponseObjectStream { } export namespace UnionMember2 { + /** + * File citation annotation for referencing specific files in response content. + */ export interface OpenAIResponseAnnotationFileCitation { + /** + * Unique identifier of the referenced file + */ file_id: string; + /** + * Name of the referenced file + */ filename: string; + /** + * Position index of the citation within the content + */ index: number; + /** + * Annotation type identifier, always "file_citation" + */ type: 'file_citation'; } + /** + * URL citation annotation for referencing external web resources. + */ export interface OpenAIResponseAnnotationCitation { + /** + * End position of the citation span in the content + */ end_index: number; + /** + * Start position of the citation span in the content + */ start_index: number; + /** + * Title of the referenced web resource + */ title: string; + /** + * Annotation type identifier, always "url_citation" + */ type: 'url_citation'; + /** + * URL of the referenced web resource + */ url: string; } @@ -462,82 +754,185 @@ export namespace ResponseObjectStream { } } + /** + * Web search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageWebSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * Current status of the web search operation + */ status: string; + /** + * Tool call type identifier, always "web_search_call" + */ type: 'web_search_call'; } + /** + * File search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFileSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * List of search queries executed + */ queries: Array; + /** + * Current status of the file search operation + */ status: string; + /** + * Tool call type identifier, always "file_search_call" + */ type: 'file_search_call'; + /** + * (Optional) Search results returned by the file search operation + */ results?: Array<{ [key: string]: boolean | number | string | Array | unknown | null }>; } + /** + * Function tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFunctionToolCall { + /** + * JSON string containing the function arguments + */ arguments: string; + /** + * Unique identifier for the function call + */ call_id: string; + /** + * Name of the function being called + */ name: string; + /** + * Tool call type identifier, always "function_call" + */ type: 'function_call'; + /** + * (Optional) Additional identifier for the tool call + */ id?: string; + /** + * (Optional) Current status of the function call execution + */ status?: string; } + /** + * Model Context Protocol (MCP) call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageMcpCall { + /** + * Unique identifier for this MCP call + */ id: string; + /** + * JSON string containing the MCP call arguments + */ arguments: string; + /** + * Name of the MCP method being called + */ name: string; + /** + * Label identifying the MCP server handling the call + */ server_label: string; + /** + * Tool call type identifier, always "mcp_call" + */ type: 'mcp_call'; + /** + * (Optional) Error message if the MCP call failed + */ error?: string; + /** + * (Optional) Output result from the successful MCP call + */ output?: string; } + /** + * MCP list tools output message containing available tools from an MCP server. + */ export interface OpenAIResponseOutputMessageMcpListTools { + /** + * Unique identifier for this MCP list tools operation + */ id: string; + /** + * Label identifying the MCP server providing the tools + */ server_label: string; + /** + * List of available tools provided by the MCP server + */ tools: Array; + /** + * Tool call type identifier, always "mcp_list_tools" + */ type: 'mcp_list_tools'; } export namespace OpenAIResponseOutputMessageMcpListTools { + /** + * Tool definition returned by MCP list tools operation. + */ export interface Tool { + /** + * JSON schema defining the tool's input parameters + */ input_schema: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * Name of the tool + */ name: string; + /** + * (Optional) Description of what the tool does + */ description?: string; } } } + /** + * Streaming event for when an output item is completed. + */ export interface OpenAIResponseObjectStreamResponseOutputItemDone { /** - * Corresponds to the various Message types in the Responses API. They are all - * under one type because the Responses API gives them all the same "type" value, - * and there is no way to tell them apart in certain scenarios. + * The completed output item (message, tool call, etc.) */ item: | OpenAIResponseObjectStreamResponseOutputItemDone.OpenAIResponseMessage @@ -547,12 +942,24 @@ export namespace ResponseObjectStream { | OpenAIResponseObjectStreamResponseOutputItemDone.OpenAIResponseOutputMessageMcpCall | OpenAIResponseObjectStreamResponseOutputItemDone.OpenAIResponseOutputMessageMcpListTools; + /** + * Index position of this item in the output list + */ output_index: number; + /** + * Unique identifier of the response containing this output + */ response_id: string; + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Event type identifier, always "response.output_item.done" + */ type: 'response.output_item.done'; } @@ -581,17 +988,38 @@ export namespace ResponseObjectStream { } export namespace OpenAIResponseMessage { + /** + * Text content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentText { + /** + * The text content of the input message + */ text: string; + /** + * Content type identifier, always "input_text" + */ type: 'input_text'; } + /** + * Image content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentImage { + /** + * Level of detail for image processing, can be "low", "high", or "auto" + */ detail: 'low' | 'high' | 'auto'; + /** + * Content type identifier, always "input_image" + */ type: 'input_image'; + /** + * (Optional) URL of the image content + */ image_url?: string; } @@ -609,25 +1037,58 @@ export namespace ResponseObjectStream { } export namespace UnionMember2 { + /** + * File citation annotation for referencing specific files in response content. + */ export interface OpenAIResponseAnnotationFileCitation { + /** + * Unique identifier of the referenced file + */ file_id: string; + /** + * Name of the referenced file + */ filename: string; + /** + * Position index of the citation within the content + */ index: number; + /** + * Annotation type identifier, always "file_citation" + */ type: 'file_citation'; } + /** + * URL citation annotation for referencing external web resources. + */ export interface OpenAIResponseAnnotationCitation { + /** + * End position of the citation span in the content + */ end_index: number; + /** + * Start position of the citation span in the content + */ start_index: number; + /** + * Title of the referenced web resource + */ title: string; + /** + * Annotation type identifier, always "url_citation" + */ type: 'url_citation'; + /** + * URL of the referenced web resource + */ url: string; } @@ -655,136 +1116,331 @@ export namespace ResponseObjectStream { } } + /** + * Web search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageWebSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * Current status of the web search operation + */ status: string; + /** + * Tool call type identifier, always "web_search_call" + */ type: 'web_search_call'; } + /** + * File search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFileSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * List of search queries executed + */ queries: Array; + /** + * Current status of the file search operation + */ status: string; + /** + * Tool call type identifier, always "file_search_call" + */ type: 'file_search_call'; + /** + * (Optional) Search results returned by the file search operation + */ results?: Array<{ [key: string]: boolean | number | string | Array | unknown | null }>; } + /** + * Function tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFunctionToolCall { + /** + * JSON string containing the function arguments + */ arguments: string; + /** + * Unique identifier for the function call + */ call_id: string; + /** + * Name of the function being called + */ name: string; + /** + * Tool call type identifier, always "function_call" + */ type: 'function_call'; + /** + * (Optional) Additional identifier for the tool call + */ id?: string; + /** + * (Optional) Current status of the function call execution + */ status?: string; } + /** + * Model Context Protocol (MCP) call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageMcpCall { + /** + * Unique identifier for this MCP call + */ id: string; + /** + * JSON string containing the MCP call arguments + */ arguments: string; + /** + * Name of the MCP method being called + */ name: string; + /** + * Label identifying the MCP server handling the call + */ server_label: string; + /** + * Tool call type identifier, always "mcp_call" + */ type: 'mcp_call'; + /** + * (Optional) Error message if the MCP call failed + */ error?: string; + /** + * (Optional) Output result from the successful MCP call + */ output?: string; } + /** + * MCP list tools output message containing available tools from an MCP server. + */ export interface OpenAIResponseOutputMessageMcpListTools { + /** + * Unique identifier for this MCP list tools operation + */ id: string; + /** + * Label identifying the MCP server providing the tools + */ server_label: string; + /** + * List of available tools provided by the MCP server + */ tools: Array; + /** + * Tool call type identifier, always "mcp_list_tools" + */ type: 'mcp_list_tools'; } export namespace OpenAIResponseOutputMessageMcpListTools { + /** + * Tool definition returned by MCP list tools operation. + */ export interface Tool { + /** + * JSON schema defining the tool's input parameters + */ input_schema: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * Name of the tool + */ name: string; + /** + * (Optional) Description of what the tool does + */ description?: string; } } } + /** + * Streaming event for incremental text content updates. + */ export interface OpenAIResponseObjectStreamResponseOutputTextDelta { + /** + * Index position within the text content + */ content_index: number; + /** + * Incremental text content being added + */ delta: string; + /** + * Unique identifier of the output item being updated + */ item_id: string; + /** + * Index position of the item in the output list + */ output_index: number; + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Event type identifier, always "response.output_text.delta" + */ type: 'response.output_text.delta'; } + /** + * Streaming event for when text output is completed. + */ export interface OpenAIResponseObjectStreamResponseOutputTextDone { + /** + * Index position within the text content + */ content_index: number; + /** + * Unique identifier of the completed output item + */ item_id: string; + /** + * Index position of the item in the output list + */ output_index: number; + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Final complete text content of the output item + */ text: string; + /** + * Event type identifier, always "response.output_text.done" + */ type: 'response.output_text.done'; } + /** + * Streaming event for incremental function call argument updates. + */ export interface OpenAIResponseObjectStreamResponseFunctionCallArgumentsDelta { + /** + * Incremental function call arguments being added + */ delta: string; + /** + * Unique identifier of the function call being updated + */ item_id: string; + /** + * Index position of the item in the output list + */ output_index: number; + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Event type identifier, always "response.function_call_arguments.delta" + */ type: 'response.function_call_arguments.delta'; } + /** + * Streaming event for when function call arguments are completed. + */ export interface OpenAIResponseObjectStreamResponseFunctionCallArgumentsDone { + /** + * Final complete arguments JSON string for the function call + */ arguments: string; + /** + * Unique identifier of the completed function call + */ item_id: string; + /** + * Index position of the item in the output list + */ output_index: number; + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Event type identifier, always "response.function_call_arguments.done" + */ type: 'response.function_call_arguments.done'; } + /** + * Streaming event for web search calls in progress. + */ export interface OpenAIResponseObjectStreamResponseWebSearchCallInProgress { + /** + * Unique identifier of the web search call + */ item_id: string; + /** + * Index position of the item in the output list + */ output_index: number; + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Event type identifier, always "response.web_search_call.in_progress" + */ type: 'response.web_search_call.in_progress'; } @@ -798,13 +1454,28 @@ export namespace ResponseObjectStream { type: 'response.web_search_call.searching'; } + /** + * Streaming event for completed web search calls. + */ export interface OpenAIResponseObjectStreamResponseWebSearchCallCompleted { + /** + * Unique identifier of the completed web search call + */ item_id: string; + /** + * Index position of the item in the output list + */ output_index: number; + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Event type identifier, always "response.web_search_call.completed" + */ type: 'response.web_search_call.completed'; } @@ -850,53 +1521,125 @@ export namespace ResponseObjectStream { type: 'response.mcp_call.arguments.done'; } + /** + * Streaming event for MCP calls in progress. + */ export interface OpenAIResponseObjectStreamResponseMcpCallInProgress { + /** + * Unique identifier of the MCP call + */ item_id: string; + /** + * Index position of the item in the output list + */ output_index: number; + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Event type identifier, always "response.mcp_call.in_progress" + */ type: 'response.mcp_call.in_progress'; } + /** + * Streaming event for failed MCP calls. + */ export interface OpenAIResponseObjectStreamResponseMcpCallFailed { + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Event type identifier, always "response.mcp_call.failed" + */ type: 'response.mcp_call.failed'; } + /** + * Streaming event for completed MCP calls. + */ export interface OpenAIResponseObjectStreamResponseMcpCallCompleted { + /** + * Sequential number for ordering streaming events + */ sequence_number: number; + /** + * Event type identifier, always "response.mcp_call.completed" + */ type: 'response.mcp_call.completed'; } + /** + * Streaming event indicating a response has been completed. + */ export interface OpenAIResponseObjectStreamResponseCompleted { + /** + * The completed response object + */ response: ResponsesAPI.ResponseObject; + /** + * Event type identifier, always "response.completed" + */ type: 'response.completed'; } } +/** + * Paginated list of OpenAI response objects with navigation metadata. + */ export interface ResponseListResponse { + /** + * List of response objects with their input context + */ data: Array; + /** + * Identifier of the first item in this page + */ first_id: string; + /** + * Whether there are more results available beyond this page + */ has_more: boolean; + /** + * Identifier of the last item in this page + */ last_id: string; + /** + * Object type identifier, always "list" + */ object: 'list'; } export namespace ResponseListResponse { + /** + * OpenAI response object extended with input context information. + */ export interface Data { + /** + * Unique identifier for this response + */ id: string; + /** + * Unix timestamp when the response was created + */ created_at: number; + /** + * List of input items that led to this response + */ input: Array< | Data.OpenAIResponseOutputMessageWebSearchToolCall | Data.OpenAIResponseOutputMessageFileSearchToolCall @@ -905,10 +1648,19 @@ export namespace ResponseListResponse { | Data.OpenAIResponseMessage >; + /** + * Model identifier used for generation + */ model: string; + /** + * Object type identifier, always "response" + */ object: 'response'; + /** + * List of generated output items (messages, tool calls, etc.) + */ output: Array< | Data.OpenAIResponseMessage | Data.OpenAIResponseOutputMessageWebSearchToolCall @@ -918,57 +1670,135 @@ export namespace ResponseListResponse { | Data.OpenAIResponseOutputMessageMcpListTools >; + /** + * Whether tool calls can be executed in parallel + */ parallel_tool_calls: boolean; + /** + * Current status of the response generation + */ status: string; + /** + * Text formatting configuration for the response + */ text: Data.Text; + /** + * (Optional) Error details if the response generation failed + */ error?: Data.Error; + /** + * (Optional) ID of the previous response in a conversation + */ previous_response_id?: string; + /** + * (Optional) Sampling temperature used for generation + */ temperature?: number; + /** + * (Optional) Nucleus sampling parameter used for generation + */ top_p?: number; + /** + * (Optional) Truncation strategy applied to the response + */ truncation?: string; + /** + * (Optional) User identifier associated with the request + */ user?: string; } export namespace Data { + /** + * Web search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageWebSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * Current status of the web search operation + */ status: string; + /** + * Tool call type identifier, always "web_search_call" + */ type: 'web_search_call'; } + /** + * File search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFileSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * List of search queries executed + */ queries: Array; + /** + * Current status of the file search operation + */ status: string; + /** + * Tool call type identifier, always "file_search_call" + */ type: 'file_search_call'; + /** + * (Optional) Search results returned by the file search operation + */ results?: Array<{ [key: string]: boolean | number | string | Array | unknown | null }>; } + /** + * Function tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFunctionToolCall { + /** + * JSON string containing the function arguments + */ arguments: string; + /** + * Unique identifier for the function call + */ call_id: string; + /** + * Name of the function being called + */ name: string; + /** + * Tool call type identifier, always "function_call" + */ type: 'function_call'; + /** + * (Optional) Additional identifier for the tool call + */ id?: string; + /** + * (Optional) Current status of the function call execution + */ status?: string; } @@ -1012,17 +1842,38 @@ export namespace ResponseListResponse { } export namespace OpenAIResponseMessage { + /** + * Text content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentText { + /** + * The text content of the input message + */ text: string; + /** + * Content type identifier, always "input_text" + */ type: 'input_text'; } + /** + * Image content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentImage { + /** + * Level of detail for image processing, can be "low", "high", or "auto" + */ detail: 'low' | 'high' | 'auto'; + /** + * Content type identifier, always "input_image" + */ type: 'input_image'; + /** + * (Optional) URL of the image content + */ image_url?: string; } @@ -1040,25 +1891,58 @@ export namespace ResponseListResponse { } export namespace UnionMember2 { + /** + * File citation annotation for referencing specific files in response content. + */ export interface OpenAIResponseAnnotationFileCitation { + /** + * Unique identifier of the referenced file + */ file_id: string; + /** + * Name of the referenced file + */ filename: string; + /** + * Position index of the citation within the content + */ index: number; + /** + * Annotation type identifier, always "file_citation" + */ type: 'file_citation'; } + /** + * URL citation annotation for referencing external web resources. + */ export interface OpenAIResponseAnnotationCitation { + /** + * End position of the citation span in the content + */ end_index: number; + /** + * Start position of the citation span in the content + */ start_index: number; + /** + * Title of the referenced web resource + */ title: string; + /** + * Annotation type identifier, always "url_citation" + */ type: 'url_citation'; + /** + * URL of the referenced web resource + */ url: string; } @@ -1110,17 +1994,38 @@ export namespace ResponseListResponse { } export namespace OpenAIResponseMessage { + /** + * Text content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentText { + /** + * The text content of the input message + */ text: string; + /** + * Content type identifier, always "input_text" + */ type: 'input_text'; } + /** + * Image content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentImage { + /** + * Level of detail for image processing, can be "low", "high", or "auto" + */ detail: 'low' | 'high' | 'auto'; + /** + * Content type identifier, always "input_image" + */ type: 'input_image'; + /** + * (Optional) URL of the image content + */ image_url?: string; } @@ -1138,25 +2043,58 @@ export namespace ResponseListResponse { } export namespace UnionMember2 { + /** + * File citation annotation for referencing specific files in response content. + */ export interface OpenAIResponseAnnotationFileCitation { + /** + * Unique identifier of the referenced file + */ file_id: string; + /** + * Name of the referenced file + */ filename: string; + /** + * Position index of the citation within the content + */ index: number; + /** + * Annotation type identifier, always "file_citation" + */ type: 'file_citation'; } + /** + * URL citation annotation for referencing external web resources. + */ export interface OpenAIResponseAnnotationCitation { + /** + * End position of the citation span in the content + */ end_index: number; + /** + * Start position of the citation span in the content + */ start_index: number; + /** + * Title of the referenced web resource + */ title: string; + /** + * Annotation type identifier, always "url_citation" + */ type: 'url_citation'; + /** + * URL of the referenced web resource + */ url: string; } @@ -1184,86 +2122,191 @@ export namespace ResponseListResponse { } } + /** + * Web search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageWebSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * Current status of the web search operation + */ status: string; + /** + * Tool call type identifier, always "web_search_call" + */ type: 'web_search_call'; } + /** + * File search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFileSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * List of search queries executed + */ queries: Array; + /** + * Current status of the file search operation + */ status: string; + /** + * Tool call type identifier, always "file_search_call" + */ type: 'file_search_call'; + /** + * (Optional) Search results returned by the file search operation + */ results?: Array<{ [key: string]: boolean | number | string | Array | unknown | null }>; } + /** + * Function tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFunctionToolCall { + /** + * JSON string containing the function arguments + */ arguments: string; + /** + * Unique identifier for the function call + */ call_id: string; + /** + * Name of the function being called + */ name: string; + /** + * Tool call type identifier, always "function_call" + */ type: 'function_call'; + /** + * (Optional) Additional identifier for the tool call + */ id?: string; + /** + * (Optional) Current status of the function call execution + */ status?: string; } + /** + * Model Context Protocol (MCP) call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageMcpCall { + /** + * Unique identifier for this MCP call + */ id: string; + /** + * JSON string containing the MCP call arguments + */ arguments: string; + /** + * Name of the MCP method being called + */ name: string; + /** + * Label identifying the MCP server handling the call + */ server_label: string; + /** + * Tool call type identifier, always "mcp_call" + */ type: 'mcp_call'; + /** + * (Optional) Error message if the MCP call failed + */ error?: string; + /** + * (Optional) Output result from the successful MCP call + */ output?: string; } + /** + * MCP list tools output message containing available tools from an MCP server. + */ export interface OpenAIResponseOutputMessageMcpListTools { + /** + * Unique identifier for this MCP list tools operation + */ id: string; + /** + * Label identifying the MCP server providing the tools + */ server_label: string; + /** + * List of available tools provided by the MCP server + */ tools: Array; + /** + * Tool call type identifier, always "mcp_list_tools" + */ type: 'mcp_list_tools'; } export namespace OpenAIResponseOutputMessageMcpListTools { + /** + * Tool definition returned by MCP list tools operation. + */ export interface Tool { + /** + * JSON schema defining the tool's input parameters + */ input_schema: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * Name of the tool + */ name: string; + /** + * (Optional) Description of what the tool does + */ description?: string; } } + /** + * Text formatting configuration for the response + */ export interface Text { /** - * Configuration for Responses API text format. + * (Optional) Text format configuration specifying output format requirements */ format?: Text.Format; } export namespace Text { /** - * Configuration for Responses API text format. + * (Optional) Text format configuration specifying output format requirements */ export interface Format { /** @@ -1295,9 +2338,18 @@ export namespace ResponseListResponse { } } + /** + * (Optional) Error details if the response generation failed + */ export interface Error { + /** + * Error code identifying the type of failure + */ code: string; + /** + * Human-readable error message describing the failure + */ message: string; } } @@ -1341,6 +2393,9 @@ export interface ResponseCreateParamsBase { temperature?: number; + /** + * Text response configuration for OpenAI responses. + */ text?: ResponseCreateParams.Text; tools?: Array< @@ -1352,37 +2407,88 @@ export interface ResponseCreateParamsBase { } export namespace ResponseCreateParams { + /** + * Web search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageWebSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * Current status of the web search operation + */ status: string; + /** + * Tool call type identifier, always "web_search_call" + */ type: 'web_search_call'; } + /** + * File search tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFileSearchToolCall { + /** + * Unique identifier for this tool call + */ id: string; + /** + * List of search queries executed + */ queries: Array; + /** + * Current status of the file search operation + */ status: string; + /** + * Tool call type identifier, always "file_search_call" + */ type: 'file_search_call'; + /** + * (Optional) Search results returned by the file search operation + */ results?: Array<{ [key: string]: boolean | number | string | Array | unknown | null }>; } + /** + * Function tool call output message for OpenAI responses. + */ export interface OpenAIResponseOutputMessageFunctionToolCall { + /** + * JSON string containing the function arguments + */ arguments: string; + /** + * Unique identifier for the function call + */ call_id: string; + /** + * Name of the function being called + */ name: string; + /** + * Tool call type identifier, always "function_call" + */ type: 'function_call'; + /** + * (Optional) Additional identifier for the tool call + */ id?: string; + /** + * (Optional) Current status of the function call execution + */ status?: string; } @@ -1426,17 +2532,38 @@ export namespace ResponseCreateParams { } export namespace OpenAIResponseMessage { + /** + * Text content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentText { + /** + * The text content of the input message + */ text: string; + /** + * Content type identifier, always "input_text" + */ type: 'input_text'; } + /** + * Image content for input messages in OpenAI response format. + */ export interface OpenAIResponseInputMessageContentImage { + /** + * Level of detail for image processing, can be "low", "high", or "auto" + */ detail: 'low' | 'high' | 'auto'; + /** + * Content type identifier, always "input_image" + */ type: 'input_image'; + /** + * (Optional) URL of the image content + */ image_url?: string; } @@ -1454,25 +2581,58 @@ export namespace ResponseCreateParams { } export namespace UnionMember2 { + /** + * File citation annotation for referencing specific files in response content. + */ export interface OpenAIResponseAnnotationFileCitation { + /** + * Unique identifier of the referenced file + */ file_id: string; + /** + * Name of the referenced file + */ filename: string; + /** + * Position index of the citation within the content + */ index: number; + /** + * Annotation type identifier, always "file_citation" + */ type: 'file_citation'; } + /** + * URL citation annotation for referencing external web resources. + */ export interface OpenAIResponseAnnotationCitation { + /** + * End position of the citation span in the content + */ end_index: number; + /** + * Start position of the citation span in the content + */ start_index: number; + /** + * Title of the referenced web resource + */ title: string; + /** + * Annotation type identifier, always "url_citation" + */ type: 'url_citation'; + /** + * URL of the referenced web resource + */ url: string; } @@ -1500,16 +2660,19 @@ export namespace ResponseCreateParams { } } + /** + * Text response configuration for OpenAI responses. + */ export interface Text { /** - * Configuration for Responses API text format. + * (Optional) Text format configuration specifying output format requirements */ format?: Text.Format; } export namespace Text { /** - * Configuration for Responses API text format. + * (Optional) Text format configuration specifying output format requirements */ export interface Format { /** @@ -1541,66 +2704,156 @@ export namespace ResponseCreateParams { } } + /** + * Web search tool configuration for OpenAI response inputs. + */ export interface OpenAIResponseInputToolWebSearch { + /** + * Web search tool type variant to use + */ type: 'web_search' | 'web_search_preview' | 'web_search_preview_2025_03_11'; + /** + * (Optional) Size of search context, must be "low", "medium", or "high" + */ search_context_size?: string; } + /** + * File search tool configuration for OpenAI response inputs. + */ export interface OpenAIResponseInputToolFileSearch { + /** + * Tool type identifier, always "file_search" + */ type: 'file_search'; + /** + * List of vector store identifiers to search within + */ vector_store_ids: Array; + /** + * (Optional) Additional filters to apply to the search + */ filters?: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * (Optional) Maximum number of search results to return (1-50) + */ max_num_results?: number; + /** + * (Optional) Options for ranking and scoring search results + */ ranking_options?: OpenAIResponseInputToolFileSearch.RankingOptions; } export namespace OpenAIResponseInputToolFileSearch { + /** + * (Optional) Options for ranking and scoring search results + */ export interface RankingOptions { + /** + * (Optional) Name of the ranking algorithm to use + */ ranker?: string; + /** + * (Optional) Minimum relevance score threshold for results + */ score_threshold?: number; } } + /** + * Function tool configuration for OpenAI response inputs. + */ export interface OpenAIResponseInputToolFunction { + /** + * Name of the function that can be called + */ name: string; + /** + * Tool type identifier, always "function" + */ type: 'function'; + /** + * (Optional) Description of what the function does + */ description?: string; + /** + * (Optional) JSON schema defining the function's parameters + */ parameters?: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * (Optional) Whether to enforce strict parameter validation + */ strict?: boolean; } + /** + * Model Context Protocol (MCP) tool configuration for OpenAI response inputs. + */ export interface OpenAIResponseInputToolMcp { + /** + * Approval requirement for tool calls ("always", "never", or filter) + */ require_approval: 'always' | 'never' | OpenAIResponseInputToolMcp.ApprovalFilter; + /** + * Label to identify this MCP server + */ server_label: string; + /** + * URL endpoint of the MCP server + */ server_url: string; + /** + * Tool type identifier, always "mcp" + */ type: 'mcp'; + /** + * (Optional) Restriction on which tools can be used from this server + */ allowed_tools?: Array | OpenAIResponseInputToolMcp.AllowedToolsFilter; + /** + * (Optional) HTTP headers to include when connecting to the server + */ headers?: { [key: string]: boolean | number | string | Array | unknown | null }; } export namespace OpenAIResponseInputToolMcp { + /** + * Filter configuration for MCP tool approval requirements. + */ export interface ApprovalFilter { + /** + * (Optional) List of tool names that always require approval + */ always?: Array; + /** + * (Optional) List of tool names that never require approval + */ never?: Array; } + /** + * Filter configuration for restricting which MCP tools can be used. + */ export interface AllowedToolsFilter { + /** + * (Optional) List of specific tool names that are allowed + */ tool_names?: Array; } } diff --git a/src/resources/routes.ts b/src/resources/routes.ts index f5c533e..98d5dfe 100644 --- a/src/resources/routes.ts +++ b/src/resources/routes.ts @@ -6,7 +6,7 @@ import * as InspectAPI from './inspect'; export class Routes extends APIResource { /** - * List all routes. + * List all available API routes with their methods and implementing providers. */ list(options?: Core.RequestOptions): Core.APIPromise { return ( @@ -15,10 +15,19 @@ export class Routes extends APIResource { } } +/** + * Response containing a list of all available API routes. + */ export interface ListRoutesResponse { + /** + * List of available route information objects + */ data: RouteListResponse; } +/** + * List of available route information objects + */ export type RouteListResponse = Array; export declare namespace Routes { diff --git a/src/resources/safety.ts b/src/resources/safety.ts index f892930..d41b2c7 100644 --- a/src/resources/safety.ts +++ b/src/resources/safety.ts @@ -13,7 +13,13 @@ export class Safety extends APIResource { } } +/** + * Response from running a safety shield. + */ export interface RunShieldResponse { + /** + * (Optional) Safety violation detected by the shield, if any + */ violation?: Shared.SafetyViolation; } diff --git a/src/resources/scoring-functions.ts b/src/resources/scoring-functions.ts index 8037e65..e4e3c33 100644 --- a/src/resources/scoring-functions.ts +++ b/src/resources/scoring-functions.ts @@ -39,6 +39,9 @@ export interface ListScoringFunctionsResponse { data: ScoringFunctionListResponse; } +/** + * A scoring function resource for evaluating model outputs. + */ export interface ScoringFn { identifier: string; @@ -48,50 +51,98 @@ export interface ScoringFn { return_type: Shared.ReturnType; + /** + * The resource type, always scoring_function + */ type: 'scoring_function'; description?: string; + /** + * Parameters for LLM-as-judge scoring function configuration. + */ params?: ScoringFnParams; provider_resource_id?: string; } +/** + * Parameters for LLM-as-judge scoring function configuration. + */ export type ScoringFnParams = | ScoringFnParams.LlmAsJudgeScoringFnParams | ScoringFnParams.RegexParserScoringFnParams | ScoringFnParams.BasicScoringFnParams; export namespace ScoringFnParams { + /** + * Parameters for LLM-as-judge scoring function configuration. + */ export interface LlmAsJudgeScoringFnParams { + /** + * Aggregation functions to apply to the scores of each row + */ aggregation_functions: Array< 'average' | 'weighted_average' | 'median' | 'categorical_count' | 'accuracy' >; + /** + * Identifier of the LLM model to use as a judge for scoring + */ judge_model: string; + /** + * Regexes to extract the answer from generated response + */ judge_score_regexes: Array; + /** + * The type of scoring function parameters, always llm_as_judge + */ type: 'llm_as_judge'; + /** + * (Optional) Custom prompt template for the judge model + */ prompt_template?: string; } + /** + * Parameters for regex parser scoring function configuration. + */ export interface RegexParserScoringFnParams { + /** + * Aggregation functions to apply to the scores of each row + */ aggregation_functions: Array< 'average' | 'weighted_average' | 'median' | 'categorical_count' | 'accuracy' >; + /** + * Regex to extract the answer from generated response + */ parsing_regexes: Array; + /** + * The type of scoring function parameters, always regex_parser + */ type: 'regex_parser'; } + /** + * Parameters for basic scoring function configuration. + */ export interface BasicScoringFnParams { + /** + * Aggregation functions to apply to the scores of each row + */ aggregation_functions: Array< 'average' | 'weighted_average' | 'median' | 'categorical_count' | 'accuracy' >; + /** + * The type of scoring function parameters, always basic + */ type: 'basic'; } } diff --git a/src/resources/scoring.ts b/src/resources/scoring.ts index 55652e3..c2e569e 100644 --- a/src/resources/scoring.ts +++ b/src/resources/scoring.ts @@ -34,9 +34,18 @@ export interface ScoringScoreResponse { results: { [key: string]: Shared.ScoringResult }; } +/** + * Response from batch scoring operations on datasets. + */ export interface ScoringScoreBatchResponse { + /** + * A map of scoring function name to ScoringResult + */ results: { [key: string]: Shared.ScoringResult }; + /** + * (Optional) The identifier of the dataset that was scored + */ dataset_id?: string; } diff --git a/src/resources/shared.ts b/src/resources/shared.ts index ae3a208..7f6fa8b 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -105,7 +105,13 @@ export namespace AgentConfig { } } +/** + * Response from a batch completion request. + */ export interface BatchCompletion { + /** + * List of completion responses, one for each input in the batch + */ batch: Array; } @@ -123,15 +129,30 @@ export interface ChatCompletionResponse { */ logprobs?: Array; + /** + * (Optional) List of metrics associated with the API response + */ metrics?: Array; } export namespace ChatCompletionResponse { + /** + * A metric value included in API responses. + */ export interface Metric { + /** + * The name of the metric + */ metric: string; + /** + * The numeric value of the metric + */ value: number; + /** + * (Optional) The unit of measurement for the metric value + */ unit?: string; } } @@ -166,26 +187,59 @@ export interface CompletionMessage { tool_calls?: Array; } +/** + * A text content delta for streaming responses. + */ export type ContentDelta = ContentDelta.TextDelta | ContentDelta.ImageDelta | ContentDelta.ToolCallDelta; export namespace ContentDelta { + /** + * A text content delta for streaming responses. + */ export interface TextDelta { + /** + * The incremental text content + */ text: string; + /** + * Discriminator type of the delta. Always "text" + */ type: 'text'; } + /** + * An image content delta for streaming responses. + */ export interface ImageDelta { + /** + * The incremental image data as bytes + */ image: string; + /** + * Discriminator type of the delta. Always "image" + */ type: 'image'; } + /** + * A tool call content delta for streaming responses. + */ export interface ToolCallDelta { + /** + * Current parsing status of the tool call + */ parse_status: 'started' | 'in_progress' | 'failed' | 'succeeded'; + /** + * Either an in-progress tool call string or the final parsed tool call + */ tool_call: Shared.ToolCallOrString; + /** + * Discriminator type of the delta. Always "tool_call" + */ type: 'tool_call'; } } @@ -259,6 +313,9 @@ export namespace Document { * Note that URL could have length limits. */ export interface URL { + /** + * The URL string pointing to the resource + */ uri: string; } } @@ -279,7 +336,13 @@ export namespace Document { type: 'text'; } + /** + * A URL reference to external content. + */ export interface URL { + /** + * The URL string pointing to the resource + */ uri: string; } } @@ -332,6 +395,9 @@ export namespace InterleavedContent { * Note that URL could have length limits. */ export interface URL { + /** + * The URL string pointing to the resource + */ uri: string; } } @@ -399,6 +465,9 @@ export namespace InterleavedContentItem { * Note that URL could have length limits. */ export interface URL { + /** + * The URL string pointing to the resource + */ uri: string; } } @@ -425,6 +494,9 @@ export namespace InterleavedContentItem { */ export type Message = UserMessage | SystemMessage | ToolResponseMessage | CompletionMessage; +/** + * Parameter type for string values. + */ export type ParamType = | ParamType.StringType | ParamType.NumberType @@ -438,43 +510,103 @@ export type ParamType = | ParamType.AgentTurnInputType; export namespace ParamType { + /** + * Parameter type for string values. + */ export interface StringType { + /** + * Discriminator type. Always "string" + */ type: 'string'; } + /** + * Parameter type for numeric values. + */ export interface NumberType { + /** + * Discriminator type. Always "number" + */ type: 'number'; } + /** + * Parameter type for boolean values. + */ export interface BooleanType { + /** + * Discriminator type. Always "boolean" + */ type: 'boolean'; } + /** + * Parameter type for array values. + */ export interface ArrayType { + /** + * Discriminator type. Always "array" + */ type: 'array'; } + /** + * Parameter type for object values. + */ export interface ObjectType { + /** + * Discriminator type. Always "object" + */ type: 'object'; } + /** + * Parameter type for JSON values. + */ export interface JsonType { + /** + * Discriminator type. Always "json" + */ type: 'json'; } + /** + * Parameter type for union values. + */ export interface UnionType { + /** + * Discriminator type. Always "union" + */ type: 'union'; } + /** + * Parameter type for chat completion input. + */ export interface ChatCompletionInputType { + /** + * Discriminator type. Always "chat_completion_input" + */ type: 'chat_completion_input'; } + /** + * Parameter type for completion input. + */ export interface CompletionInputType { + /** + * Discriminator type. Always "completion_input" + */ type: 'completion_input'; } + /** + * Parameter type for agent turn input. + */ export interface AgentTurnInputType { + /** + * Discriminator type. Always "agent_turn_input" + */ type: 'agent_turn_input'; } } @@ -510,7 +642,7 @@ export interface QueryConfig { * Search mode for retrieval—either "vector", "keyword", or "hybrid". Default * "vector". */ - mode?: string; + mode?: 'vector' | 'keyword' | 'hybrid'; /** * Configuration for the ranker to use in hybrid search. Defaults to RRF ranker. @@ -525,8 +657,7 @@ export namespace QueryConfig { export interface RrfRanker { /** * The impact factor for RRF scoring. Higher values give more weight to - * higher-ranked results. Must be greater than 0. Default of 60 is from the - * original RRF paper (Cormack et al., 2009). + * higher-ranked results. Must be greater than 0 */ impact_factor: number; @@ -553,31 +684,61 @@ export namespace QueryConfig { } } +/** + * Configuration for the default RAG query generator. + */ export type QueryGeneratorConfig = | QueryGeneratorConfig.DefaultRagQueryGeneratorConfig | QueryGeneratorConfig.LlmragQueryGeneratorConfig; export namespace QueryGeneratorConfig { + /** + * Configuration for the default RAG query generator. + */ export interface DefaultRagQueryGeneratorConfig { + /** + * String separator used to join query terms + */ separator: string; + /** + * Type of query generator, always 'default' + */ type: 'default'; } + /** + * Configuration for the LLM-based RAG query generator. + */ export interface LlmragQueryGeneratorConfig { + /** + * Name of the language model to use for query generation + */ model: string; + /** + * Template string for formatting the query generation prompt + */ template: string; + /** + * Type of query generator, always 'llm' + */ type: 'llm'; } } +/** + * Result of a RAG query containing retrieved content and metadata. + */ export interface QueryResult { + /** + * Additional metadata about the query result + */ metadata: { [key: string]: boolean | number | string | Array | unknown | null }; /** - * A image content item + * (Optional) The retrieved content from the query */ content?: InterleavedContent; } @@ -634,11 +795,24 @@ export interface ReturnType { | 'agent_turn_input'; } +/** + * Details of a safety violation detected by content moderation. + */ export interface SafetyViolation { + /** + * Additional metadata including specific violation codes for debugging and + * telemetry + */ metadata: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * Severity level of the violation + */ violation_level: 'info' | 'warn' | 'error'; + /** + * (Optional) Message to convey to the user about the violation + */ user_message?: string; } @@ -675,21 +849,50 @@ export interface SamplingParams { } export namespace SamplingParams { + /** + * Greedy sampling strategy that selects the highest probability token at each + * step. + */ export interface GreedySamplingStrategy { + /** + * Must be "greedy" to identify this sampling strategy + */ type: 'greedy'; } + /** + * Top-p (nucleus) sampling strategy that samples from the smallest set of tokens + * with cumulative probability >= p. + */ export interface TopPSamplingStrategy { + /** + * Must be "top_p" to identify this sampling strategy + */ type: 'top_p'; + /** + * Controls randomness in sampling. Higher values increase randomness + */ temperature?: number; + /** + * Cumulative probability threshold for nucleus sampling. Defaults to 0.95 + */ top_p?: number; } + /** + * Top-k sampling strategy that restricts sampling to the k most likely tokens. + */ export interface TopKSamplingStrategy { + /** + * Number of top tokens to consider for sampling. Must be at least 1 + */ top_k: number; + /** + * Must be "top_k" to identify this sampling strategy + */ type: 'top_k'; } } @@ -746,6 +949,9 @@ export interface ToolCall { arguments_json?: string; } +/** + * Either an in-progress tool call string or the final parsed tool call + */ export type ToolCallOrString = string | ToolCall; export interface ToolParamDefinition { diff --git a/src/resources/shields.ts b/src/resources/shields.ts index b53dfae..d72afe9 100644 --- a/src/resources/shields.ts +++ b/src/resources/shields.ts @@ -33,15 +33,21 @@ export interface ListShieldsResponse { } /** - * A safety shield resource that can be used to check content + * A safety shield resource that can be used to check content. */ export interface Shield { identifier: string; provider_id: string; + /** + * The resource type, always shield + */ type: 'shield'; + /** + * (Optional) Configuration parameters for the shield + */ params?: { [key: string]: boolean | number | string | Array | unknown | null }; provider_resource_id?: string; diff --git a/src/resources/synthetic-data-generation.ts b/src/resources/synthetic-data-generation.ts index 98c10a1..852eb81 100644 --- a/src/resources/synthetic-data-generation.ts +++ b/src/resources/synthetic-data-generation.ts @@ -5,6 +5,9 @@ import * as Core from '../core'; import * as Shared from './shared'; export class SyntheticDataGeneration extends APIResource { + /** + * Generate synthetic data based on input dialogs and apply filtering. + */ generate( body: SyntheticDataGenerationGenerateParams, options?: Core.RequestOptions, @@ -18,19 +21,33 @@ export class SyntheticDataGeneration extends APIResource { * tuples that pass the threshold. */ export interface SyntheticDataGenerationResponse { + /** + * List of generated synthetic data samples that passed the filtering criteria + */ synthetic_data: Array<{ [key: string]: boolean | number | string | Array | unknown | null }>; + /** + * (Optional) Statistical information about the generation process and filtering + * results + */ statistics?: { [key: string]: boolean | number | string | Array | unknown | null }; } export interface SyntheticDataGenerationGenerateParams { + /** + * List of conversation messages to use as input for synthetic data generation + */ dialogs: Array; /** - * The type of filtering function. + * Type of filtering to apply to generated synthetic data samples */ filtering_function: 'none' | 'random' | 'top_k' | 'top_p' | 'top_k_top_p' | 'sigmoid'; + /** + * (Optional) The identifier of the model to use. The model must be registered with + * Llama Stack and available via the /models endpoint + */ model?: string; } diff --git a/src/resources/telemetry.ts b/src/resources/telemetry.ts index c1dea80..3e47e3c 100644 --- a/src/resources/telemetry.ts +++ b/src/resources/telemetry.ts @@ -91,152 +91,366 @@ export class Telemetry extends APIResource { } } +/** + * An unstructured log event containing a simple text message. + */ export type Event = Event.UnstructuredLogEvent | Event.MetricEvent | Event.StructuredLogEvent; export namespace Event { + /** + * An unstructured log event containing a simple text message. + */ export interface UnstructuredLogEvent { + /** + * The log message text + */ message: string; + /** + * The severity level of the log message + */ severity: 'verbose' | 'debug' | 'info' | 'warn' | 'error' | 'critical'; + /** + * Unique identifier for the span this event belongs to + */ span_id: string; + /** + * Timestamp when the event occurred + */ timestamp: string; + /** + * Unique identifier for the trace this event belongs to + */ trace_id: string; + /** + * Event type identifier set to UNSTRUCTURED_LOG + */ type: 'unstructured_log'; + /** + * (Optional) Key-value pairs containing additional metadata about the event + */ attributes?: { [key: string]: string | number | boolean | null }; } + /** + * A metric event containing a measured value. + */ export interface MetricEvent { + /** + * The name of the metric being measured + */ metric: string; + /** + * Unique identifier for the span this event belongs to + */ span_id: string; + /** + * Timestamp when the event occurred + */ timestamp: string; + /** + * Unique identifier for the trace this event belongs to + */ trace_id: string; + /** + * Event type identifier set to METRIC + */ type: 'metric'; + /** + * The unit of measurement for the metric value + */ unit: string; + /** + * The numeric value of the metric measurement + */ value: number; + /** + * (Optional) Key-value pairs containing additional metadata about the event + */ attributes?: { [key: string]: string | number | boolean | null }; } + /** + * A structured log event containing typed payload data. + */ export interface StructuredLogEvent { + /** + * The structured payload data for the log event + */ payload: StructuredLogEvent.SpanStartPayload | StructuredLogEvent.SpanEndPayload; + /** + * Unique identifier for the span this event belongs to + */ span_id: string; + /** + * Timestamp when the event occurred + */ timestamp: string; + /** + * Unique identifier for the trace this event belongs to + */ trace_id: string; + /** + * Event type identifier set to STRUCTURED_LOG + */ type: 'structured_log'; + /** + * (Optional) Key-value pairs containing additional metadata about the event + */ attributes?: { [key: string]: string | number | boolean | null }; } export namespace StructuredLogEvent { + /** + * Payload for a span start event. + */ export interface SpanStartPayload { + /** + * Human-readable name describing the operation this span represents + */ name: string; + /** + * Payload type identifier set to SPAN_START + */ type: 'span_start'; + /** + * (Optional) Unique identifier for the parent span, if this is a child span + */ parent_span_id?: string; } + /** + * Payload for a span end event. + */ export interface SpanEndPayload { + /** + * The final status of the span indicating success or failure + */ status: 'ok' | 'error'; + /** + * Payload type identifier set to SPAN_END + */ type: 'span_end'; } } } +/** + * A condition for filtering query results. + */ export interface QueryCondition { + /** + * The attribute key to filter on + */ key: string; + /** + * The comparison operator to apply + */ op: 'eq' | 'ne' | 'gt' | 'lt'; + /** + * The value to compare against + */ value: boolean | number | string | Array | unknown | null; } +/** + * Response containing a list of spans. + */ export interface QuerySpansResponse { + /** + * List of spans matching the query criteria + */ data: TelemetryQuerySpansResponse; } +/** + * A span that includes status information. + */ export interface SpanWithStatus { + /** + * Human-readable name describing the operation this span represents + */ name: string; + /** + * Unique identifier for the span + */ span_id: string; + /** + * Timestamp when the operation began + */ start_time: string; + /** + * Unique identifier for the trace this span belongs to + */ trace_id: string; + /** + * (Optional) Key-value pairs containing additional metadata about the span + */ attributes?: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * (Optional) Timestamp when the operation finished, if completed + */ end_time?: string; + /** + * (Optional) Unique identifier for the parent span, if this is a child span + */ parent_span_id?: string; + /** + * (Optional) The current status of the span + */ status?: 'ok' | 'error'; } +/** + * A trace representing the complete execution path of a request across multiple + * operations. + */ export interface Trace { + /** + * Unique identifier for the root span that started this trace + */ root_span_id: string; + /** + * Timestamp when the trace began + */ start_time: string; + /** + * Unique identifier for the trace + */ trace_id: string; + /** + * (Optional) Timestamp when the trace finished, if completed + */ end_time?: string; } +/** + * A span representing a single operation within a trace. + */ export interface TelemetryGetSpanResponse { + /** + * Human-readable name describing the operation this span represents + */ name: string; + /** + * Unique identifier for the span + */ span_id: string; + /** + * Timestamp when the operation began + */ start_time: string; + /** + * Unique identifier for the trace this span belongs to + */ trace_id: string; + /** + * (Optional) Key-value pairs containing additional metadata about the span + */ attributes?: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * (Optional) Timestamp when the operation finished, if completed + */ end_time?: string; + /** + * (Optional) Unique identifier for the parent span, if this is a child span + */ parent_span_id?: string; } +/** + * Dictionary mapping span IDs to spans with status information + */ export type TelemetryGetSpanTreeResponse = { [key: string]: SpanWithStatus }; +/** + * List of spans matching the query criteria + */ export type TelemetryQuerySpansResponse = Array; export namespace TelemetryQuerySpansResponse { + /** + * A span representing a single operation within a trace. + */ export interface TelemetryQuerySpansResponseItem { + /** + * Human-readable name describing the operation this span represents + */ name: string; + /** + * Unique identifier for the span + */ span_id: string; + /** + * Timestamp when the operation began + */ start_time: string; + /** + * Unique identifier for the trace this span belongs to + */ trace_id: string; + /** + * (Optional) Key-value pairs containing additional metadata about the span + */ attributes?: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * (Optional) Timestamp when the operation finished, if completed + */ end_time?: string; + /** + * (Optional) Unique identifier for the parent span, if this is a child span + */ parent_span_id?: string; } } +/** + * List of traces matching the query criteria + */ export type TelemetryQueryTracesResponse = Array; export interface TelemetryGetSpanTreeParams { diff --git a/src/resources/tool-runtime/rag-tool.ts b/src/resources/tool-runtime/rag-tool.ts index 9bcd4b2..b9f6669 100644 --- a/src/resources/tool-runtime/rag-tool.ts +++ b/src/resources/tool-runtime/rag-tool.ts @@ -6,7 +6,7 @@ import * as Shared from '../shared'; export class RagTool extends APIResource { /** - * Index documents so they can be used by the RAG system + * Index documents so they can be used by the RAG system. */ insert(body: RagToolInsertParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/v1/tool-runtime/rag-tool/insert', { @@ -17,7 +17,7 @@ export class RagTool extends APIResource { } /** - * Query the RAG system for context; typically invoked by the agent + * Query the RAG system for context; typically invoked by the agent. */ query(body: RagToolQueryParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/v1/tool-runtime/rag-tool/query', { body, ...options }); @@ -25,23 +25,35 @@ export class RagTool extends APIResource { } export interface RagToolInsertParams { + /** + * (Optional) Size in tokens for document chunking during indexing + */ chunk_size_in_tokens: number; + /** + * List of documents to index in the RAG system + */ documents: Array; + /** + * ID of the vector database to store the document embeddings + */ vector_db_id: string; } export interface RagToolQueryParams { /** - * A image content item + * The query content to search for in the indexed documents */ content: Shared.InterleavedContent; + /** + * List of vector database IDs to search within + */ vector_db_ids: Array; /** - * Configuration for the RAG query generation. + * (Optional) Configuration parameters for the query operation */ query_config?: Shared.QueryConfig; } diff --git a/src/resources/tool-runtime/tool-runtime.ts b/src/resources/tool-runtime/tool-runtime.ts index a49f8fd..ca1a6c8 100644 --- a/src/resources/tool-runtime/tool-runtime.ts +++ b/src/resources/tool-runtime/tool-runtime.ts @@ -43,43 +43,91 @@ export class ToolRuntime extends APIResource { } } +/** + * Tool definition used in runtime contexts. + */ export interface ToolDef { + /** + * Name of the tool + */ name: string; + /** + * (Optional) Human-readable description of what the tool does + */ description?: string; + /** + * (Optional) Additional metadata about the tool + */ metadata?: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * (Optional) List of parameters this tool accepts + */ parameters?: Array; } export namespace ToolDef { + /** + * Parameter definition for a tool. + */ export interface Parameter { + /** + * Human-readable description of what the parameter does + */ description: string; + /** + * Name of the parameter + */ name: string; + /** + * Type of the parameter (e.g., string, integer) + */ parameter_type: string; + /** + * Whether this parameter is required for tool invocation + */ required: boolean; + /** + * (Optional) Default value for the parameter if not provided + */ default?: boolean | number | string | Array | unknown | null; } } +/** + * Result of a tool invocation. + */ export interface ToolInvocationResult { /** - * A image content item + * (Optional) The output content from the tool execution */ content?: Shared.InterleavedContent; + /** + * (Optional) Numeric error code if the tool execution failed + */ error_code?: number; + /** + * (Optional) Error message if the tool execution failed + */ error_message?: string; + /** + * (Optional) Additional metadata about the tool execution + */ metadata?: { [key: string]: boolean | number | string | Array | unknown | null }; } +/** + * List of tool definitions + */ export type ToolRuntimeListToolsResponse = Array; export interface ToolRuntimeInvokeToolParams { @@ -111,6 +159,9 @@ export namespace ToolRuntimeListToolsParams { * The MCP endpoint to use for the tool group. */ export interface McpEndpoint { + /** + * The URL string pointing to the resource + */ uri: string; } } diff --git a/src/resources/toolgroups.ts b/src/resources/toolgroups.ts index 5560263..8e15ac2 100644 --- a/src/resources/toolgroups.ts +++ b/src/resources/toolgroups.ts @@ -42,30 +42,57 @@ export class Toolgroups extends APIResource { } } +/** + * Response containing a list of tool groups. + */ export interface ListToolGroupsResponse { + /** + * List of tool groups + */ data: ToolgroupListResponse; } +/** + * A group of related tools managed together. + */ export interface ToolGroup { identifier: string; provider_id: string; + /** + * Type of resource, always 'tool_group' + */ type: 'tool_group'; + /** + * (Optional) Additional arguments for the tool group + */ args?: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * (Optional) Model Context Protocol endpoint for remote tools + */ mcp_endpoint?: ToolGroup.McpEndpoint; provider_resource_id?: string; } export namespace ToolGroup { + /** + * (Optional) Model Context Protocol endpoint for remote tools + */ export interface McpEndpoint { + /** + * The URL string pointing to the resource + */ uri: string; } } +/** + * List of tool groups + */ export type ToolgroupListResponse = Array; export interface ToolgroupRegisterParams { @@ -95,6 +122,9 @@ export namespace ToolgroupRegisterParams { * The MCP endpoint to use for the tool group. */ export interface McpEndpoint { + /** + * The URL string pointing to the resource + */ uri: string; } } diff --git a/src/resources/tools.ts b/src/resources/tools.ts index a40dab8..ba35360 100644 --- a/src/resources/tools.ts +++ b/src/resources/tools.ts @@ -30,42 +30,87 @@ export class Tools extends APIResource { } } +/** + * Response containing a list of tools. + */ export interface ListToolsResponse { + /** + * List of tools + */ data: ToolListResponse; } +/** + * A tool that can be invoked by agents. + */ export interface Tool { + /** + * Human-readable description of what the tool does + */ description: string; identifier: string; + /** + * List of parameters this tool accepts + */ parameters: Array; provider_id: string; + /** + * ID of the tool group this tool belongs to + */ toolgroup_id: string; + /** + * Type of resource, always 'tool' + */ type: 'tool'; + /** + * (Optional) Additional metadata about the tool + */ metadata?: { [key: string]: boolean | number | string | Array | unknown | null }; provider_resource_id?: string; } export namespace Tool { + /** + * Parameter definition for a tool. + */ export interface Parameter { + /** + * Human-readable description of what the parameter does + */ description: string; + /** + * Name of the parameter + */ name: string; + /** + * Type of the parameter (e.g., string, integer) + */ parameter_type: string; + /** + * Whether this parameter is required for tool invocation + */ required: boolean; + /** + * (Optional) Default value for the parameter if not provided + */ default?: boolean | number | string | Array | unknown | null; } } +/** + * List of tools + */ export type ToolListResponse = Array; export interface ToolListParams { diff --git a/src/resources/vector-dbs.ts b/src/resources/vector-dbs.ts index 55644d0..3004227 100644 --- a/src/resources/vector-dbs.ts +++ b/src/resources/vector-dbs.ts @@ -41,54 +41,105 @@ export class VectorDBs extends APIResource { } } +/** + * Response from listing vector databases. + */ export interface ListVectorDBsResponse { + /** + * List of vector databases + */ data: VectorDBListResponse; } +/** + * Vector database resource for storing and querying vector embeddings. + */ export interface VectorDBRetrieveResponse { + /** + * Dimension of the embedding vectors + */ embedding_dimension: number; + /** + * Name of the embedding model to use for vector generation + */ embedding_model: string; identifier: string; provider_id: string; + /** + * Type of resource, always 'vector_db' for vector databases + */ type: 'vector_db'; provider_resource_id?: string; + + vector_db_name?: string; } +/** + * List of vector databases + */ export type VectorDBListResponse = Array; export namespace VectorDBListResponse { + /** + * Vector database resource for storing and querying vector embeddings. + */ export interface VectorDBListResponseItem { + /** + * Dimension of the embedding vectors + */ embedding_dimension: number; + /** + * Name of the embedding model to use for vector generation + */ embedding_model: string; identifier: string; provider_id: string; + /** + * Type of resource, always 'vector_db' for vector databases + */ type: 'vector_db'; provider_resource_id?: string; + + vector_db_name?: string; } } +/** + * Vector database resource for storing and querying vector embeddings. + */ export interface VectorDBRegisterResponse { + /** + * Dimension of the embedding vectors + */ embedding_dimension: number; + /** + * Name of the embedding model to use for vector generation + */ embedding_model: string; identifier: string; provider_id: string; + /** + * Type of resource, always 'vector_db' for vector databases + */ type: 'vector_db'; provider_resource_id?: string; + + vector_db_name?: string; } export interface VectorDBRegisterParams { @@ -116,6 +167,11 @@ export interface VectorDBRegisterParams { * The identifier of the vector database in the provider. */ provider_vector_db_id?: string; + + /** + * The name of the vector database. + */ + vector_db_name?: string; } export declare namespace VectorDBs { diff --git a/src/resources/vector-io.ts b/src/resources/vector-io.ts index d6e6c33..6ff531a 100644 --- a/src/resources/vector-io.ts +++ b/src/resources/vector-io.ts @@ -24,9 +24,18 @@ export class VectorIo extends APIResource { } } +/** + * Response from querying chunks in a vector database. + */ export interface QueryChunksResponse { + /** + * List of content chunks returned from the query + */ chunks: Array; + /** + * Relevance scores corresponding to each returned chunk + */ scores: Array; } diff --git a/src/resources/vector-stores/files.ts b/src/resources/vector-stores/files.ts index c3c10be..a0cbdab 100644 --- a/src/resources/vector-stores/files.ts +++ b/src/resources/vector-stores/files.ts @@ -89,65 +89,140 @@ export class Files extends APIResource { * OpenAI Vector Store File object. */ export interface VectorStoreFile { + /** + * Unique identifier for the file + */ id: string; + /** + * Key-value attributes associated with the file + */ attributes: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * Strategy used for splitting the file into chunks + */ chunking_strategy: | VectorStoreFile.VectorStoreChunkingStrategyAuto | VectorStoreFile.VectorStoreChunkingStrategyStatic; + /** + * Timestamp when the file was added to the vector store + */ created_at: number; + /** + * Object type identifier, always "vector_store.file" + */ object: string; + /** + * Current processing status of the file + */ status: 'completed' | 'in_progress' | 'cancelled' | 'failed'; + /** + * Storage space used by this file in bytes + */ usage_bytes: number; + /** + * ID of the vector store containing this file + */ vector_store_id: string; + /** + * (Optional) Error information if file processing failed + */ last_error?: VectorStoreFile.LastError; } export namespace VectorStoreFile { + /** + * Automatic chunking strategy for vector store files. + */ export interface VectorStoreChunkingStrategyAuto { + /** + * Strategy type, always "auto" for automatic chunking + */ type: 'auto'; } + /** + * Static chunking strategy with configurable parameters. + */ export interface VectorStoreChunkingStrategyStatic { + /** + * Configuration parameters for the static chunking strategy + */ static: VectorStoreChunkingStrategyStatic.Static; + /** + * Strategy type, always "static" for static chunking + */ type: 'static'; } export namespace VectorStoreChunkingStrategyStatic { + /** + * Configuration parameters for the static chunking strategy + */ export interface Static { + /** + * Number of tokens to overlap between adjacent chunks + */ chunk_overlap_tokens: number; + /** + * Maximum number of tokens per chunk, must be between 100 and 4096 + */ max_chunk_size_tokens: number; } } + /** + * (Optional) Error information if file processing failed + */ export interface LastError { + /** + * Error code indicating the type of failure + */ code: 'server_error' | 'rate_limit_exceeded'; + /** + * Human-readable error message describing the failure + */ message: string; } } /** - * Response from listing vector stores. + * Response from listing files in a vector store. */ export interface FileListResponse { + /** + * List of vector store file objects + */ data: Array; + /** + * Whether there are more files available beyond this page + */ has_more: boolean; + /** + * Object type identifier, always "list" + */ object: string; + /** + * (Optional) ID of the first file in the list for pagination + */ first_id?: string; + /** + * (Optional) ID of the last file in the list for pagination + */ last_id?: string; } @@ -155,10 +230,19 @@ export interface FileListResponse { * Response from deleting a vector store file. */ export interface FileDeleteResponse { + /** + * Unique identifier of the deleted file + */ id: string; + /** + * Whether the deletion operation was successful + */ deleted: boolean; + /** + * Object type identifier for the deletion response + */ object: string; } @@ -166,19 +250,40 @@ export interface FileDeleteResponse { * Response from retrieving the contents of a vector store file. */ export interface FileContentResponse { + /** + * Key-value attributes associated with the file + */ attributes: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * List of content items from the file + */ content: Array; + /** + * Unique identifier for the file + */ file_id: string; + /** + * Name of the file + */ filename: string; } export namespace FileContentResponse { + /** + * Content item from a vector store file or search result. + */ export interface Content { + /** + * The actual text content + */ text: string; + /** + * Content type, currently only "text" is supported + */ type: 'text'; } } @@ -203,20 +308,44 @@ export interface FileCreateParams { } export namespace FileCreateParams { + /** + * Automatic chunking strategy for vector store files. + */ export interface VectorStoreChunkingStrategyAuto { + /** + * Strategy type, always "auto" for automatic chunking + */ type: 'auto'; } + /** + * Static chunking strategy with configurable parameters. + */ export interface VectorStoreChunkingStrategyStatic { + /** + * Configuration parameters for the static chunking strategy + */ static: VectorStoreChunkingStrategyStatic.Static; + /** + * Strategy type, always "static" for static chunking + */ type: 'static'; } export namespace VectorStoreChunkingStrategyStatic { + /** + * Configuration parameters for the static chunking strategy + */ export interface Static { + /** + * Number of tokens to overlap between adjacent chunks + */ chunk_overlap_tokens: number; + /** + * Maximum number of tokens per chunk, must be between 100 and 4096 + */ max_chunk_size_tokens: number; } } @@ -230,14 +359,33 @@ export interface FileUpdateParams { } export interface FileListParams { + /** + * (Optional) A cursor for use in pagination. `after` is an object ID that defines + * your place in the list. + */ after?: string; + /** + * (Optional) A cursor for use in pagination. `before` is an object ID that defines + * your place in the list. + */ before?: string; + /** + * (Optional) Filter by file status to only return files with the specified status. + */ filter?: 'completed' | 'in_progress' | 'cancelled' | 'failed'; + /** + * (Optional) A limit on the number of objects to be returned. Limit can range + * between 1 and 100, and the default is 20. + */ limit?: number; + /** + * (Optional) Sort order by the `created_at` timestamp of the objects. `asc` for + * ascending order and `desc` for descending order. + */ order?: string; } diff --git a/src/resources/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts index 04efc15..90c672d 100644 --- a/src/resources/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -85,14 +85,29 @@ export class VectorStores extends APIResource { * Response from listing vector stores. */ export interface ListVectorStoresResponse { + /** + * List of vector store objects + */ data: Array; + /** + * Whether there are more vector stores available beyond this page + */ has_more: boolean; + /** + * Object type identifier, always "list" + */ object: string; + /** + * (Optional) ID of the first vector store in the list for pagination + */ first_id?: string; + /** + * (Optional) ID of the last vector store in the list for pagination + */ last_id?: string; } @@ -100,39 +115,90 @@ export interface ListVectorStoresResponse { * OpenAI Vector Store object. */ export interface VectorStore { + /** + * Unique identifier for the vector store + */ id: string; + /** + * Timestamp when the vector store was created + */ created_at: number; + /** + * File processing status counts for the vector store + */ file_counts: VectorStore.FileCounts; + /** + * Set of key-value pairs that can be attached to the vector store + */ metadata: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * Object type identifier, always "vector_store" + */ object: string; + /** + * Current status of the vector store + */ status: string; + /** + * Storage space used by the vector store in bytes + */ usage_bytes: number; + /** + * (Optional) Expiration policy for the vector store + */ expires_after?: { [key: string]: boolean | number | string | Array | unknown | null }; + /** + * (Optional) Timestamp when the vector store will expire + */ expires_at?: number; + /** + * (Optional) Timestamp of last activity on the vector store + */ last_active_at?: number; + /** + * (Optional) Name of the vector store + */ name?: string; } export namespace VectorStore { + /** + * File processing status counts for the vector store + */ export interface FileCounts { + /** + * Number of files that had their processing cancelled + */ cancelled: number; + /** + * Number of files that have been successfully processed + */ completed: number; + /** + * Number of files that failed to process + */ failed: number; + /** + * Number of files currently being processed + */ in_progress: number; + /** + * Total number of files in the vector store + */ total: number; } } @@ -141,25 +207,49 @@ export namespace VectorStore { * Response from deleting a vector store. */ export interface VectorStoreDeleteResponse { + /** + * Unique identifier of the deleted vector store + */ id: string; + /** + * Whether the deletion operation was successful + */ deleted: boolean; + /** + * Object type identifier for the deletion response + */ object: string; } /** - * Response from searching a vector store. + * Paginated response from searching a vector store. */ export interface VectorStoreSearchResponse { + /** + * List of search result objects + */ data: Array; + /** + * Whether there are more results available beyond this page + */ has_more: boolean; + /** + * Object type identifier for the search results page + */ object: string; + /** + * The original search query that was executed + */ search_query: string; + /** + * (Optional) Token for retrieving the next page of results + */ next_page?: string; } @@ -168,32 +258,51 @@ export namespace VectorStoreSearchResponse { * Response from searching a vector store. */ export interface Data { + /** + * List of content items matching the search query + */ content: Array; + /** + * Unique identifier of the file containing the result + */ file_id: string; + /** + * Name of the file containing the result + */ filename: string; + /** + * Relevance score for this search result + */ score: number; + /** + * (Optional) Key-value attributes associated with the file + */ attributes?: { [key: string]: string | number | boolean }; } export namespace Data { + /** + * Content item from a vector store file or search result. + */ export interface Content { + /** + * The actual text content + */ text: string; + /** + * Content type, currently only "text" is supported + */ type: 'text'; } } } export interface VectorStoreCreateParams { - /** - * A name for the vector store. - */ - name: string; - /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` * strategy. @@ -227,14 +336,14 @@ export interface VectorStoreCreateParams { metadata?: { [key: string]: boolean | number | string | Array | unknown | null }; /** - * The ID of the provider to use for this vector store. + * A name for the vector store. */ - provider_id?: string; + name?: string; /** - * The provider-specific vector database ID. + * The ID of the provider to use for this vector store. */ - provider_vector_db_id?: string; + provider_id?: string; } export interface VectorStoreUpdateParams { @@ -317,8 +426,14 @@ export namespace VectorStoreSearchParams { * Ranking options for fine-tuning the search results. */ export interface RankingOptions { + /** + * (Optional) Name of the ranking algorithm to use + */ ranker?: string; + /** + * (Optional) Minimum relevance score threshold for results + */ score_threshold?: number; } } diff --git a/tests/api-resources/moderations.test.ts b/tests/api-resources/moderations.test.ts new file mode 100644 index 0000000..25a77cc --- /dev/null +++ b/tests/api-resources/moderations.test.ts @@ -0,0 +1,23 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import LlamaStackClient from 'llama-stack-client'; +import { Response } from 'node-fetch'; + +const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); + +describe('resource moderations', () => { + test('create: only required params', async () => { + const responsePromise = client.moderations.create({ input: 'string', model: 'model' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.moderations.create({ input: 'string', model: 'model' }); + }); +}); diff --git a/tests/api-resources/post-training/post-training.test.ts b/tests/api-resources/post-training/post-training.test.ts index d8967bb..ac7a53b 100644 --- a/tests/api-resources/post-training/post-training.test.ts +++ b/tests/api-resources/post-training/post-training.test.ts @@ -8,7 +8,7 @@ const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL'] describe('resource postTraining', () => { test('preferenceOptimize: only required params', async () => { const responsePromise = client.postTraining.preferenceOptimize({ - algorithm_config: { epsilon: 0, gamma: 0, reward_clip: 0, reward_scale: 0 }, + algorithm_config: { beta: 0, loss_type: 'sigmoid' }, finetuned_model: 'finetuned_model', hyperparam_search_config: { foo: true }, job_uuid: 'job_uuid', @@ -26,7 +26,7 @@ describe('resource postTraining', () => { test('preferenceOptimize: required and optional params', async () => { const response = await client.postTraining.preferenceOptimize({ - algorithm_config: { epsilon: 0, gamma: 0, reward_clip: 0, reward_scale: 0 }, + algorithm_config: { beta: 0, loss_type: 'sigmoid' }, finetuned_model: 'finetuned_model', hyperparam_search_config: { foo: true }, job_uuid: 'job_uuid', diff --git a/tests/api-resources/tool-runtime/rag-tool.test.ts b/tests/api-resources/tool-runtime/rag-tool.test.ts index fa8432b..6780be4 100644 --- a/tests/api-resources/tool-runtime/rag-tool.test.ts +++ b/tests/api-resources/tool-runtime/rag-tool.test.ts @@ -54,7 +54,7 @@ describe('resource ragTool', () => { max_chunks: 0, max_tokens_in_context: 0, query_generator_config: { separator: 'separator', type: 'default' }, - mode: 'mode', + mode: 'vector', ranker: { impact_factor: 0, type: 'rrf' }, }, }); diff --git a/tests/api-resources/vector-dbs.test.ts b/tests/api-resources/vector-dbs.test.ts index dc27b0a..4af5adf 100644 --- a/tests/api-resources/vector-dbs.test.ts +++ b/tests/api-resources/vector-dbs.test.ts @@ -63,6 +63,7 @@ describe('resource vectorDBs', () => { embedding_dimension: 0, provider_id: 'provider_id', provider_vector_db_id: 'provider_vector_db_id', + vector_db_name: 'vector_db_name', }); }); diff --git a/tests/api-resources/vector-stores/vector-stores.test.ts b/tests/api-resources/vector-stores/vector-stores.test.ts index a34c1cb..3d7cc8c 100644 --- a/tests/api-resources/vector-stores/vector-stores.test.ts +++ b/tests/api-resources/vector-stores/vector-stores.test.ts @@ -6,8 +6,8 @@ import { Response } from 'node-fetch'; const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); describe('resource vectorStores', () => { - test('create: only required params', async () => { - const responsePromise = client.vectorStores.create({ name: 'name' }); + test('create', async () => { + const responsePromise = client.vectorStores.create({}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -17,20 +17,6 @@ describe('resource vectorStores', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { - const response = await client.vectorStores.create({ - name: 'name', - chunking_strategy: { foo: true }, - embedding_dimension: 0, - embedding_model: 'embedding_model', - expires_after: { foo: true }, - file_ids: ['string'], - metadata: { foo: true }, - provider_id: 'provider_id', - provider_vector_db_id: 'provider_vector_db_id', - }); - }); - test('retrieve', async () => { const responsePromise = client.vectorStores.retrieve('vector_store_id'); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/index.test.ts b/tests/index.test.ts index eca2222..ac17b97 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -25,13 +25,13 @@ describe('instantiate client', () => { defaultHeaders: { 'X-My-Default-Header': '2' }, }); - test('they are used in the request', () => { - const { req } = client.buildRequest({ path: '/foo', method: 'post' }); + test('they are used in the request', async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post' }); expect((req.headers as Headers)['x-my-default-header']).toEqual('2'); }); - test('can ignore `undefined` and leave the default', () => { - const { req } = client.buildRequest({ + test('can ignore `undefined` and leave the default', async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post', headers: { 'X-My-Default-Header': undefined }, @@ -39,8 +39,8 @@ describe('instantiate client', () => { expect((req.headers as Headers)['x-my-default-header']).toEqual('2'); }); - test('can be removed with `null`', () => { - const { req } = client.buildRequest({ + test('can be removed with `null`', async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post', headers: { 'X-My-Default-Header': null }, @@ -209,20 +209,20 @@ describe('request building', () => { const client = new LlamaStackClient({}); describe('Content-Length', () => { - test('handles multi-byte characters', () => { - const { req } = client.buildRequest({ path: '/foo', method: 'post', body: { value: '—' } }); + test('handles multi-byte characters', async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post', body: { value: '—' } }); expect((req.headers as Record)['content-length']).toEqual('20'); }); - test('handles standard characters', () => { - const { req } = client.buildRequest({ path: '/foo', method: 'post', body: { value: 'hello' } }); + test('handles standard characters', async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post', body: { value: 'hello' } }); expect((req.headers as Record)['content-length']).toEqual('22'); }); }); describe('custom headers', () => { - test('handles undefined', () => { - const { req } = client.buildRequest({ + test('handles undefined', async () => { + const { req } = await client.buildRequest({ path: '/foo', method: 'post', body: { value: 'hello' },