diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a1e0736..24b05bc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.4.0-alpha.1" + ".": "0.4.0-alpha.2" } diff --git a/.stats.yml b/.stats.yml index 60e64c3..f4dfa90 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-35c6569e5e9fcc85084c9728eb7fc7c5908297fcc77043d621d25de3c850a990.yml -openapi_spec_hash: 0f95bbeee16f3205d36ec34cfa62c711 -config_hash: ef275cc002a89629459fd73d0cf9cba9 +configured_endpoints: 89 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-af20fa1866f461e9fef4f7fd226d757b0dddee907e2a083fa582ac0580735e20.yml +openapi_spec_hash: 68caf264f8ade02c34456c526d7300b1 +config_hash: e8a35d9d37cb4774b4b0fe1b167dc156 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ca481e..23dca0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 0.4.0-alpha.2 (2025-11-12) + +Full Changelog: [v0.4.0-alpha.1...v0.4.0-alpha.2](https://github.com/llamastack/llama-stack-client-typescript/compare/v0.4.0-alpha.1...v0.4.0-alpha.2) + +### Features + +* add new API filter for all non-deprecated APIs ([b6aeeaf](https://github.com/llamastack/llama-stack-client-typescript/commit/b6aeeaf8de2ec76928f2b52b027b563924cae7af)) +* Adding option to return embeddings and metadata from `/vector_stores/*/files/*/content` and UI updates ([f599d5e](https://github.com/llamastack/llama-stack-client-typescript/commit/f599d5e0cb24af85afaf698ab132e35980094b30)) +* **api:** point models.list() to /v1/openai/v1/models ([bb35776](https://github.com/llamastack/llama-stack-client-typescript/commit/bb35776ec613b3045cf3b3f62e5361d9403fa2a8)) +* **api:** remove agents types ([69aff21](https://github.com/llamastack/llama-stack-client-typescript/commit/69aff218b3c3765a1a6beab4ade48a7096a9082b)) +* **api:** remove openai/v1 endpoints ([96b206c](https://github.com/llamastack/llama-stack-client-typescript/commit/96b206cd531391fe3d0323a276eb342b70a568de)) +* Implement the 'max_tool_calls' parameter for the Responses API ([a9ec6fb](https://github.com/llamastack/llama-stack-client-typescript/commit/a9ec6fb8fea3b839f30a03d2fb61efbfe4c6b007)) + + +### Chores + +* **stainless:** add config for file header ([1bc1a46](https://github.com/llamastack/llama-stack-client-typescript/commit/1bc1a460f884257ece4da5d12a3a7a0847bf725a)) +* **stainless:** add config for file header ([61a0e70](https://github.com/llamastack/llama-stack-client-typescript/commit/61a0e705c79716318f88d5f4bec385d20f6a5e3e)) + ## 0.4.0-alpha.1 (2025-10-31) Full Changelog: [v0.2.23-alpha.1...v0.4.0-alpha.1](https://github.com/llamastack/llama-stack-client-typescript/compare/v0.2.23-alpha.1...v0.4.0-alpha.1) diff --git a/README.md b/README.md index d9f1b2f..bee7782 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,10 @@ import LlamaStackClient from 'llama-stack-client'; const client = new LlamaStackClient(); -const model = await client.models.register({ model_id: 'model_id' }); - -console.log(model.identifier); +const completion = await client.chat.completions.create({ + messages: [{ content: 'string', role: 'user' }], + model: 'model', +}); ``` ## Streaming responses diff --git a/api.md b/api.md index dd30175..4aad0ea 100644 --- a/api.md +++ b/api.md @@ -2,23 +2,12 @@ Types: -- AgentConfig -- CompletionMessage -- Document - InterleavedContent - InterleavedContentItem -- Message -- ParamType -- QueryConfig -- QueryResult -- ResponseFormat - SafetyViolation - SamplingParams - ScoringResult - SystemMessage -- ToolCall -- ToolResponseMessage -- UserMessage # Toolgroups @@ -32,8 +21,6 @@ Methods: - client.toolgroups.list() -> ToolgroupListResponse - client.toolgroups.get(toolgroupId) -> ToolGroup -- client.toolgroups.register({ ...params }) -> void -- client.toolgroups.unregister(toolgroupId) -> void # Tools @@ -61,11 +48,6 @@ Methods: ## RagTool -Methods: - -- client.toolRuntime.ragTool.insert({ ...params }) -> void -- client.toolRuntime.ragTool.query({ ...params }) -> QueryResult - # Responses Types: @@ -241,7 +223,7 @@ Methods: - client.vectorStores.files.update(vectorStoreId, fileId, { ...params }) -> VectorStoreFile - client.vectorStores.files.list(vectorStoreId, { ...params }) -> VectorStoreFilesOpenAICursorPage - client.vectorStores.files.delete(vectorStoreId, fileId) -> FileDeleteResponse -- client.vectorStores.files.content(vectorStoreId, fileId) -> FileContentResponse +- client.vectorStores.files.content(vectorStoreId, fileId, { ...params }) -> FileContentResponse ## FileBatches @@ -263,14 +245,13 @@ Types: - ListModelsResponse - Model +- ModelRetrieveResponse - ModelListResponse Methods: -- client.models.retrieve(modelId) -> Model +- client.models.retrieve(modelId) -> ModelRetrieveResponse - client.models.list() -> ModelListResponse -- client.models.register({ ...params }) -> Model -- client.models.unregister(modelId) -> void ## OpenAI @@ -299,7 +280,7 @@ Types: Methods: -- client.routes.list() -> RouteListResponse +- client.routes.list({ ...params }) -> RouteListResponse # Moderations @@ -333,18 +314,6 @@ Methods: - client.shields.retrieve(identifier) -> Shield - client.shields.list() -> ShieldListResponse -- client.shields.delete(identifier) -> void -- client.shields.register({ ...params }) -> Shield - -# SyntheticDataGeneration - -Types: - -- SyntheticDataGenerationResponse - -Methods: - -- client.syntheticDataGeneration.generate({ ...params }) -> SyntheticDataGenerationResponse # Scoring @@ -371,7 +340,6 @@ Methods: - client.scoringFunctions.retrieve(scoringFnId) -> ScoringFn - client.scoringFunctions.list() -> ScoringFunctionListResponse -- client.scoringFunctions.register({ ...params }) -> void # Files @@ -467,65 +435,6 @@ Methods: - client.alpha.eval.jobs.cancel(benchmarkId, jobId) -> void - client.alpha.eval.jobs.status(benchmarkId, jobId) -> Job -## Agents - -Types: - -- InferenceStep -- MemoryRetrievalStep -- ShieldCallStep -- ToolExecutionStep -- ToolResponse -- AgentCreateResponse -- AgentRetrieveResponse -- AgentListResponse - -Methods: - -- client.alpha.agents.create({ ...params }) -> AgentCreateResponse -- client.alpha.agents.retrieve(agentId) -> AgentRetrieveResponse -- client.alpha.agents.list({ ...params }) -> AgentListResponse -- client.alpha.agents.delete(agentId) -> void - -### Session - -Types: - -- Session -- SessionCreateResponse -- SessionListResponse - -Methods: - -- client.alpha.agents.session.create(agentId, { ...params }) -> SessionCreateResponse -- client.alpha.agents.session.retrieve(agentId, sessionId, { ...params }) -> Session -- client.alpha.agents.session.list(agentId, { ...params }) -> SessionListResponse -- client.alpha.agents.session.delete(agentId, sessionId) -> void - -### Steps - -Types: - -- StepRetrieveResponse - -Methods: - -- client.alpha.agents.steps.retrieve(agentId, sessionId, turnId, stepId) -> StepRetrieveResponse - -### Turn - -Types: - -- AgentTurnResponseStreamChunk -- Turn -- TurnResponseEvent - -Methods: - -- client.alpha.agents.turn.create(agentId, sessionId, { ...params }) -> Turn -- client.alpha.agents.turn.retrieve(agentId, sessionId, turnId) -> Turn -- client.alpha.agents.turn.resume(agentId, sessionId, turnId, { ...params }) -> Turn - # Beta ## Datasets diff --git a/package.json b/package.json index 9aeedec..b1f9bac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "llama-stack-client", - "version": "0.4.0-alpha.1", + "version": "0.4.0-alpha.2", "description": "The official TypeScript library for the Llama Stack Client API", "author": "Llama Stack Client ", "types": "dist/index.d.ts", diff --git a/src/error.ts b/src/error.ts index 5eef049..6a48e45 100644 --- a/src/error.ts +++ b/src/error.ts @@ -4,6 +4,7 @@ // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { castToError, Headers } from './core'; diff --git a/src/index.ts b/src/index.ts index 85b3f74..950d041 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,6 +4,7 @@ // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { type Agent } from './_shims/index'; @@ -40,7 +41,7 @@ import { import { HealthInfo, Inspect, ProviderInfo, RouteInfo, VersionInfo } from './resources/inspect'; import { CreateResponse, ModerationCreateParams, Moderations } from './resources/moderations'; import { ListProvidersResponse, ProviderListResponse, Providers } from './resources/providers'; -import { ListRoutesResponse, RouteListResponse, Routes } from './resources/routes'; +import { ListRoutesResponse, RouteListParams, RouteListResponse, Routes } from './resources/routes'; import { RunShieldResponse, Safety, SafetyRunShieldParams } from './resources/safety'; import { Scoring, @@ -54,28 +55,10 @@ import { ScoringFn, ScoringFnParams, ScoringFunctionListResponse, - ScoringFunctionRegisterParams, ScoringFunctions, } from './resources/scoring-functions'; -import { - ListShieldsResponse, - Shield, - ShieldListResponse, - ShieldRegisterParams, - Shields, -} from './resources/shields'; -import { - SyntheticDataGeneration, - SyntheticDataGenerationGenerateParams, - SyntheticDataGenerationResponse, -} from './resources/synthetic-data-generation'; -import { - ListToolGroupsResponse, - ToolGroup, - ToolgroupListResponse, - ToolgroupRegisterParams, - Toolgroups, -} from './resources/toolgroups'; +import { ListShieldsResponse, Shield, ShieldListResponse, Shields } from './resources/shields'; +import { ListToolGroupsResponse, ToolGroup, ToolgroupListResponse, Toolgroups } from './resources/toolgroups'; import { ToolListParams, ToolListResponse, Tools } from './resources/tools'; import { QueryChunksResponse, @@ -97,7 +80,7 @@ import { ListModelsResponse, Model, ModelListResponse, - ModelRegisterParams, + ModelRetrieveResponse, Models, } from './resources/models/models'; import { @@ -271,7 +254,6 @@ export class LlamaStackClient extends Core.APIClient { 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); scoring: API.Scoring = new API.Scoring(this); scoringFunctions: API.ScoringFunctions = new API.ScoringFunctions(this); files: API.Files = new API.Files(this); @@ -348,7 +330,6 @@ LlamaStackClient.Routes = Routes; LlamaStackClient.Moderations = Moderations; LlamaStackClient.Safety = Safety; LlamaStackClient.Shields = Shields; -LlamaStackClient.SyntheticDataGeneration = SyntheticDataGeneration; LlamaStackClient.Scoring = Scoring; LlamaStackClient.ScoringFunctions = ScoringFunctions; LlamaStackClient.Files = Files; @@ -376,7 +357,6 @@ export declare namespace LlamaStackClient { type ListToolGroupsResponse as ListToolGroupsResponse, type ToolGroup as ToolGroup, type ToolgroupListResponse as ToolgroupListResponse, - type ToolgroupRegisterParams as ToolgroupRegisterParams, }; export { Tools as Tools, type ToolListResponse as ToolListResponse, type ToolListParams as ToolListParams }; @@ -470,8 +450,8 @@ export declare namespace LlamaStackClient { Models as Models, type ListModelsResponse as ListModelsResponse, type Model as Model, + type ModelRetrieveResponse as ModelRetrieveResponse, type ModelListResponse as ModelListResponse, - type ModelRegisterParams as ModelRegisterParams, }; export { @@ -484,6 +464,7 @@ export declare namespace LlamaStackClient { Routes as Routes, type ListRoutesResponse as ListRoutesResponse, type RouteListResponse as RouteListResponse, + type RouteListParams as RouteListParams, }; export { @@ -503,13 +484,6 @@ export declare namespace LlamaStackClient { type ListShieldsResponse as ListShieldsResponse, type Shield as Shield, type ShieldListResponse as ShieldListResponse, - type ShieldRegisterParams as ShieldRegisterParams, - }; - - export { - SyntheticDataGeneration as SyntheticDataGeneration, - type SyntheticDataGenerationResponse as SyntheticDataGenerationResponse, - type SyntheticDataGenerationGenerateParams as SyntheticDataGenerationGenerateParams, }; export { @@ -526,7 +500,6 @@ export declare namespace LlamaStackClient { type ScoringFn as ScoringFn, type ScoringFnParams as ScoringFnParams, type ScoringFunctionListResponse as ScoringFunctionListResponse, - type ScoringFunctionRegisterParams as ScoringFunctionRegisterParams, }; export { @@ -544,23 +517,12 @@ export declare namespace LlamaStackClient { export { Beta as Beta }; - export type AgentConfig = API.AgentConfig; - export type CompletionMessage = API.CompletionMessage; - export type Document = API.Document; export type InterleavedContent = API.InterleavedContent; export type InterleavedContentItem = API.InterleavedContentItem; - export type Message = API.Message; - export type ParamType = API.ParamType; - export type QueryConfig = API.QueryConfig; - export type QueryResult = API.QueryResult; - export type ResponseFormat = API.ResponseFormat; export type SafetyViolation = API.SafetyViolation; export type SamplingParams = API.SamplingParams; export type ScoringResult = API.ScoringResult; export type SystemMessage = API.SystemMessage; - export type ToolCall = API.ToolCall; - export type ToolResponseMessage = API.ToolResponseMessage; - export type UserMessage = API.UserMessage; } export { toFile, fileFromPath } from './uploads'; diff --git a/src/pagination.ts b/src/pagination.ts index b68497e..10a705a 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -4,6 +4,7 @@ // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from './core'; diff --git a/src/resource.ts b/src/resource.ts index c21f95e..c712fce 100644 --- a/src/resource.ts +++ b/src/resource.ts @@ -4,6 +4,7 @@ // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import type { LlamaStackClient } from './index'; diff --git a/src/resources/alpha.ts b/src/resources/alpha.ts index 446b643..189e024 100644 --- a/src/resources/alpha.ts +++ b/src/resources/alpha.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './alpha/index'; diff --git a/src/resources/alpha/agents.ts b/src/resources/alpha/agents.ts deleted file mode 100644 index eb4d805..0000000 --- a/src/resources/alpha/agents.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export * from './agents/index'; diff --git a/src/resources/alpha/agents/agents.ts b/src/resources/alpha/agents/agents.ts deleted file mode 100644 index f5bedad..0000000 --- a/src/resources/alpha/agents/agents.ts +++ /dev/null @@ -1,370 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import * as Core from '../../../core'; -import * as Shared from '../../shared'; -import * as SessionAPI from './session'; -import { - Session, - SessionCreateParams, - SessionCreateResponse, - SessionListParams, - SessionListResponse, - SessionResource, - SessionRetrieveParams, -} from './session'; -import * as StepsAPI from './steps'; -import { StepRetrieveResponse, Steps } from './steps'; -import * as TurnAPI from './turn'; -import { - AgentTurnResponseStreamChunk, - Turn, - TurnCreateParams, - TurnCreateParamsNonStreaming, - TurnCreateParamsStreaming, - TurnResource, - TurnResponseEvent, - TurnResumeParams, - TurnResumeParamsNonStreaming, - TurnResumeParamsStreaming, -} from './turn'; - -export class Agents extends APIResource { - session: SessionAPI.SessionResource = new SessionAPI.SessionResource(this._client); - steps: StepsAPI.Steps = new StepsAPI.Steps(this._client); - turn: TurnAPI.TurnResource = new TurnAPI.TurnResource(this._client); - - /** - * Create an agent with the given configuration. - */ - create(body: AgentCreateParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/v1alpha/agents', { body, ...options }); - } - - /** - * Describe an agent by its ID. - */ - retrieve(agentId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/v1alpha/agents/${agentId}`, options); - } - - /** - * List all agents. - */ - list(query?: AgentListParams, options?: Core.RequestOptions): Core.APIPromise; - list(options?: Core.RequestOptions): Core.APIPromise; - list( - query: AgentListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.list({}, query); - } - return this._client.get('/v1alpha/agents', { query, ...options }); - } - - /** - * Delete an agent by its ID and its associated sessions and turns. - */ - delete(agentId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/v1alpha/agents/${agentId}`, { - ...options, - headers: { Accept: '*/*', ...options?.headers }, - }); - } -} - -/** - * An inference step in an agent turn. - */ -export interface InferenceStep { - /** - * The response from the LLM. - */ - model_response: Shared.CompletionMessage; - - /** - * The ID of the step. - */ - step_id: string; - - /** - * Type of the step in an agent turn. - */ - step_type: 'inference'; - - /** - * The ID of the turn. - */ - turn_id: string; - - /** - * The time the step completed. - */ - completed_at?: string; - - /** - * The time the step started. - */ - started_at?: string; -} - -/** - * A memory retrieval step in an agent turn. - */ -export interface MemoryRetrievalStep { - /** - * The context retrieved from the vector databases. - */ - inserted_context: Shared.InterleavedContent; - - /** - * The ID of the step. - */ - step_id: string; - - /** - * Type of the step in an agent turn. - */ - step_type: 'memory_retrieval'; - - /** - * The ID of the turn. - */ - turn_id: string; - - /** - * The IDs of the vector databases to retrieve context from. - */ - vector_store_ids: string; - - /** - * The time the step completed. - */ - completed_at?: string; - - /** - * The time the step started. - */ - started_at?: string; -} - -/** - * A shield call step in an agent turn. - */ -export interface ShieldCallStep { - /** - * The ID of the step. - */ - step_id: string; - - /** - * Type of the step in an agent turn. - */ - step_type: 'shield_call'; - - /** - * The ID of the turn. - */ - turn_id: string; - - /** - * The time the step completed. - */ - completed_at?: string; - - /** - * The time the step started. - */ - started_at?: string; - - /** - * The violation from the shield call. - */ - violation?: Shared.SafetyViolation; -} - -/** - * A tool execution step in an agent turn. - */ -export interface ToolExecutionStep { - /** - * The ID of the step. - */ - step_id: string; - - /** - * Type of the step in an agent turn. - */ - step_type: 'tool_execution'; - - /** - * The tool calls to execute. - */ - tool_calls: Array; - - /** - * The tool responses from the tool calls. - */ - tool_responses: Array; - - /** - * The ID of the turn. - */ - turn_id: string; - - /** - * The time the step completed. - */ - completed_at?: string; - - /** - * The time the step started. - */ - started_at?: string; -} - -/** - * Response from a tool invocation. - */ -export interface ToolResponse { - /** - * Unique identifier for the tool call this response is for - */ - call_id: string; - - /** - * 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 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; -} - -/** - * A generic paginated response that follows a simple format. - */ -export interface AgentListResponse { - /** - * The list of items for the current page - */ - data: Array<{ [key: string]: boolean | number | string | Array | unknown | null }>; - - /** - * Whether there are more items available after this set - */ - has_more: boolean; - - /** - * The URL for accessing this list - */ - url?: string; -} - -export interface AgentCreateParams { - /** - * The configuration for the agent. - */ - agent_config: Shared.AgentConfig; -} - -export interface AgentListParams { - /** - * The number of agents to return. - */ - limit?: number; - - /** - * The index to start the pagination from. - */ - start_index?: number; -} - -Agents.SessionResource = SessionResource; -Agents.Steps = Steps; -Agents.TurnResource = TurnResource; - -export declare namespace Agents { - export { - type InferenceStep as InferenceStep, - type MemoryRetrievalStep as MemoryRetrievalStep, - type ShieldCallStep as ShieldCallStep, - type ToolExecutionStep as ToolExecutionStep, - type ToolResponse as ToolResponse, - type AgentCreateResponse as AgentCreateResponse, - type AgentRetrieveResponse as AgentRetrieveResponse, - type AgentListResponse as AgentListResponse, - type AgentCreateParams as AgentCreateParams, - type AgentListParams as AgentListParams, - }; - - export { - SessionResource as SessionResource, - type Session as Session, - type SessionCreateResponse as SessionCreateResponse, - type SessionListResponse as SessionListResponse, - type SessionCreateParams as SessionCreateParams, - type SessionRetrieveParams as SessionRetrieveParams, - type SessionListParams as SessionListParams, - }; - - export { Steps as Steps, type StepRetrieveResponse as StepRetrieveResponse }; - - export { - TurnResource as TurnResource, - type AgentTurnResponseStreamChunk as AgentTurnResponseStreamChunk, - type Turn as Turn, - type TurnResponseEvent as TurnResponseEvent, - type TurnCreateParams as TurnCreateParams, - type TurnCreateParamsNonStreaming as TurnCreateParamsNonStreaming, - type TurnCreateParamsStreaming as TurnCreateParamsStreaming, - type TurnResumeParams as TurnResumeParams, - type TurnResumeParamsNonStreaming as TurnResumeParamsNonStreaming, - type TurnResumeParamsStreaming as TurnResumeParamsStreaming, - }; -} diff --git a/src/resources/alpha/agents/index.ts b/src/resources/alpha/agents/index.ts deleted file mode 100644 index bbaa188..0000000 --- a/src/resources/alpha/agents/index.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { - Agents, - type InferenceStep, - type MemoryRetrievalStep, - type ShieldCallStep, - type ToolExecutionStep, - type ToolResponse, - type AgentCreateResponse, - type AgentRetrieveResponse, - type AgentListResponse, - type AgentCreateParams, - type AgentListParams, -} from './agents'; -export { - SessionResource, - type Session, - type SessionCreateResponse, - type SessionListResponse, - type SessionCreateParams, - type SessionRetrieveParams, - type SessionListParams, -} from './session'; -export { Steps, type StepRetrieveResponse } from './steps'; -export { - TurnResource, - type AgentTurnResponseStreamChunk, - type Turn, - type TurnResponseEvent, - type TurnCreateParams, - type TurnCreateParamsNonStreaming, - type TurnCreateParamsStreaming, - type TurnResumeParams, - type TurnResumeParamsNonStreaming, - type TurnResumeParamsStreaming, -} from './turn'; diff --git a/src/resources/alpha/agents/session.ts b/src/resources/alpha/agents/session.ts deleted file mode 100644 index 4ccb7f6..0000000 --- a/src/resources/alpha/agents/session.ts +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import * as Core from '../../../core'; -import * as TurnAPI from './turn'; - -export class SessionResource extends APIResource { - /** - * Create a new session for an agent. - */ - create( - agentId: string, - body: SessionCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/v1alpha/agents/${agentId}/session`, { body, ...options }); - } - - /** - * Retrieve an agent session by its ID. - */ - retrieve( - agentId: string, - sessionId: string, - query?: SessionRetrieveParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - retrieve(agentId: string, sessionId: string, options?: Core.RequestOptions): Core.APIPromise; - retrieve( - agentId: string, - sessionId: string, - query: SessionRetrieveParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.retrieve(agentId, sessionId, {}, query); - } - return this._client.get(`/v1alpha/agents/${agentId}/session/${sessionId}`, { query, ...options }); - } - - /** - * List all session(s) of a given agent. - */ - list( - agentId: string, - query?: SessionListParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - list(agentId: string, options?: Core.RequestOptions): Core.APIPromise; - list( - agentId: string, - query: SessionListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.list(agentId, {}, query); - } - return this._client.get(`/v1alpha/agents/${agentId}/sessions`, { query, ...options }); - } - - /** - * Delete an agent session by its ID and its associated turns. - */ - delete(agentId: string, sessionId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/v1alpha/agents/${agentId}/session/${sessionId}`, { - ...options, - headers: { Accept: '*/*', ...options?.headers }, - }); - } -} - -/** - * 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; -} - -/** - * A generic paginated response that follows a simple format. - */ -export interface SessionListResponse { - /** - * The list of items for the current page - */ - data: Array<{ [key: string]: boolean | number | string | Array | unknown | null }>; - - /** - * Whether there are more items available after this set - */ - has_more: boolean; - - /** - * The URL for accessing this list - */ - url?: string; -} - -export interface SessionCreateParams { - /** - * The name of the session to create. - */ - session_name: string; -} - -export interface SessionRetrieveParams { - /** - * (Optional) List of turn IDs to filter the session by. - */ - turn_ids?: Array; -} - -export interface SessionListParams { - /** - * The number of sessions to return. - */ - limit?: number; - - /** - * The index to start the pagination from. - */ - start_index?: number; -} - -export declare namespace SessionResource { - export { - type Session as Session, - type SessionCreateResponse as SessionCreateResponse, - type SessionListResponse as SessionListResponse, - type SessionCreateParams as SessionCreateParams, - type SessionRetrieveParams as SessionRetrieveParams, - type SessionListParams as SessionListParams, - }; -} diff --git a/src/resources/alpha/agents/steps.ts b/src/resources/alpha/agents/steps.ts deleted file mode 100644 index decbc4e..0000000 --- a/src/resources/alpha/agents/steps.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as AgentsAPI from './agents'; - -export class Steps extends APIResource { - /** - * Retrieve an agent step by its ID. - */ - retrieve( - agentId: string, - sessionId: string, - turnId: string, - stepId: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.get( - `/v1alpha/agents/${agentId}/session/${sessionId}/turn/${turnId}/step/${stepId}`, - options, - ); - } -} - -/** - * Response containing details of a specific agent step. - */ -export interface StepRetrieveResponse { - /** - * The complete step data and execution details - */ - step: - | AgentsAPI.InferenceStep - | AgentsAPI.ToolExecutionStep - | AgentsAPI.ShieldCallStep - | AgentsAPI.MemoryRetrievalStep; -} - -export declare namespace Steps { - export { type StepRetrieveResponse as StepRetrieveResponse }; -} diff --git a/src/resources/alpha/agents/turn.ts b/src/resources/alpha/agents/turn.ts deleted file mode 100644 index 10dd9b6..0000000 --- a/src/resources/alpha/agents/turn.ts +++ /dev/null @@ -1,687 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import { APIPromise } from '../../../core'; -import * as Core from '../../../core'; -import * as TurnAPI from './turn'; -import * as Shared from '../../shared'; -import * as AgentsAPI from './agents'; -import { Stream } from '../../../streaming'; - -export class TurnResource extends APIResource { - /** - * Create a new turn for an agent. - */ - create( - agentId: string, - sessionId: string, - body: TurnCreateParamsNonStreaming, - options?: Core.RequestOptions, - ): APIPromise; - create( - agentId: string, - sessionId: string, - body: TurnCreateParamsStreaming, - options?: Core.RequestOptions, - ): APIPromise>; - create( - agentId: string, - sessionId: string, - body: TurnCreateParamsBase, - options?: Core.RequestOptions, - ): APIPromise | Turn>; - create( - agentId: string, - sessionId: string, - body: TurnCreateParams, - options?: Core.RequestOptions, - ): APIPromise | APIPromise> { - return this._client.post(`/v1alpha/agents/${agentId}/session/${sessionId}/turn`, { - body, - ...options, - stream: body.stream ?? false, - }) as APIPromise | APIPromise>; - } - - /** - * Retrieve an agent turn by its ID. - */ - retrieve( - agentId: string, - sessionId: string, - turnId: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.get(`/v1alpha/agents/${agentId}/session/${sessionId}/turn/${turnId}`, options); - } - - /** - * Resume an agent turn with executed tool call responses. When a Turn has the - * status `awaiting_input` due to pending input from client side tool calls, this - * endpoint can be used to submit the outputs from the tool calls once they are - * ready. - */ - resume( - agentId: string, - sessionId: string, - turnId: string, - body: TurnResumeParamsNonStreaming, - options?: Core.RequestOptions, - ): APIPromise; - resume( - agentId: string, - sessionId: string, - turnId: string, - body: TurnResumeParamsStreaming, - options?: Core.RequestOptions, - ): APIPromise>; - resume( - agentId: string, - sessionId: string, - turnId: string, - body: TurnResumeParamsBase, - options?: Core.RequestOptions, - ): APIPromise | Turn>; - resume( - agentId: string, - sessionId: string, - turnId: string, - body: TurnResumeParams, - options?: Core.RequestOptions, - ): APIPromise | APIPromise> { - return this._client.post(`/v1alpha/agents/${agentId}/session/${sessionId}/turn/${turnId}/resume`, { - body, - ...options, - stream: body.stream ?? false, - }) as APIPromise | APIPromise>; - } -} - -/** - * Streamed agent turn completion response. - */ -export interface AgentTurnResponseStreamChunk { - /** - * Individual event in the agent turn response stream - */ - event: TurnResponseEvent; -} - -/** - * A single turn in an interaction with an Agentic System. - */ -export interface Turn { - /** - * List of messages that initiated this turn - */ - input_messages: Array; - - /** - * 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 - | AgentsAPI.ShieldCallStep - | 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; -} - -export namespace Turn { - /** - * An attachment to an agent turn. - */ - export interface OutputAttachment { - /** - * The content of the attachment. - */ - content: - | string - | OutputAttachment.ImageContentItem - | OutputAttachment.TextContentItem - | Array - | OutputAttachment.URL; - - /** - * The MIME type of the attachment. - */ - mime_type: string; - } - - export namespace OutputAttachment { - /** - * A image content item - */ - export interface ImageContentItem { - /** - * Image as a base64 encoded string or an URL - */ - image: ImageContentItem.Image; - - /** - * Discriminator type of the content item. Always "image" - */ - type: 'image'; - } - - export namespace ImageContentItem { - /** - * Image as a base64 encoded string or an URL - */ - export interface Image { - /** - * base64 encoded image data as string - */ - data?: string; - - /** - * A URL of the image or data URL in the format of data:image/{type};base64,{data}. - * Note that URL could have length limits. - */ - url?: Image.URL; - } - - export namespace Image { - /** - * A URL of the image or data URL in the format of data:image/{type};base64,{data}. - * Note that URL could have length limits. - */ - export interface URL { - /** - * The URL string pointing to the resource - */ - uri: string; - } - } - } - - /** - * A text content item - */ - export interface TextContentItem { - /** - * Text content - */ - text: string; - - /** - * Discriminator type of the content item. Always "text" - */ - 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: - | TurnResponseEvent.AgentTurnResponseStepStartPayload - | TurnResponseEvent.AgentTurnResponseStepProgressPayload - | TurnResponseEvent.AgentTurnResponseStepCompletePayload - | TurnResponseEvent.AgentTurnResponseTurnStartPayload - | TurnResponseEvent.AgentTurnResponseTurnCompletePayload - | TurnResponseEvent.AgentTurnResponseTurnAwaitingInputPayload; -} - -export namespace TurnResponseEvent { - /** - * 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 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: - | AgentTurnResponseStepProgressPayload.TextDelta - | AgentTurnResponseStepProgressPayload.ImageDelta - | AgentTurnResponseStepProgressPayload.ToolCallDelta; - - /** - * Type of event being reported - */ - event_type: 'step_progress'; - - /** - * Unique identifier for the step within a turn - */ - step_id: string; - - /** - * Type of step being executed - */ - step_type: 'inference' | 'tool_execution' | 'shield_call' | 'memory_retrieval'; - } - - export namespace AgentTurnResponseStepProgressPayload { - /** - * 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: string | Shared.ToolCall; - - /** - * Discriminator type of the delta. Always "tool_call" - */ - type: 'tool_call'; - } - } - - /** - * Payload for step completion events in agent turn responses. - */ - export interface AgentTurnResponseStepCompletePayload { - /** - * Type of event being reported - */ - event_type: 'step_complete'; - - /** - * Complete details of the executed step - */ - step_details: - | AgentsAPI.InferenceStep - | AgentsAPI.ToolExecutionStep - | AgentsAPI.ShieldCallStep - | AgentsAPI.MemoryRetrievalStep; - - /** - * Unique identifier for the step within a turn - */ - step_id: string; - - /** - * 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'; - - /** - * 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'; - - /** - * Turn data when waiting for external tool responses - */ - turn: TurnAPI.Turn; - } -} - -export type TurnCreateParams = TurnCreateParamsNonStreaming | TurnCreateParamsStreaming; - -export interface TurnCreateParamsBase { - /** - * List of messages to start the turn with. - */ - messages: Array; - - /** - * (Optional) List of documents to create the turn with. - */ - documents?: Array; - - /** - * (Optional) If True, generate an SSE event stream of the response. Defaults to - * False. - */ - stream?: boolean; - - /** - * (Optional) The tool configuration to create the turn with, will be used to - * override the agent's tool_config. - */ - tool_config?: TurnCreateParams.ToolConfig; - - /** - * (Optional) List of toolgroups to create the turn with, will be used in addition - * to the agent's config toolgroups for the request. - */ - toolgroups?: Array; -} - -export namespace TurnCreateParams { - /** - * A document to be used by an agent. - */ - export interface Document { - /** - * The content of the document. - */ - content: - | string - | Document.ImageContentItem - | Document.TextContentItem - | Array - | Document.URL; - - /** - * The MIME type of the document. - */ - mime_type: string; - } - - export namespace Document { - /** - * A image content item - */ - export interface ImageContentItem { - /** - * Image as a base64 encoded string or an URL - */ - image: ImageContentItem.Image; - - /** - * Discriminator type of the content item. Always "image" - */ - type: 'image'; - } - - export namespace ImageContentItem { - /** - * Image as a base64 encoded string or an URL - */ - export interface Image { - /** - * base64 encoded image data as string - */ - data?: string; - - /** - * A URL of the image or data URL in the format of data:image/{type};base64,{data}. - * Note that URL could have length limits. - */ - url?: Image.URL; - } - - export namespace Image { - /** - * A URL of the image or data URL in the format of data:image/{type};base64,{data}. - * Note that URL could have length limits. - */ - export interface URL { - /** - * The URL string pointing to the resource - */ - uri: string; - } - } - } - - /** - * A text content item - */ - export interface TextContentItem { - /** - * Text content - */ - text: string; - - /** - * Discriminator type of the content item. Always "text" - */ - type: 'text'; - } - - /** - * A URL reference to external content. - */ - export interface URL { - /** - * The URL string pointing to the resource - */ - uri: string; - } - } - - /** - * (Optional) The tool configuration to create the turn with, will be used to - * override the agent's tool_config. - */ - export interface ToolConfig { - /** - * (Optional) Config for how to override the default system prompt. - - * `SystemMessageBehavior.append`: Appends the provided system message to the - * default system prompt. - `SystemMessageBehavior.replace`: Replaces the default - * system prompt with the provided system message. The system message can include - * the string '{{function_definitions}}' to indicate where the function definitions - * should be inserted. - */ - system_message_behavior?: 'append' | 'replace'; - - /** - * (Optional) Whether tool use is automatic, required, or none. Can also specify a - * tool name to use a specific tool. Defaults to ToolChoice.auto. - */ - tool_choice?: 'auto' | 'required' | 'none' | (string & {}); - - /** - * (Optional) Instructs the model how to format tool calls. By default, Llama Stack - * will attempt to use a format that is best adapted to the model. - - * `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. - - * `ToolPromptFormat.function_tag`: The tool calls are enclosed in a - * tag. - `ToolPromptFormat.python_list`: The tool calls - * are output as Python syntax -- a list of function calls. - */ - tool_prompt_format?: 'json' | 'function_tag' | 'python_list'; - } - - export interface AgentToolGroupWithArgs { - args: { [key: string]: boolean | number | string | Array | unknown | null }; - - name: string; - } - - export type TurnCreateParamsNonStreaming = TurnAPI.TurnCreateParamsNonStreaming; - export type TurnCreateParamsStreaming = TurnAPI.TurnCreateParamsStreaming; -} - -export interface TurnCreateParamsNonStreaming extends TurnCreateParamsBase { - /** - * (Optional) If True, generate an SSE event stream of the response. Defaults to - * False. - */ - stream?: false; -} - -export interface TurnCreateParamsStreaming extends TurnCreateParamsBase { - /** - * (Optional) If True, generate an SSE event stream of the response. Defaults to - * False. - */ - stream: true; -} - -export type TurnResumeParams = TurnResumeParamsNonStreaming | TurnResumeParamsStreaming; - -export interface TurnResumeParamsBase { - /** - * The tool call responses to resume the turn with. - */ - tool_responses: Array; - - /** - * Whether to stream the response. - */ - stream?: boolean; -} - -export namespace TurnResumeParams { - export type TurnResumeParamsNonStreaming = TurnAPI.TurnResumeParamsNonStreaming; - export type TurnResumeParamsStreaming = TurnAPI.TurnResumeParamsStreaming; -} - -export interface TurnResumeParamsNonStreaming extends TurnResumeParamsBase { - /** - * Whether to stream the response. - */ - stream?: false; -} - -export interface TurnResumeParamsStreaming extends TurnResumeParamsBase { - /** - * Whether to stream the response. - */ - stream: true; -} - -export declare namespace TurnResource { - export { - type AgentTurnResponseStreamChunk as AgentTurnResponseStreamChunk, - type Turn as Turn, - type TurnResponseEvent as TurnResponseEvent, - type TurnCreateParams as TurnCreateParams, - type TurnCreateParamsNonStreaming as TurnCreateParamsNonStreaming, - type TurnCreateParamsStreaming as TurnCreateParamsStreaming, - type TurnResumeParams as TurnResumeParams, - type TurnResumeParamsNonStreaming as TurnResumeParamsNonStreaming, - type TurnResumeParamsStreaming as TurnResumeParamsStreaming, - }; -} diff --git a/src/resources/alpha/alpha.ts b/src/resources/alpha/alpha.ts index ad44259..143894d 100644 --- a/src/resources/alpha/alpha.ts +++ b/src/resources/alpha/alpha.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -11,20 +17,6 @@ import { } from './benchmarks'; import * as InferenceAPI from './inference'; import { Inference, InferenceRerankParams, InferenceRerankResponse } from './inference'; -import * as AgentsAPI from './agents/agents'; -import { - AgentCreateParams, - AgentCreateResponse, - AgentListParams, - AgentListResponse, - AgentRetrieveResponse, - Agents, - InferenceStep, - MemoryRetrievalStep, - ShieldCallStep, - ToolExecutionStep, - ToolResponse, -} from './agents/agents'; import * as EvalAPI from './eval/eval'; import { BenchmarkConfig, @@ -51,14 +43,12 @@ export class Alpha extends APIResource { postTraining: PostTrainingAPI.PostTraining = new PostTrainingAPI.PostTraining(this._client); benchmarks: BenchmarksAPI.Benchmarks = new BenchmarksAPI.Benchmarks(this._client); eval: EvalAPI.Eval = new EvalAPI.Eval(this._client); - agents: AgentsAPI.Agents = new AgentsAPI.Agents(this._client); } Alpha.Inference = Inference; Alpha.PostTraining = PostTraining; Alpha.Benchmarks = Benchmarks; Alpha.Eval = Eval; -Alpha.Agents = Agents; export declare namespace Alpha { export { @@ -94,18 +84,4 @@ export declare namespace Alpha { type EvalRunEvalParams as EvalRunEvalParams, type EvalRunEvalAlphaParams as EvalRunEvalAlphaParams, }; - - export { - Agents as Agents, - type InferenceStep as InferenceStep, - type MemoryRetrievalStep as MemoryRetrievalStep, - type ShieldCallStep as ShieldCallStep, - type ToolExecutionStep as ToolExecutionStep, - type ToolResponse as ToolResponse, - type AgentCreateResponse as AgentCreateResponse, - type AgentRetrieveResponse as AgentRetrieveResponse, - type AgentListResponse as AgentListResponse, - type AgentCreateParams as AgentCreateParams, - type AgentListParams as AgentListParams, - }; } diff --git a/src/resources/alpha/benchmarks.ts b/src/resources/alpha/benchmarks.ts index f2b4aba..090ecf2 100644 --- a/src/resources/alpha/benchmarks.ts +++ b/src/resources/alpha/benchmarks.ts @@ -4,6 +4,7 @@ // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -30,6 +31,8 @@ export class Benchmarks extends APIResource { /** * Register a benchmark. + * + * @deprecated */ register(body: BenchmarkRegisterParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/v1alpha/eval/benchmarks', { diff --git a/src/resources/alpha/eval.ts b/src/resources/alpha/eval.ts index d88645b..31b7a50 100644 --- a/src/resources/alpha/eval.ts +++ b/src/resources/alpha/eval.ts @@ -4,6 +4,7 @@ // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './eval/index'; diff --git a/src/resources/alpha/eval/eval.ts b/src/resources/alpha/eval/eval.ts index 379a2c4..567e1f4 100644 --- a/src/resources/alpha/eval/eval.ts +++ b/src/resources/alpha/eval/eval.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; @@ -64,7 +64,7 @@ export interface BenchmarkConfig { /** * The candidate to evaluate. */ - eval_candidate: BenchmarkConfig.ModelCandidate | BenchmarkConfig.AgentCandidate; + eval_candidate: BenchmarkConfig.EvalCandidate; /** * Map between scoring function id and parameters for each scoring function you @@ -81,9 +81,9 @@ export interface BenchmarkConfig { export namespace BenchmarkConfig { /** - * A model candidate for evaluation. + * The candidate to evaluate. */ - export interface ModelCandidate { + export interface EvalCandidate { /** * The model ID to evaluate. */ @@ -101,18 +101,6 @@ export namespace BenchmarkConfig { */ system_message?: Shared.SystemMessage; } - - /** - * An agent candidate for evaluation. - */ - export interface AgentCandidate { - /** - * The configuration for the agent candidate. - */ - config: Shared.AgentConfig; - - type: 'agent'; - } } /** diff --git a/src/resources/alpha/eval/index.ts b/src/resources/alpha/eval/index.ts index 27b4b37..fc5c2cf 100644 --- a/src/resources/alpha/eval/index.ts +++ b/src/resources/alpha/eval/index.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { diff --git a/src/resources/alpha/eval/jobs.ts b/src/resources/alpha/eval/jobs.ts index b26692a..0cd8a90 100644 --- a/src/resources/alpha/eval/jobs.ts +++ b/src/resources/alpha/eval/jobs.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; diff --git a/src/resources/alpha/index.ts b/src/resources/alpha/index.ts index 39388cf..d957e62 100644 --- a/src/resources/alpha/index.ts +++ b/src/resources/alpha/index.ts @@ -1,18 +1,11 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - Agents, - type InferenceStep, - type MemoryRetrievalStep, - type ShieldCallStep, - type ToolExecutionStep, - type ToolResponse, - type AgentCreateResponse, - type AgentRetrieveResponse, - type AgentListResponse, - type AgentCreateParams, - type AgentListParams, -} from './agents/index'; export { Alpha } from './alpha'; export { Benchmarks, diff --git a/src/resources/alpha/inference.ts b/src/resources/alpha/inference.ts index ca6db21..c9486c7 100644 --- a/src/resources/alpha/inference.ts +++ b/src/resources/alpha/inference.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; diff --git a/src/resources/alpha/post-training.ts b/src/resources/alpha/post-training.ts index 1bf51b7..7938877 100644 --- a/src/resources/alpha/post-training.ts +++ b/src/resources/alpha/post-training.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './post-training/index'; diff --git a/src/resources/alpha/post-training/index.ts b/src/resources/alpha/post-training/index.ts index 200a62c..ad8397f 100644 --- a/src/resources/alpha/post-training/index.ts +++ b/src/resources/alpha/post-training/index.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { diff --git a/src/resources/alpha/post-training/job.ts b/src/resources/alpha/post-training/job.ts index 83ea474..b3ced07 100644 --- a/src/resources/alpha/post-training/job.ts +++ b/src/resources/alpha/post-training/job.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; diff --git a/src/resources/alpha/post-training/post-training.ts b/src/resources/alpha/post-training/post-training.ts index 33d05f9..2e4ee87 100644 --- a/src/resources/alpha/post-training/post-training.ts +++ b/src/resources/alpha/post-training/post-training.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; diff --git a/src/resources/beta.ts b/src/resources/beta.ts index 1542e94..b45544a 100644 --- a/src/resources/beta.ts +++ b/src/resources/beta.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './beta/index'; diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 28c6489..bc393a6 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; diff --git a/src/resources/beta/datasets.ts b/src/resources/beta/datasets.ts index 30cfae2..a8247b1 100644 --- a/src/resources/beta/datasets.ts +++ b/src/resources/beta/datasets.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -72,6 +72,8 @@ export class Datasets extends APIResource { /** * Register a new dataset. + * + * @deprecated */ register( body: DatasetRegisterParams, @@ -82,6 +84,8 @@ export class Datasets extends APIResource { /** * Unregister a dataset by its ID. + * + * @deprecated */ unregister(datasetId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.delete(`/v1beta/datasets/${datasetId}`, { diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index de238a5..36c792f 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Beta } from './beta'; diff --git a/src/resources/chat.ts b/src/resources/chat.ts index 7433794..60a2ebf 100644 --- a/src/resources/chat.ts +++ b/src/resources/chat.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './chat/index'; diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index c4447cb..f53a121 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 05575c4..0de1ff7 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index b35c8d1..e3ae625 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Chat, type ChatCompletionChunk } from './chat'; diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 4d9ecf5..46ae826 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; diff --git a/src/resources/conversations.ts b/src/resources/conversations.ts index 6b50950..e84d7fe 100644 --- a/src/resources/conversations.ts +++ b/src/resources/conversations.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './conversations/index'; diff --git a/src/resources/conversations/conversations.ts b/src/resources/conversations/conversations.ts index c4f97d6..4ec0d50 100644 --- a/src/resources/conversations/conversations.ts +++ b/src/resources/conversations/conversations.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -109,6 +115,7 @@ export namespace ConversationCreateParams { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -154,12 +161,47 @@ export namespace ConversationCreateParams { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation diff --git a/src/resources/conversations/index.ts b/src/resources/conversations/index.ts index de33b78..990af16 100644 --- a/src/resources/conversations/index.ts +++ b/src/resources/conversations/index.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { diff --git a/src/resources/conversations/items.ts b/src/resources/conversations/items.ts index 73fc238..e2bd1aa 100644 --- a/src/resources/conversations/items.ts +++ b/src/resources/conversations/items.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -95,6 +101,7 @@ export namespace ItemCreateResponse { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -140,12 +147,47 @@ export namespace ItemCreateResponse { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -533,6 +575,7 @@ export namespace ItemListResponse { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -578,12 +621,47 @@ export namespace ItemListResponse { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -971,6 +1049,7 @@ export namespace ItemGetResponse { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -1016,12 +1095,47 @@ export namespace ItemGetResponse { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -1410,6 +1524,7 @@ export namespace ItemCreateParams { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -1455,12 +1570,47 @@ export namespace ItemCreateParams { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index 7dd95db..7ece18c 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; diff --git a/src/resources/files.ts b/src/resources/files.ts index e7abab7..91d6f4a 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; diff --git a/src/resources/index.ts b/src/resources/index.ts index 982639e..89da04a 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './shared'; @@ -40,8 +40,8 @@ export { Models, type ListModelsResponse, type Model, + type ModelRetrieveResponse, type ModelListResponse, - type ModelRegisterParams, } from './models/models'; export { Moderations, type CreateResponse, type ModerationCreateParams } from './moderations'; export { @@ -67,7 +67,7 @@ export { type ResponseCreateParamsStreaming, type ResponseListParams, } from './responses/responses'; -export { Routes, type ListRoutesResponse, type RouteListResponse } from './routes'; +export { Routes, type ListRoutesResponse, type RouteListResponse, type RouteListParams } from './routes'; export { Safety, type RunShieldResponse, type SafetyRunShieldParams } from './safety'; export { Scoring, @@ -82,20 +82,8 @@ export { type ScoringFn, type ScoringFnParams, type ScoringFunctionListResponse, - type ScoringFunctionRegisterParams, } from './scoring-functions'; -export { - Shields, - type ListShieldsResponse, - type Shield, - type ShieldListResponse, - type ShieldRegisterParams, -} from './shields'; -export { - SyntheticDataGeneration, - type SyntheticDataGenerationResponse, - type SyntheticDataGenerationGenerateParams, -} from './synthetic-data-generation'; +export { Shields, type ListShieldsResponse, type Shield, type ShieldListResponse } from './shields'; export { ToolRuntime, type ToolDef, @@ -109,7 +97,6 @@ export { type ListToolGroupsResponse, type ToolGroup, type ToolgroupListResponse, - type ToolgroupRegisterParams, } from './toolgroups'; export { Tools, type ToolListResponse, type ToolListParams } from './tools'; export { diff --git a/src/resources/inspect.ts b/src/resources/inspect.ts index b9c26ac..1da4f3f 100644 --- a/src/resources/inspect.ts +++ b/src/resources/inspect.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; diff --git a/src/resources/models.ts b/src/resources/models.ts index a882cac..f3131da 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './models/index'; diff --git a/src/resources/models/index.ts b/src/resources/models/index.ts index f06b472..045dd21 100644 --- a/src/resources/models/index.ts +++ b/src/resources/models/index.ts @@ -3,14 +3,14 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Models, type ListModelsResponse, type Model, + type ModelRetrieveResponse, type ModelListResponse, - type ModelRegisterParams, } from './models'; export { OpenAI } from './openai'; diff --git a/src/resources/models/models.ts b/src/resources/models/models.ts index d76baa2..6b8ef48 100644 --- a/src/resources/models/models.ts +++ b/src/resources/models/models.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -17,35 +17,18 @@ export class Models extends APIResource { /** * Get model. Get a model by its identifier. */ - retrieve(modelId: string, options?: Core.RequestOptions): Core.APIPromise { + retrieve(modelId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/v1/models/${modelId}`, options); } /** - * List all models. + * List models using the OpenAI API. */ list(options?: Core.RequestOptions): Core.APIPromise { return ( this._client.get('/v1/models', options) as Core.APIPromise<{ data: ModelListResponse }> )._thenUnwrap((obj) => obj.data); } - - /** - * Register model. Register a model. - */ - register(body: ModelRegisterParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/v1/models', { body, ...options }); - } - - /** - * Unregister model. Unregister a model. - */ - unregister(modelId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/v1/models/${modelId}`, { - ...options, - headers: { Accept: '*/*', ...options?.headers }, - }); - } } export interface ListModelsResponse { @@ -53,9 +36,24 @@ export interface ListModelsResponse { } /** - * A model resource representing an AI model registered in Llama Stack. + * A model from OpenAI. */ export interface Model { + id: string; + + created: number; + + object: 'model'; + + owned_by: string; + + custom_metadata?: { [key: string]: boolean | number | string | Array | unknown | null }; +} + +/** + * A model resource representing an AI model registered in Llama Stack. + */ +export interface ModelRetrieveResponse { /** * Unique identifier for this resource in llama stack */ @@ -89,41 +87,14 @@ export interface Model { export type ModelListResponse = Array; -export interface ModelRegisterParams { - /** - * The identifier of the model to register. - */ - model_id: string; - - /** - * Any additional metadata for this model. - */ - metadata?: { [key: string]: boolean | number | string | Array | unknown | null }; - - /** - * The type of model to register. - */ - model_type?: 'llm' | 'embedding' | 'rerank'; - - /** - * The identifier of the provider. - */ - provider_id?: string; - - /** - * The identifier of the model in the provider. - */ - provider_model_id?: string; -} - Models.OpenAI = OpenAI; export declare namespace Models { export { type ListModelsResponse as ListModelsResponse, type Model as Model, + type ModelRetrieveResponse as ModelRetrieveResponse, type ModelListResponse as ModelListResponse, - type ModelRegisterParams as ModelRegisterParams, }; export { OpenAI as OpenAI }; diff --git a/src/resources/models/openai.ts b/src/resources/models/openai.ts index 589acdf..83b138f 100644 --- a/src/resources/models/openai.ts +++ b/src/resources/models/openai.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -12,7 +12,7 @@ import * as ModelsAPI from './models'; export class OpenAI extends APIResource { /** - * List all models. + * List models using the OpenAI API. */ list(options?: Core.RequestOptions): Core.APIPromise { return ( diff --git a/src/resources/moderations.ts b/src/resources/moderations.ts index 29377d4..5bc70d6 100644 --- a/src/resources/moderations.ts +++ b/src/resources/moderations.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; diff --git a/src/resources/prompts.ts b/src/resources/prompts.ts index 3ebc77f..b5f5046 100644 --- a/src/resources/prompts.ts +++ b/src/resources/prompts.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './prompts/index'; diff --git a/src/resources/prompts/index.ts b/src/resources/prompts/index.ts index 77a24d7..b7060bd 100644 --- a/src/resources/prompts/index.ts +++ b/src/resources/prompts/index.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { diff --git a/src/resources/prompts/prompts.ts b/src/resources/prompts/prompts.ts index 6dca328..c7dca16 100644 --- a/src/resources/prompts/prompts.ts +++ b/src/resources/prompts/prompts.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; diff --git a/src/resources/prompts/versions.ts b/src/resources/prompts/versions.ts index da2931b..6af775f 100644 --- a/src/resources/prompts/versions.ts +++ b/src/resources/prompts/versions.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; diff --git a/src/resources/providers.ts b/src/resources/providers.ts index c4ded28..2640f76 100644 --- a/src/resources/providers.ts +++ b/src/resources/providers.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; diff --git a/src/resources/responses.ts b/src/resources/responses.ts index 6a15db0..660ff18 100644 --- a/src/resources/responses.ts +++ b/src/resources/responses.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './responses/index'; diff --git a/src/resources/responses/index.ts b/src/resources/responses/index.ts index afaaed4..1478d4c 100644 --- a/src/resources/responses/index.ts +++ b/src/resources/responses/index.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { InputItems, type InputItemListResponse, type InputItemListParams } from './input-items'; diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index 940dc23..e08305c 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -70,6 +70,7 @@ export namespace InputItemListResponse { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -115,12 +116,47 @@ export namespace InputItemListResponse { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -490,6 +526,7 @@ export namespace InputItemListResponse { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -535,12 +572,47 @@ export namespace InputItemListResponse { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index fc7bad4..3570cbf 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -142,11 +142,22 @@ export interface ResponseObject { */ instructions?: string; + /** + * (Optional) Max number of total calls to built-in tools that can be processed in + * a response + */ + max_tool_calls?: number; + /** * (Optional) ID of the previous response in a conversation */ previous_response_id?: string; + /** + * (Optional) Reference to a prompt template and its variables. + */ + prompt?: ResponseObject.Prompt; + /** * (Optional) Sampling temperature used for generation */ @@ -190,6 +201,7 @@ export namespace ResponseObject { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -235,12 +247,47 @@ export namespace ResponseObject { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -627,6 +674,105 @@ export namespace ResponseObject { message: string; } + /** + * (Optional) Reference to a prompt template and its variables. + */ + export interface Prompt { + /** + * Unique identifier of the prompt template + */ + id: string; + + /** + * Dictionary of variable names to OpenAIResponseInputMessageContent structure for + * template substitution. The substitution values can either be strings, or other + * Response input types like images or files. + */ + variables?: { + [key: string]: + | Prompt.OpenAIResponseInputMessageContentText + | Prompt.OpenAIResponseInputMessageContentImage + | Prompt.OpenAIResponseInputMessageContentFile; + }; + + /** + * Version number of the prompt to use (defaults to latest if not specified) + */ + version?: string; + } + + export namespace Prompt { + /** + * 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) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * (Optional) URL of the image content + */ + image_url?: string; + } + + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + } + /** * Web search tool configuration for OpenAI response inputs. */ @@ -634,7 +780,7 @@ export namespace ResponseObject { /** * Web search tool type variant to use */ - type: 'web_search' | 'web_search_preview' | 'web_search_preview_2025_03_11'; + type: 'web_search' | 'web_search_preview' | 'web_search_preview_2025_03_11' | 'web_search_2025_08_26'; /** * (Optional) Size of search context, must be "low", "medium", or "high" @@ -930,6 +1076,7 @@ export namespace ResponseObjectStream { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -975,12 +1122,47 @@ export namespace ResponseObjectStream { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -1358,6 +1540,7 @@ export namespace ResponseObjectStream { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -1403,12 +1586,47 @@ export namespace ResponseObjectStream { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -3038,11 +3256,22 @@ export interface ResponseListResponse { */ instructions?: string; + /** + * (Optional) Max number of total calls to built-in tools that can be processed in + * a response + */ + max_tool_calls?: number; + /** * (Optional) ID of the previous response in a conversation */ previous_response_id?: string; + /** + * (Optional) Reference to a prompt template and its variables. + */ + prompt?: ResponseListResponse.Prompt; + /** * (Optional) Sampling temperature used for generation */ @@ -3086,6 +3315,7 @@ export namespace ResponseListResponse { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -3131,12 +3361,47 @@ export namespace ResponseListResponse { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -3506,6 +3771,7 @@ export namespace ResponseListResponse { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -3551,12 +3817,47 @@ export namespace ResponseListResponse { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -3676,6 +3977,7 @@ export namespace ResponseListResponse { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -3721,12 +4023,47 @@ export namespace ResponseListResponse { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -4113,6 +4450,105 @@ export namespace ResponseListResponse { message: string; } + /** + * (Optional) Reference to a prompt template and its variables. + */ + export interface Prompt { + /** + * Unique identifier of the prompt template + */ + id: string; + + /** + * Dictionary of variable names to OpenAIResponseInputMessageContent structure for + * template substitution. The substitution values can either be strings, or other + * Response input types like images or files. + */ + variables?: { + [key: string]: + | Prompt.OpenAIResponseInputMessageContentText + | Prompt.OpenAIResponseInputMessageContentImage + | Prompt.OpenAIResponseInputMessageContentFile; + }; + + /** + * Version number of the prompt to use (defaults to latest if not specified) + */ + version?: string; + } + + export namespace Prompt { + /** + * 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) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * (Optional) URL of the image content + */ + image_url?: string; + } + + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + } + /** * Web search tool configuration for OpenAI response inputs. */ @@ -4120,7 +4556,7 @@ export namespace ResponseListResponse { /** * Web search tool type variant to use */ - type: 'web_search' | 'web_search_preview' | 'web_search_preview_2025_03_11'; + type: 'web_search' | 'web_search_preview' | 'web_search_preview_2025_03_11' | 'web_search_2025_08_26'; /** * (Optional) Size of search context, must be "low", "medium", or "high" @@ -4352,6 +4788,12 @@ export interface ResponseCreateParamsBase { max_infer_iters?: number; + /** + * (Optional) Max number of total calls to built-in tools that can be processed in + * a response. + */ + max_tool_calls?: number; + /** * (Optional) if specified, the new response will be a continuation of the previous * response. This can be used to easily fork-off new responses from existing @@ -4359,6 +4801,11 @@ export interface ResponseCreateParamsBase { */ previous_response_id?: string; + /** + * (Optional) Prompt object with ID, version, and variables. + */ + prompt?: ResponseCreateParams.Prompt; + store?: boolean; stream?: boolean; @@ -4390,6 +4837,7 @@ export namespace ResponseCreateParams { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -4435,12 +4883,47 @@ export namespace ResponseCreateParams { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -4810,6 +5293,7 @@ export namespace ResponseCreateParams { | Array< | OpenAIResponseMessage.OpenAIResponseInputMessageContentText | OpenAIResponseMessage.OpenAIResponseInputMessageContentImage + | OpenAIResponseMessage.OpenAIResponseInputMessageContentFile > | Array< | OpenAIResponseMessage.OpenAIResponseOutputMessageContentOutputText @@ -4855,12 +5339,47 @@ export namespace ResponseCreateParams { */ type: 'input_image'; + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + /** * (Optional) URL of the image content */ image_url?: string; } + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + export interface OpenAIResponseOutputMessageContentOutputText { annotations: Array< | OpenAIResponseOutputMessageContentOutputText.OpenAIResponseAnnotationFileCitation @@ -4969,6 +5488,105 @@ export namespace ResponseCreateParams { } } + /** + * (Optional) Prompt object with ID, version, and variables. + */ + export interface Prompt { + /** + * Unique identifier of the prompt template + */ + id: string; + + /** + * Dictionary of variable names to OpenAIResponseInputMessageContent structure for + * template substitution. The substitution values can either be strings, or other + * Response input types like images or files. + */ + variables?: { + [key: string]: + | Prompt.OpenAIResponseInputMessageContentText + | Prompt.OpenAIResponseInputMessageContentImage + | Prompt.OpenAIResponseInputMessageContentFile; + }; + + /** + * Version number of the prompt to use (defaults to latest if not specified) + */ + version?: string; + } + + export namespace Prompt { + /** + * 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) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * (Optional) URL of the image content + */ + image_url?: string; + } + + /** + * File content for input messages in OpenAI response format. + */ + export interface OpenAIResponseInputMessageContentFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The data of the file to be sent to the model. + */ + file_data?: string; + + /** + * (Optional) The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The URL of the file to be sent to the model. + */ + file_url?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; + } + } + /** * Text response configuration for OpenAI responses. */ @@ -5020,7 +5638,7 @@ export namespace ResponseCreateParams { /** * Web search tool type variant to use */ - type: 'web_search' | 'web_search_preview' | 'web_search_preview_2025_03_11'; + type: 'web_search' | 'web_search_preview' | 'web_search_preview_2025_03_11' | 'web_search_2025_08_26'; /** * (Optional) Size of search context, must be "low", "medium", or "high" diff --git a/src/resources/routes.ts b/src/resources/routes.ts index f974d6b..48d1e38 100644 --- a/src/resources/routes.ts +++ b/src/resources/routes.ts @@ -3,10 +3,11 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; +import { isRequestOptions } from '../core'; import * as Core from '../core'; import * as InspectAPI from './inspect'; @@ -15,9 +16,19 @@ export class Routes extends APIResource { * List routes. List all available API routes with their methods and implementing * providers. */ - list(options?: Core.RequestOptions): Core.APIPromise { + list(query?: RouteListParams, options?: Core.RequestOptions): Core.APIPromise; + list(options?: Core.RequestOptions): Core.APIPromise; + list( + query: RouteListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.list({}, query); + } return ( - this._client.get('/v1/inspect/routes', options) as Core.APIPromise<{ data: RouteListResponse }> + this._client.get('/v1/inspect/routes', { query, ...options }) as Core.APIPromise<{ + data: RouteListResponse; + }> )._thenUnwrap((obj) => obj.data); } } @@ -37,6 +48,20 @@ export interface ListRoutesResponse { */ export type RouteListResponse = Array; +export interface RouteListParams { + /** + * Optional filter to control which routes are returned. Can be an API level ('v1', + * 'v1alpha', 'v1beta') to show non-deprecated routes at that level, or + * 'deprecated' to show deprecated routes across all levels. If not specified, + * returns all non-deprecated routes. + */ + api_filter?: 'v1' | 'v1alpha' | 'v1beta' | 'deprecated'; +} + export declare namespace Routes { - export { type ListRoutesResponse as ListRoutesResponse, type RouteListResponse as RouteListResponse }; + export { + type ListRoutesResponse as ListRoutesResponse, + type RouteListResponse as RouteListResponse, + type RouteListParams as RouteListParams, + }; } diff --git a/src/resources/safety.ts b/src/resources/safety.ts index baa5046..8728d80 100644 --- a/src/resources/safety.ts +++ b/src/resources/safety.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; diff --git a/src/resources/scoring-functions.ts b/src/resources/scoring-functions.ts index 8699f09..483da60 100644 --- a/src/resources/scoring-functions.ts +++ b/src/resources/scoring-functions.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; @@ -27,17 +27,6 @@ export class ScoringFunctions extends APIResource { }> )._thenUnwrap((obj) => obj.data); } - - /** - * Register a scoring function. - */ - register(body: ScoringFunctionRegisterParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/v1/scoring-functions', { - body, - ...options, - headers: { Accept: '*/*', ...options?.headers }, - }); - } } export interface ListScoringFunctionsResponse { @@ -170,58 +159,11 @@ export namespace ScoringFnParams { export type ScoringFunctionListResponse = Array; -export interface ScoringFunctionRegisterParams { - /** - * The description of the scoring function. - */ - description: string; - - return_type: ScoringFunctionRegisterParams.ReturnType; - - /** - * The ID of the scoring function to register. - */ - scoring_fn_id: string; - - /** - * The parameters for the scoring function for benchmark eval, these can be - * overridden for app eval. - */ - params?: ScoringFnParams; - - /** - * The ID of the provider to use for the scoring function. - */ - provider_id?: string; - - /** - * The ID of the provider scoring function to use for the scoring function. - */ - provider_scoring_fn_id?: string; -} - -export namespace ScoringFunctionRegisterParams { - export interface ReturnType { - type: - | 'string' - | 'number' - | 'boolean' - | 'array' - | 'object' - | 'json' - | 'union' - | 'chat_completion_input' - | 'completion_input' - | 'agent_turn_input'; - } -} - export declare namespace ScoringFunctions { export { type ListScoringFunctionsResponse as ListScoringFunctionsResponse, type ScoringFn as ScoringFn, type ScoringFnParams as ScoringFnParams, type ScoringFunctionListResponse as ScoringFunctionListResponse, - type ScoringFunctionRegisterParams as ScoringFunctionRegisterParams, }; } diff --git a/src/resources/scoring.ts b/src/resources/scoring.ts index ad6c620..03f535b 100644 --- a/src/resources/scoring.ts +++ b/src/resources/scoring.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 5ed757c..bcf5228 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -3,245 +3,9 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as ToolRuntimeAPI from './tool-runtime/tool-runtime'; - -/** - * Configuration for an agent. - */ -export interface AgentConfig { - /** - * The system instructions for the agent - */ - instructions: string; - - /** - * The model identifier to use for the agent - */ - model: string; - - client_tools?: Array; - - /** - * Optional flag indicating whether session data has to be persisted - */ - enable_session_persistence?: boolean; - - input_shields?: Array; - - max_infer_iters?: number; - - /** - * Optional name for the agent, used in telemetry and identification - */ - name?: string; - - output_shields?: Array; - - /** - * Optional response format configuration - */ - response_format?: ResponseFormat; - - /** - * Sampling parameters. - */ - sampling_params?: SamplingParams; - - /** - * @deprecated Whether tool use is required or automatic. This is a hint to the - * model which may not be followed. It depends on the Instruction Following - * capabilities of the model. - */ - tool_choice?: 'auto' | 'required' | 'none'; - - /** - * Configuration for tool use. - */ - tool_config?: AgentConfig.ToolConfig; - - /** - * @deprecated Prompt format for calling custom / zero shot tools. - */ - tool_prompt_format?: 'json' | 'function_tag' | 'python_list'; - - toolgroups?: Array; -} - -export namespace AgentConfig { - /** - * Configuration for tool use. - */ - export interface ToolConfig { - /** - * (Optional) Config for how to override the default system prompt. - - * `SystemMessageBehavior.append`: Appends the provided system message to the - * default system prompt. - `SystemMessageBehavior.replace`: Replaces the default - * system prompt with the provided system message. The system message can include - * the string '{{function_definitions}}' to indicate where the function definitions - * should be inserted. - */ - system_message_behavior?: 'append' | 'replace'; - - /** - * (Optional) Whether tool use is automatic, required, or none. Can also specify a - * tool name to use a specific tool. Defaults to ToolChoice.auto. - */ - tool_choice?: 'auto' | 'required' | 'none' | (string & {}); - - /** - * (Optional) Instructs the model how to format tool calls. By default, Llama Stack - * will attempt to use a format that is best adapted to the model. - - * `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. - - * `ToolPromptFormat.function_tag`: The tool calls are enclosed in a - * tag. - `ToolPromptFormat.python_list`: The tool calls - * are output as Python syntax -- a list of function calls. - */ - tool_prompt_format?: 'json' | 'function_tag' | 'python_list'; - } - - export interface AgentToolGroupWithArgs { - args: { [key: string]: boolean | number | string | Array | unknown | null }; - - name: string; - } -} - -/** - * A message containing the model's (assistant) response in a chat conversation. - */ -export interface CompletionMessage { - /** - * The content of the model's response - */ - content: InterleavedContent; - - /** - * Must be "assistant" to identify this as the model's response - */ - role: 'assistant'; - - /** - * Reason why the model stopped generating. Options are: - - * `StopReason.end_of_turn`: The model finished generating the entire response. - - * `StopReason.end_of_message`: The model finished generating but generated a - * partial response -- usually, a tool call. The user may call the tool and - * continue the conversation with the tool's response. - - * `StopReason.out_of_tokens`: The model ran out of token budget. - */ - stop_reason: 'end_of_turn' | 'end_of_message' | 'out_of_tokens'; - - /** - * List of tool calls. Each tool call is a ToolCall object. - */ - tool_calls?: Array; -} - -/** - * A document to be used for document ingestion in the RAG Tool. - */ -export interface Document { - /** - * The content of the document. - */ - content: - | string - | Document.ImageContentItem - | Document.TextContentItem - | Array - | Document.URL; - - /** - * The unique identifier for the document. - */ - document_id: string; - - /** - * Additional metadata for the document. - */ - metadata: { [key: string]: boolean | number | string | Array | unknown | null }; - - /** - * The MIME type of the document. - */ - mime_type?: string; -} - -export namespace Document { - /** - * A image content item - */ - export interface ImageContentItem { - /** - * Image as a base64 encoded string or an URL - */ - image: ImageContentItem.Image; - - /** - * Discriminator type of the content item. Always "image" - */ - type: 'image'; - } - - export namespace ImageContentItem { - /** - * Image as a base64 encoded string or an URL - */ - export interface Image { - /** - * base64 encoded image data as string - */ - data?: string; - - /** - * A URL of the image or data URL in the format of data:image/{type};base64,{data}. - * Note that URL could have length limits. - */ - url?: Image.URL; - } - - export namespace Image { - /** - * A URL of the image or data URL in the format of data:image/{type};base64,{data}. - * Note that URL could have length limits. - */ - export interface URL { - /** - * The URL string pointing to the resource - */ - uri: string; - } - } - } - - /** - * A text content item - */ - export interface TextContentItem { - /** - * Text content - */ - text: string; - - /** - * Discriminator type of the content item. Always "text" - */ - type: 'text'; - } - - /** - * A URL reference to external content. - */ - export interface URL { - /** - * The URL string pointing to the resource - */ - uri: string; - } -} - /** * A image content item */ @@ -384,289 +148,6 @@ export namespace InterleavedContentItem { } } -/** - * A message from the user in a chat conversation. - */ -export type Message = UserMessage | SystemMessage | ToolResponseMessage | CompletionMessage; - -/** - * Parameter type for string values. - */ -export type ParamType = - | ParamType.StringType - | ParamType.NumberType - | ParamType.BooleanType - | ParamType.ArrayType - | ParamType.ObjectType - | ParamType.JsonType - | ParamType.UnionType - | ParamType.ChatCompletionInputType - | ParamType.CompletionInputType - | 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'; - } -} - -/** - * Configuration for the RAG query generation. - */ -export interface QueryConfig { - /** - * Template for formatting each retrieved chunk in the context. Available - * placeholders: {index} (1-based chunk ordinal), {chunk.content} (chunk content - * string), {metadata} (chunk metadata dict). Default: "Result {index}\nContent: - * {chunk.content}\nMetadata: {metadata}\n" - */ - chunk_template: string; - - /** - * Maximum number of chunks to retrieve. - */ - max_chunks: number; - - /** - * Maximum number of tokens in the context. - */ - max_tokens_in_context: number; - - /** - * Configuration for the query generator. - */ - query_generator_config: QueryConfig.DefaultRagQueryGeneratorConfig | QueryConfig.LlmragQueryGeneratorConfig; - - /** - * Search mode for retrieval—either "vector", "keyword", or "hybrid". Default - * "vector". - */ - mode?: 'vector' | 'keyword' | 'hybrid'; - - /** - * Configuration for the ranker to use in hybrid search. Defaults to RRF ranker. - */ - ranker?: QueryConfig.RrfRanker | QueryConfig.WeightedRanker; -} - -export namespace QueryConfig { - /** - * 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'; - } - - /** - * Reciprocal Rank Fusion (RRF) ranker configuration. - */ - export interface RrfRanker { - /** - * The impact factor for RRF scoring. Higher values give more weight to - * higher-ranked results. Must be greater than 0 - */ - impact_factor: number; - - /** - * The type of ranker, always "rrf" - */ - type: 'rrf'; - } - - /** - * Weighted ranker configuration that combines vector and keyword scores. - */ - export interface WeightedRanker { - /** - * Weight factor between 0 and 1. 0 means only use keyword scores, 1 means only use - * vector scores, values in between blend both scores. - */ - alpha: number; - - /** - * The type of ranker, always "weighted" - */ - type: 'weighted'; - } -} - -/** - * 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 }; - - /** - * (Optional) The retrieved content from the query - */ - content?: InterleavedContent; -} - -/** - * Configuration for JSON schema-guided response generation. - */ -export type ResponseFormat = ResponseFormat.JsonSchemaResponseFormat | ResponseFormat.GrammarResponseFormat; - -export namespace ResponseFormat { - /** - * Configuration for JSON schema-guided response generation. - */ - export interface JsonSchemaResponseFormat { - /** - * The JSON schema the response should conform to. In a Python SDK, this is often a - * `pydantic` model. - */ - json_schema: { [key: string]: boolean | number | string | Array | unknown | null }; - - /** - * Must be "json_schema" to identify this format type - */ - type: 'json_schema'; - } - - /** - * Configuration for grammar-guided response generation. - */ - export interface GrammarResponseFormat { - /** - * The BNF grammar specification the response should conform to - */ - bnf: { [key: string]: boolean | number | string | Array | unknown | null }; - - /** - * Must be "grammar" to identify this format type - */ - type: 'grammar'; - } -} - /** * Details of a safety violation detected by content moderation. */ @@ -800,52 +281,3 @@ export interface SystemMessage { */ role: 'system'; } - -export interface ToolCall { - arguments: string; - - call_id: string; - - tool_name: 'brave_search' | 'wolfram_alpha' | 'photogen' | 'code_interpreter' | (string & {}); -} - -/** - * A message representing the result of a tool invocation. - */ -export interface ToolResponseMessage { - /** - * Unique identifier for the tool call this response is for - */ - call_id: string; - - /** - * The response content from the tool - */ - content: InterleavedContent; - - /** - * Must be "tool" to identify this as a tool response - */ - role: 'tool'; -} - -/** - * A message from the user in a chat conversation. - */ -export interface UserMessage { - /** - * The content of the message, which can include text and other media - */ - content: InterleavedContent; - - /** - * Must be "user" to identify this as a user message - */ - role: 'user'; - - /** - * (Optional) This field is used internally by Llama Stack to pass RAG context. - * This field may be removed in the API in the future. - */ - context?: InterleavedContent; -} diff --git a/src/resources/shields.ts b/src/resources/shields.ts index 777d3e2..7c545bd 100644 --- a/src/resources/shields.ts +++ b/src/resources/shields.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; @@ -25,23 +25,6 @@ export class Shields extends APIResource { this._client.get('/v1/shields', options) as Core.APIPromise<{ data: ShieldListResponse }> )._thenUnwrap((obj) => obj.data); } - - /** - * Unregister a shield. - */ - delete(identifier: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/v1/shields/${identifier}`, { - ...options, - headers: { Accept: '*/*', ...options?.headers }, - }); - } - - /** - * Register a shield. - */ - register(body: ShieldRegisterParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/v1/shields', { body, ...options }); - } } export interface ListShieldsResponse { @@ -71,33 +54,10 @@ export interface Shield { export type ShieldListResponse = Array; -export interface ShieldRegisterParams { - /** - * The identifier of the shield to register. - */ - shield_id: string; - - /** - * The parameters of the shield. - */ - params?: { [key: string]: boolean | number | string | Array | unknown | null }; - - /** - * The identifier of the provider. - */ - provider_id?: string; - - /** - * The identifier of the shield in the provider. - */ - provider_shield_id?: string; -} - export declare namespace Shields { export { type ListShieldsResponse as ListShieldsResponse, type Shield as Shield, type ShieldListResponse as ShieldListResponse, - type ShieldRegisterParams as ShieldRegisterParams, }; } diff --git a/src/resources/synthetic-data-generation.ts b/src/resources/synthetic-data-generation.ts deleted file mode 100644 index 052a9d1..0000000 --- a/src/resources/synthetic-data-generation.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../resource'; -import * 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, - ): Core.APIPromise { - return this._client.post('/v1/synthetic-data-generation/generate', { body, ...options }); - } -} - -/** - * Response from the synthetic data generation. Batch of (prompt, response, score) - * 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; - - /** - * 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; -} - -export declare namespace SyntheticDataGeneration { - export { - type SyntheticDataGenerationResponse as SyntheticDataGenerationResponse, - type SyntheticDataGenerationGenerateParams as SyntheticDataGenerationGenerateParams, - }; -} diff --git a/src/resources/tool-runtime.ts b/src/resources/tool-runtime.ts index 6f2a068..6aeae0d 100644 --- a/src/resources/tool-runtime.ts +++ b/src/resources/tool-runtime.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './tool-runtime/index'; diff --git a/src/resources/tool-runtime/index.ts b/src/resources/tool-runtime/index.ts index 592f40d..01546d6 100644 --- a/src/resources/tool-runtime/index.ts +++ b/src/resources/tool-runtime/index.ts @@ -3,10 +3,10 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { RagTool, type RagToolInsertParams, type RagToolQueryParams } from './rag-tool'; +export { RagTool } from './rag-tool'; export { ToolRuntime, type ToolDef, diff --git a/src/resources/tool-runtime/rag-tool.ts b/src/resources/tool-runtime/rag-tool.ts index 0df1b75..ae54c59 100644 --- a/src/resources/tool-runtime/rag-tool.ts +++ b/src/resources/tool-runtime/rag-tool.ts @@ -3,67 +3,9 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as Shared from '../shared'; - -export class RagTool extends APIResource { - /** - * 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', { - body, - ...options, - headers: { Accept: '*/*', ...options?.headers }, - }); - } - - /** - * 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 }); - } -} - -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_store_id: string; -} - -export interface RagToolQueryParams { - /** - * The query content to search for in the indexed documents - */ - content: Shared.InterleavedContent; - - /** - * List of vector database IDs to search within - */ - vector_store_ids: Array; - - /** - * (Optional) Configuration parameters for the query operation - */ - query_config?: Shared.QueryConfig; -} -export declare namespace RagTool { - export { type RagToolInsertParams as RagToolInsertParams, type RagToolQueryParams as RagToolQueryParams }; -} +export class RagTool extends APIResource {} diff --git a/src/resources/tool-runtime/tool-runtime.ts b/src/resources/tool-runtime/tool-runtime.ts index 073a48d..234a594 100644 --- a/src/resources/tool-runtime/tool-runtime.ts +++ b/src/resources/tool-runtime/tool-runtime.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -11,7 +11,7 @@ import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as Shared from '../shared'; import * as RagToolAPI from './rag-tool'; -import { RagTool, RagToolInsertParams, RagToolQueryParams } from './rag-tool'; +import { RagTool } from './rag-tool'; export class ToolRuntime extends APIResource { ragTool: RagToolAPI.RagTool = new RagToolAPI.RagTool(this._client); @@ -161,9 +161,5 @@ export declare namespace ToolRuntime { type ToolRuntimeListToolsParams as ToolRuntimeListToolsParams, }; - export { - RagTool as RagTool, - type RagToolInsertParams as RagToolInsertParams, - type RagToolQueryParams as RagToolQueryParams, - }; + export { RagTool as RagTool }; } diff --git a/src/resources/toolgroups.ts b/src/resources/toolgroups.ts index 37f34aa..4851de5 100644 --- a/src/resources/toolgroups.ts +++ b/src/resources/toolgroups.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; @@ -25,27 +25,6 @@ export class Toolgroups extends APIResource { get(toolgroupId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/v1/toolgroups/${toolgroupId}`, options); } - - /** - * Register a tool group. - */ - register(body: ToolgroupRegisterParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/v1/toolgroups', { - body, - ...options, - headers: { Accept: '*/*', ...options?.headers }, - }); - } - - /** - * Unregister a tool group. - */ - unregister(toolgroupId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/v1/toolgroups/${toolgroupId}`, { - ...options, - headers: { Accept: '*/*', ...options?.headers }, - }); - } } /** @@ -101,45 +80,10 @@ export namespace ToolGroup { */ export type ToolgroupListResponse = Array; -export interface ToolgroupRegisterParams { - /** - * The ID of the provider to use for the tool group. - */ - provider_id: string; - - /** - * The ID of the tool group to register. - */ - toolgroup_id: string; - - /** - * A dictionary of arguments to pass to the tool group. - */ - args?: { [key: string]: boolean | number | string | Array | unknown | null }; - - /** - * The MCP endpoint to use for the tool group. - */ - mcp_endpoint?: ToolgroupRegisterParams.McpEndpoint; -} - -export namespace ToolgroupRegisterParams { - /** - * The MCP endpoint to use for the tool group. - */ - export interface McpEndpoint { - /** - * The URL string pointing to the resource - */ - uri: string; - } -} - export declare namespace Toolgroups { export { type ListToolGroupsResponse as ListToolGroupsResponse, type ToolGroup as ToolGroup, type ToolgroupListResponse as ToolgroupListResponse, - type ToolgroupRegisterParams as ToolgroupRegisterParams, }; } diff --git a/src/resources/tools.ts b/src/resources/tools.ts index 93f95b7..d153d3c 100644 --- a/src/resources/tools.ts +++ b/src/resources/tools.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; diff --git a/src/resources/vector-io.ts b/src/resources/vector-io.ts index 91e9bef..ff299cb 100644 --- a/src/resources/vector-io.ts +++ b/src/resources/vector-io.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; @@ -50,6 +50,11 @@ export namespace QueryChunksResponse { * A chunk of content that can be inserted into a vector database. */ export interface Chunk { + /** + * Unique identifier for the chunk. Must be provided explicitly. + */ + chunk_id: string; + /** * The content of the chunk, which can be interleaved text, images, or other types. */ @@ -71,12 +76,6 @@ export namespace QueryChunksResponse { * Optional embedding for the chunk. If not provided, it will be computed later. */ embedding?: Array; - - /** - * The chunk ID that is stored in the vector database. Used for backend - * functionality. - */ - stored_chunk_id?: string; } export namespace Chunk { @@ -170,6 +169,11 @@ export namespace VectorIoInsertParams { * A chunk of content that can be inserted into a vector database. */ export interface Chunk { + /** + * Unique identifier for the chunk. Must be provided explicitly. + */ + chunk_id: string; + /** * The content of the chunk, which can be interleaved text, images, or other types. */ @@ -191,12 +195,6 @@ export namespace VectorIoInsertParams { * Optional embedding for the chunk. If not provided, it will be computed later. */ embedding?: Array; - - /** - * The chunk ID that is stored in the vector database. Used for backend - * functionality. - */ - stored_chunk_id?: string; } export namespace Chunk { diff --git a/src/resources/vector-stores.ts b/src/resources/vector-stores.ts index e719888..73f7d72 100644 --- a/src/resources/vector-stores.ts +++ b/src/resources/vector-stores.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export * from './vector-stores/index'; diff --git a/src/resources/vector-stores/file-batches.ts b/src/resources/vector-stores/file-batches.ts index 75085eb..6c2335b 100644 --- a/src/resources/vector-stores/file-batches.ts +++ b/src/resources/vector-stores/file-batches.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; diff --git a/src/resources/vector-stores/files.ts b/src/resources/vector-stores/files.ts index d8b856a..cf4b20d 100644 --- a/src/resources/vector-stores/files.ts +++ b/src/resources/vector-stores/files.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -90,9 +90,27 @@ export class Files extends APIResource { content( vectorStoreId: string, fileId: string, + query?: FileContentParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + content( + vectorStoreId: string, + fileId: string, + options?: Core.RequestOptions, + ): Core.APIPromise; + content( + vectorStoreId: string, + fileId: string, + query: FileContentParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { - return this._client.get(`/v1/vector_stores/${vectorStoreId}/files/${fileId}/content`, options); + if (isRequestOptions(query)) { + return this.content(vectorStoreId, fileId, {}, query); + } + return this._client.get(`/v1/vector_stores/${vectorStoreId}/files/${fileId}/content`, { + query, + ...options, + }); } } @@ -230,35 +248,35 @@ export interface FileDeleteResponse { } /** - * Response from retrieving the contents of a vector store file. + * Represents the parsed content of a vector store file. */ export interface FileContentResponse { /** - * Key-value attributes associated with the file + * Parsed content of the file */ - attributes: { [key: string]: boolean | number | string | Array | unknown | null }; + data: Array; /** - * List of content items from the file + * Indicates if there are more content pages to fetch */ - content: Array; + has_more: boolean; /** - * Unique identifier for the file + * The object type, which is always `vector_store.file_content.page` */ - file_id: string; + object: 'vector_store.file_content.page'; /** - * Name of the file + * The token for the next page, if any */ - filename: string; + next_page?: string; } export namespace FileContentResponse { /** * Content item from a vector store file or search result. */ - export interface Content { + export interface Data { /** * The actual text content */ @@ -268,6 +286,84 @@ export namespace FileContentResponse { * Content type, currently only "text" is supported */ type: 'text'; + + /** + * Optional chunk metadata + */ + chunk_metadata?: Data.ChunkMetadata; + + /** + * Optional embedding vector for this content chunk + */ + embedding?: Array; + + /** + * Optional user-defined metadata + */ + metadata?: { [key: string]: boolean | number | string | Array | unknown | null }; + } + + export namespace Data { + /** + * Optional chunk metadata + */ + export interface ChunkMetadata { + /** + * The dimension of the embedding vector for the chunk. + */ + chunk_embedding_dimension?: number; + + /** + * The embedding model used to create the chunk's embedding. + */ + chunk_embedding_model?: string; + + /** + * The ID of the chunk. If not set, it will be generated based on the document ID + * and content. + */ + chunk_id?: string; + + /** + * The tokenizer used to create the chunk. Default is Tiktoken. + */ + chunk_tokenizer?: string; + + /** + * The window of the chunk, which can be used to group related chunks together. + */ + chunk_window?: string; + + /** + * The number of tokens in the content of the chunk. + */ + content_token_count?: number; + + /** + * An optional timestamp indicating when the chunk was created. + */ + created_timestamp?: number; + + /** + * The ID of the document this chunk belongs to. + */ + document_id?: string; + + /** + * The number of tokens in the metadata of the chunk. + */ + metadata_token_count?: number; + + /** + * The source of the content, such as a URL, file path, or other identifier. + */ + source?: string; + + /** + * An optional timestamp indicating when the chunk was last updated. + */ + updated_timestamp?: number; + } } } @@ -360,6 +456,18 @@ export interface FileListParams extends OpenAICursorPageParams { order?: string; } +export interface FileContentParams { + /** + * Whether to include embedding vectors in the response. + */ + include_embeddings?: boolean; + + /** + * Whether to include chunk metadata in the response. + */ + include_metadata?: boolean; +} + Files.VectorStoreFilesOpenAICursorPage = VectorStoreFilesOpenAICursorPage; export declare namespace Files { @@ -371,5 +479,6 @@ export declare namespace Files { type FileCreateParams as FileCreateParams, type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, + type FileContentParams as FileContentParams, }; } diff --git a/src/resources/vector-stores/index.ts b/src/resources/vector-stores/index.ts index 360f4ce..e8eed69 100644 --- a/src/resources/vector-stores/index.ts +++ b/src/resources/vector-stores/index.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { @@ -22,6 +22,7 @@ export { type FileCreateParams, type FileUpdateParams, type FileListParams, + type FileContentParams, } from './files'; export { VectorStoresOpenAICursorPage, diff --git a/src/resources/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts index 56d44c6..a780ff2 100644 --- a/src/resources/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; @@ -19,6 +19,7 @@ import { } from './file-batches'; import * as FilesAPI from './files'; import { + FileContentParams, FileContentResponse, FileCreateParams, FileDeleteResponse, @@ -264,7 +265,7 @@ export interface VectorStoreSearchResponse { /** * The original search query that was executed */ - search_query: string; + search_query: Array; /** * (Optional) Token for retrieving the next page of results @@ -317,6 +318,84 @@ export namespace VectorStoreSearchResponse { * Content type, currently only "text" is supported */ type: 'text'; + + /** + * Optional chunk metadata + */ + chunk_metadata?: Content.ChunkMetadata; + + /** + * Optional embedding vector for this content chunk + */ + embedding?: Array; + + /** + * Optional user-defined metadata + */ + metadata?: { [key: string]: boolean | number | string | Array | unknown | null }; + } + + export namespace Content { + /** + * Optional chunk metadata + */ + export interface ChunkMetadata { + /** + * The dimension of the embedding vector for the chunk. + */ + chunk_embedding_dimension?: number; + + /** + * The embedding model used to create the chunk's embedding. + */ + chunk_embedding_model?: string; + + /** + * The ID of the chunk. If not set, it will be generated based on the document ID + * and content. + */ + chunk_id?: string; + + /** + * The tokenizer used to create the chunk. Default is Tiktoken. + */ + chunk_tokenizer?: string; + + /** + * The window of the chunk, which can be used to group related chunks together. + */ + chunk_window?: string; + + /** + * The number of tokens in the content of the chunk. + */ + content_token_count?: number; + + /** + * An optional timestamp indicating when the chunk was created. + */ + created_timestamp?: number; + + /** + * The ID of the document this chunk belongs to. + */ + document_id?: string; + + /** + * The number of tokens in the metadata of the chunk. + */ + metadata_token_count?: number; + + /** + * The source of the content, such as a URL, file path, or other identifier. + */ + source?: string; + + /** + * An optional timestamp indicating when the chunk was last updated. + */ + updated_timestamp?: number; + } } } } @@ -325,7 +404,9 @@ export interface VectorStoreCreateParams { /** * (Optional) Strategy for splitting files into chunks */ - chunking_strategy?: { [key: string]: boolean | number | string | Array | unknown | null }; + chunking_strategy?: + | VectorStoreCreateParams.VectorStoreChunkingStrategyAuto + | VectorStoreCreateParams.VectorStoreChunkingStrategyStatic; /** * (Optional) Expiration policy for the vector store @@ -348,6 +429,50 @@ export interface VectorStoreCreateParams { name?: string; } +export namespace VectorStoreCreateParams { + /** + * 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; + } + } +} + export interface VectorStoreUpdateParams { /** * The expiration policy for a vector store. @@ -455,6 +580,7 @@ export declare namespace VectorStores { type FileCreateParams as FileCreateParams, type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, + type FileContentParams as FileContentParams, }; export { diff --git a/src/version.ts b/src/version.ts index 3d185c9..802193d 100644 --- a/src/version.ts +++ b/src/version.ts @@ -4,4 +4,4 @@ // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. -export const VERSION = '0.4.0-alpha.1'; // x-release-please-version +export const VERSION = '0.4.0-alpha.2'; // x-release-please-version diff --git a/tests/api-resources/alpha/agents/agents.test.ts b/tests/api-resources/alpha/agents/agents.test.ts deleted file mode 100644 index 74f7848..0000000 --- a/tests/api-resources/alpha/agents/agents.test.ts +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import 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 agents', () => { - test('create: only required params', async () => { - const responsePromise = client.alpha.agents.create({ - agent_config: { instructions: 'instructions', 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.alpha.agents.create({ - agent_config: { - instructions: 'instructions', - model: 'model', - client_tools: [ - { - name: 'name', - description: 'description', - input_schema: { foo: true }, - metadata: { foo: true }, - output_schema: { foo: true }, - toolgroup_id: 'toolgroup_id', - }, - ], - enable_session_persistence: true, - input_shields: ['string'], - max_infer_iters: 0, - name: 'name', - output_shields: ['string'], - response_format: { json_schema: { foo: true }, type: 'json_schema' }, - sampling_params: { - strategy: { type: 'greedy' }, - max_tokens: 0, - repetition_penalty: 0, - stop: ['string'], - }, - tool_choice: 'auto', - tool_config: { system_message_behavior: 'append', tool_choice: 'auto', tool_prompt_format: 'json' }, - tool_prompt_format: 'json', - toolgroups: ['string'], - }, - }); - }); - - test('retrieve', async () => { - const responsePromise = client.alpha.agents.retrieve('agent_id'); - 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('retrieve: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.alpha.agents.retrieve('agent_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); - - test('list', async () => { - const responsePromise = client.alpha.agents.list(); - 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('list: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.alpha.agents.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( - LlamaStackClient.NotFoundError, - ); - }); - - test('list: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.alpha.agents.list({ limit: 0, start_index: 0 }, { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); - - test('delete', async () => { - const responsePromise = client.alpha.agents.delete('agent_id'); - 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('delete: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.alpha.agents.delete('agent_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); -}); diff --git a/tests/api-resources/alpha/agents/session.test.ts b/tests/api-resources/alpha/agents/session.test.ts deleted file mode 100644 index 8542a63..0000000 --- a/tests/api-resources/alpha/agents/session.test.ts +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import 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 session', () => { - test('create: only required params', async () => { - const responsePromise = client.alpha.agents.session.create('agent_id', { session_name: 'session_name' }); - 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.alpha.agents.session.create('agent_id', { session_name: 'session_name' }); - }); - - test('retrieve', async () => { - const responsePromise = client.alpha.agents.session.retrieve('agent_id', 'session_id'); - 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('retrieve: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.alpha.agents.session.retrieve('agent_id', 'session_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); - - test('retrieve: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.alpha.agents.session.retrieve( - 'agent_id', - 'session_id', - { turn_ids: ['string'] }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); - - test('list', async () => { - const responsePromise = client.alpha.agents.session.list('agent_id'); - 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('list: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.alpha.agents.session.list('agent_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); - - test('list: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.alpha.agents.session.list( - 'agent_id', - { limit: 0, start_index: 0 }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); - - test('delete', async () => { - const responsePromise = client.alpha.agents.session.delete('agent_id', 'session_id'); - 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('delete: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.alpha.agents.session.delete('agent_id', 'session_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); -}); diff --git a/tests/api-resources/alpha/agents/steps.test.ts b/tests/api-resources/alpha/agents/steps.test.ts deleted file mode 100644 index 69eeb97..0000000 --- a/tests/api-resources/alpha/agents/steps.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import 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 steps', () => { - test('retrieve', async () => { - const responsePromise = client.alpha.agents.steps.retrieve( - 'agent_id', - 'session_id', - 'turn_id', - 'step_id', - ); - 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('retrieve: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.alpha.agents.steps.retrieve('agent_id', 'session_id', 'turn_id', 'step_id', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); -}); diff --git a/tests/api-resources/alpha/agents/turn.test.ts b/tests/api-resources/alpha/agents/turn.test.ts deleted file mode 100644 index 54b8c75..0000000 --- a/tests/api-resources/alpha/agents/turn.test.ts +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import 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 turn', () => { - test('create: only required params', async () => { - const responsePromise = client.alpha.agents.turn.create('agent_id', 'session_id', { - messages: [{ content: 'string', role: 'user' }], - }); - 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.alpha.agents.turn.create('agent_id', 'session_id', { - messages: [{ content: 'string', role: 'user', context: 'string' }], - documents: [{ content: 'string', mime_type: 'mime_type' }], - stream: false, - tool_config: { system_message_behavior: 'append', tool_choice: 'auto', tool_prompt_format: 'json' }, - toolgroups: ['string'], - }); - }); - - test('retrieve', async () => { - const responsePromise = client.alpha.agents.turn.retrieve('agent_id', 'session_id', 'turn_id'); - 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('retrieve: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.alpha.agents.turn.retrieve('agent_id', 'session_id', 'turn_id', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); - - test('resume: only required params', async () => { - const responsePromise = client.alpha.agents.turn.resume('agent_id', 'session_id', 'turn_id', { - tool_responses: [{ call_id: 'call_id', content: 'string', tool_name: 'brave_search' }], - }); - 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('resume: required and optional params', async () => { - const response = await client.alpha.agents.turn.resume('agent_id', 'session_id', 'turn_id', { - tool_responses: [ - { call_id: 'call_id', content: 'string', tool_name: 'brave_search', metadata: { foo: true } }, - ], - stream: false, - }); - }); -}); diff --git a/tests/api-resources/alpha/benchmarks.test.ts b/tests/api-resources/alpha/benchmarks.test.ts index f254130..e631c8c 100644 --- a/tests/api-resources/alpha/benchmarks.test.ts +++ b/tests/api-resources/alpha/benchmarks.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/alpha/eval/eval.test.ts b/tests/api-resources/alpha/eval/eval.test.ts index 00fd965..95150fd 100644 --- a/tests/api-resources/alpha/eval/eval.test.ts +++ b/tests/api-resources/alpha/eval/eval.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/alpha/eval/jobs.test.ts b/tests/api-resources/alpha/eval/jobs.test.ts index f3e58c9..1cb457f 100644 --- a/tests/api-resources/alpha/eval/jobs.test.ts +++ b/tests/api-resources/alpha/eval/jobs.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/alpha/inference.test.ts b/tests/api-resources/alpha/inference.test.ts index 0d353cc..aae8399 100644 --- a/tests/api-resources/alpha/inference.test.ts +++ b/tests/api-resources/alpha/inference.test.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/alpha/post-training/job.test.ts b/tests/api-resources/alpha/post-training/job.test.ts index 837f3b8..1ebb09c 100644 --- a/tests/api-resources/alpha/post-training/job.test.ts +++ b/tests/api-resources/alpha/post-training/job.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/alpha/post-training/post-training.test.ts b/tests/api-resources/alpha/post-training/post-training.test.ts index 1147c80..365d1eb 100644 --- a/tests/api-resources/alpha/post-training/post-training.test.ts +++ b/tests/api-resources/alpha/post-training/post-training.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/beta/datasets.test.ts b/tests/api-resources/beta/datasets.test.ts index 88e040e..208f521 100644 --- a/tests/api-resources/beta/datasets.test.ts +++ b/tests/api-resources/beta/datasets.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index f6a5f81..563dc6c 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/completions.test.ts b/tests/api-resources/completions.test.ts index 9b6ecdb..45b46dc 100644 --- a/tests/api-resources/completions.test.ts +++ b/tests/api-resources/completions.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/conversations/conversations.test.ts b/tests/api-resources/conversations/conversations.test.ts index 682a704..517d964 100644 --- a/tests/api-resources/conversations/conversations.test.ts +++ b/tests/api-resources/conversations/conversations.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/conversations/items.test.ts b/tests/api-resources/conversations/items.test.ts index 4177bfc..e195001 100644 --- a/tests/api-resources/conversations/items.test.ts +++ b/tests/api-resources/conversations/items.test.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/embeddings.test.ts b/tests/api-resources/embeddings.test.ts index 312c4ae..7836c30 100644 --- a/tests/api-resources/embeddings.test.ts +++ b/tests/api-resources/embeddings.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/files.test.ts b/tests/api-resources/files.test.ts index db5ef19..d74db87 100644 --- a/tests/api-resources/files.test.ts +++ b/tests/api-resources/files.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient, { toFile } from 'llama-stack-client'; diff --git a/tests/api-resources/inspect.test.ts b/tests/api-resources/inspect.test.ts index 82cc4ff..dd6d795 100644 --- a/tests/api-resources/inspect.test.ts +++ b/tests/api-resources/inspect.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/models/models.test.ts b/tests/api-resources/models/models.test.ts index 1efd4e1..eb1de84 100644 --- a/tests/api-resources/models/models.test.ts +++ b/tests/api-resources/models/models.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; @@ -47,43 +47,4 @@ describe('resource models', () => { LlamaStackClient.NotFoundError, ); }); - - test('register: only required params', async () => { - const responsePromise = client.models.register({ model_id: 'model_id' }); - 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('register: required and optional params', async () => { - const response = await client.models.register({ - model_id: 'model_id', - metadata: { foo: true }, - model_type: 'llm', - provider_id: 'provider_id', - provider_model_id: 'provider_model_id', - }); - }); - - test('unregister', async () => { - const responsePromise = client.models.unregister('model_id'); - 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('unregister: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.models.unregister('model_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - LlamaStackClient.NotFoundError, - ); - }); }); diff --git a/tests/api-resources/models/openai.test.ts b/tests/api-resources/models/openai.test.ts index cfb793f..aedb255 100644 --- a/tests/api-resources/models/openai.test.ts +++ b/tests/api-resources/models/openai.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/moderations.test.ts b/tests/api-resources/moderations.test.ts index 06f8e2b..858c311 100644 --- a/tests/api-resources/moderations.test.ts +++ b/tests/api-resources/moderations.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/prompts/prompts.test.ts b/tests/api-resources/prompts/prompts.test.ts index 2209860..4a42502 100644 --- a/tests/api-resources/prompts/prompts.test.ts +++ b/tests/api-resources/prompts/prompts.test.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/prompts/versions.test.ts b/tests/api-resources/prompts/versions.test.ts index 515e3e6..7ad2ebc 100644 --- a/tests/api-resources/prompts/versions.test.ts +++ b/tests/api-resources/prompts/versions.test.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/providers.test.ts b/tests/api-resources/providers.test.ts index f6759c5..5052f61 100644 --- a/tests/api-resources/providers.test.ts +++ b/tests/api-resources/providers.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/responses/input-items.test.ts b/tests/api-resources/responses/input-items.test.ts index e8e9723..c72edc6 100644 --- a/tests/api-resources/responses/input-items.test.ts +++ b/tests/api-resources/responses/input-items.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index 42b380b..f9d7a1e 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; @@ -31,7 +31,9 @@ describe('resource responses', () => { include: ['string'], instructions: 'instructions', max_infer_iters: 0, + max_tool_calls: 0, previous_response_id: 'previous_response_id', + prompt: { id: 'id', variables: { foo: { text: 'text', type: 'input_text' } }, version: 'version' }, store: true, stream: false, temperature: 0, diff --git a/tests/api-resources/routes.test.ts b/tests/api-resources/routes.test.ts index 18977c9..b109215 100644 --- a/tests/api-resources/routes.test.ts +++ b/tests/api-resources/routes.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; @@ -29,4 +29,11 @@ describe('resource routes', () => { LlamaStackClient.NotFoundError, ); }); + + test('list: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.routes.list({ api_filter: 'v1' }, { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(LlamaStackClient.NotFoundError); + }); }); diff --git a/tests/api-resources/safety.test.ts b/tests/api-resources/safety.test.ts index 86420ac..adbc3ee 100644 --- a/tests/api-resources/safety.test.ts +++ b/tests/api-resources/safety.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/scoring-functions.test.ts b/tests/api-resources/scoring-functions.test.ts index 852254c..f1f0e1e 100644 --- a/tests/api-resources/scoring-functions.test.ts +++ b/tests/api-resources/scoring-functions.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; @@ -47,36 +47,4 @@ describe('resource scoringFunctions', () => { LlamaStackClient.NotFoundError, ); }); - - test('register: only required params', async () => { - const responsePromise = client.scoringFunctions.register({ - description: 'description', - return_type: { type: 'string' }, - scoring_fn_id: 'scoring_fn_id', - }); - 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('register: required and optional params', async () => { - const response = await client.scoringFunctions.register({ - description: 'description', - return_type: { type: 'string' }, - scoring_fn_id: 'scoring_fn_id', - params: { - aggregation_functions: ['average'], - judge_model: 'judge_model', - judge_score_regexes: ['string'], - type: 'llm_as_judge', - prompt_template: 'prompt_template', - }, - provider_id: 'provider_id', - provider_scoring_fn_id: 'provider_scoring_fn_id', - }); - }); }); diff --git a/tests/api-resources/scoring.test.ts b/tests/api-resources/scoring.test.ts index dc48e1e..8fc7caa 100644 --- a/tests/api-resources/scoring.test.ts +++ b/tests/api-resources/scoring.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/shields.test.ts b/tests/api-resources/shields.test.ts index 1417cec..3bd40cd 100644 --- a/tests/api-resources/shields.test.ts +++ b/tests/api-resources/shields.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; @@ -47,42 +47,4 @@ describe('resource shields', () => { LlamaStackClient.NotFoundError, ); }); - - test('delete', async () => { - const responsePromise = client.shields.delete('identifier'); - 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('delete: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.shields.delete('identifier', { path: '/_stainless_unknown_path' })).rejects.toThrow( - LlamaStackClient.NotFoundError, - ); - }); - - test('register: only required params', async () => { - const responsePromise = client.shields.register({ shield_id: 'shield_id' }); - 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('register: required and optional params', async () => { - const response = await client.shields.register({ - shield_id: 'shield_id', - params: { foo: true }, - provider_id: 'provider_id', - provider_shield_id: 'provider_shield_id', - }); - }); }); diff --git a/tests/api-resources/synthetic-data-generation.test.ts b/tests/api-resources/synthetic-data-generation.test.ts deleted file mode 100644 index e8c54a7..0000000 --- a/tests/api-resources/synthetic-data-generation.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import 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 syntheticDataGeneration', () => { - test('generate: only required params', async () => { - const responsePromise = client.syntheticDataGeneration.generate({ - dialogs: [{ content: 'string', role: 'user' }], - filtering_function: 'none', - }); - 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('generate: required and optional params', async () => { - const response = await client.syntheticDataGeneration.generate({ - dialogs: [{ content: 'string', role: 'user', context: 'string' }], - filtering_function: 'none', - model: 'model', - }); - }); -}); diff --git a/tests/api-resources/tool-runtime/rag-tool.test.ts b/tests/api-resources/tool-runtime/rag-tool.test.ts deleted file mode 100644 index 5a50e64..0000000 --- a/tests/api-resources/tool-runtime/rag-tool.test.ts +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Meta Platforms, Inc. and affiliates. -// All rights reserved. -// -// This source code is licensed under the terms described in the LICENSE file in -// the root directory of this source tree. - -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import 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 ragTool', () => { - test('insert: only required params', async () => { - const responsePromise = client.toolRuntime.ragTool.insert({ - chunk_size_in_tokens: 0, - documents: [{ content: 'string', document_id: 'document_id', metadata: { foo: true } }], - vector_store_id: 'vector_store_id', - }); - 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('insert: required and optional params', async () => { - const response = await client.toolRuntime.ragTool.insert({ - chunk_size_in_tokens: 0, - documents: [ - { content: 'string', document_id: 'document_id', metadata: { foo: true }, mime_type: 'mime_type' }, - ], - vector_store_id: 'vector_store_id', - }); - }); - - test('query: only required params', async () => { - const responsePromise = client.toolRuntime.ragTool.query({ - content: 'string', - vector_store_ids: ['string'], - }); - 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('query: required and optional params', async () => { - const response = await client.toolRuntime.ragTool.query({ - content: 'string', - vector_store_ids: ['string'], - query_config: { - chunk_template: 'chunk_template', - max_chunks: 0, - max_tokens_in_context: 0, - query_generator_config: { separator: 'separator', type: 'default' }, - mode: 'vector', - ranker: { impact_factor: 0, type: 'rrf' }, - }, - }); - }); -}); diff --git a/tests/api-resources/tool-runtime/tool-runtime.test.ts b/tests/api-resources/tool-runtime/tool-runtime.test.ts index d11a0d1..b95353c 100644 --- a/tests/api-resources/tool-runtime/tool-runtime.test.ts +++ b/tests/api-resources/tool-runtime/tool-runtime.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; @@ -27,7 +27,7 @@ describe('resource toolRuntime', () => { const response = await client.toolRuntime.invokeTool({ kwargs: { foo: true }, tool_name: 'tool_name' }); }); - test.skip('listTools (skipping because a strange 400 happens)', async () => { + test('listTools', async () => { const responsePromise = client.toolRuntime.listTools(); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); diff --git a/tests/api-resources/toolgroups.test.ts b/tests/api-resources/toolgroups.test.ts index 2a395df..9604f4e 100644 --- a/tests/api-resources/toolgroups.test.ts +++ b/tests/api-resources/toolgroups.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; @@ -47,45 +47,4 @@ describe('resource toolgroups', () => { LlamaStackClient.NotFoundError, ); }); - - test('register: only required params', async () => { - const responsePromise = client.toolgroups.register({ - provider_id: 'provider_id', - toolgroup_id: 'toolgroup_id', - }); - 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('register: required and optional params', async () => { - const response = await client.toolgroups.register({ - provider_id: 'provider_id', - toolgroup_id: 'toolgroup_id', - args: { foo: true }, - mcp_endpoint: { uri: 'uri' }, - }); - }); - - test('unregister', async () => { - const responsePromise = client.toolgroups.unregister('toolgroup_id'); - 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('unregister: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.toolgroups.unregister('toolgroup_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(LlamaStackClient.NotFoundError); - }); }); diff --git a/tests/api-resources/tools.test.ts b/tests/api-resources/tools.test.ts index efa531c..767d0c8 100644 --- a/tests/api-resources/tools.test.ts +++ b/tests/api-resources/tools.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/vector-io.test.ts b/tests/api-resources/vector-io.test.ts index 6c8ecf4..7b964e6 100644 --- a/tests/api-resources/vector-io.test.ts +++ b/tests/api-resources/vector-io.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; @@ -14,7 +14,7 @@ const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL'] describe('resource vectorIo', () => { test('insert: only required params', async () => { const responsePromise = client.vectorIo.insert({ - chunks: [{ content: 'string', metadata: { foo: true } }], + chunks: [{ chunk_id: 'chunk_id', content: 'string', metadata: { foo: true } }], vector_store_id: 'vector_store_id', }); const rawResponse = await responsePromise.asResponse(); @@ -30,6 +30,7 @@ describe('resource vectorIo', () => { const response = await client.vectorIo.insert({ chunks: [ { + chunk_id: 'chunk_id', content: 'string', metadata: { foo: true }, chunk_metadata: { @@ -46,7 +47,6 @@ describe('resource vectorIo', () => { updated_timestamp: 0, }, embedding: [0], - stored_chunk_id: 'stored_chunk_id', }, ], vector_store_id: 'vector_store_id', diff --git a/tests/api-resources/vector-stores/file-batches.test.ts b/tests/api-resources/vector-stores/file-batches.test.ts index 98e8964..c131b7e 100644 --- a/tests/api-resources/vector-stores/file-batches.test.ts +++ b/tests/api-resources/vector-stores/file-batches.test.ts @@ -1,3 +1,9 @@ +// Copyright (c) Meta Platforms, Inc. and affiliates. +// All rights reserved. +// +// This source code is licensed under the terms described in the LICENSE file in +// the root directory of this source tree. +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/api-resources/vector-stores/files.test.ts b/tests/api-resources/vector-stores/files.test.ts index 565d697..4fdf8ea 100644 --- a/tests/api-resources/vector-stores/files.test.ts +++ b/tests/api-resources/vector-stores/files.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; @@ -132,4 +132,16 @@ describe('resource files', () => { client.vectorStores.files.content('vector_store_id', 'file_id', { path: '/_stainless_unknown_path' }), ).rejects.toThrow(LlamaStackClient.NotFoundError); }); + + test('content: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.vectorStores.files.content( + 'vector_store_id', + 'file_id', + { include_embeddings: true, include_metadata: true }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(LlamaStackClient.NotFoundError); + }); }); diff --git a/tests/api-resources/vector-stores/vector-stores.test.ts b/tests/api-resources/vector-stores/vector-stores.test.ts index 6eb91f6..fac63da 100644 --- a/tests/api-resources/vector-stores/vector-stores.test.ts +++ b/tests/api-resources/vector-stores/vector-stores.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/index.test.ts b/tests/index.test.ts index 6f10830..3cee864 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import LlamaStackClient from 'llama-stack-client'; diff --git a/tests/stringifyQuery.test.ts b/tests/stringifyQuery.test.ts index 2df1525..f4c904b 100644 --- a/tests/stringifyQuery.test.ts +++ b/tests/stringifyQuery.test.ts @@ -3,7 +3,7 @@ // // This source code is licensed under the terms described in the LICENSE file in // the root directory of this source tree. - +// // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { LlamaStackClient } from 'llama-stack-client';