Initial commit: KidsAI Explorer with complete functionality
- Complete KidsAI Explorer application - Multi-language support (English/German) - AI-powered educational guidance using OpenAI - Interactive chat interface for children - Proper placeholder translation fixes - Mobile-responsive design - Educational framework for critical thinking
This commit is contained in:
4
node_modules/openai/resources/beta/threads/index.d.mts
generated
vendored
Normal file
4
node_modules/openai/resources/beta/threads/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { Messages, type Annotation, type AnnotationDelta, type FileCitationAnnotation, type FileCitationDeltaAnnotation, type FilePathAnnotation, type FilePathDeltaAnnotation, type ImageFile, type ImageFileContentBlock, type ImageFileDelta, type ImageFileDeltaBlock, type ImageURL, type ImageURLContentBlock, type ImageURLDelta, type ImageURLDeltaBlock, type Message, type MessageContent, type MessageContentDelta, type MessageContentPartParam, type MessageDeleted, type MessageDelta, type MessageDeltaEvent, type RefusalContentBlock, type RefusalDeltaBlock, type Text, type TextContentBlock, type TextContentBlockParam, type TextDelta, type TextDeltaBlock, type MessageCreateParams, type MessageRetrieveParams, type MessageUpdateParams, type MessageListParams, type MessageDeleteParams, type MessagesPage, } from "./messages.mjs";
|
||||
export { Runs, type RequiredActionFunctionToolCall, type Run, type RunStatus, type RunCreateParams, type RunCreateParamsNonStreaming, type RunCreateParamsStreaming, type RunRetrieveParams, type RunUpdateParams, type RunListParams, type RunCancelParams, type RunSubmitToolOutputsParams, type RunSubmitToolOutputsParamsNonStreaming, type RunSubmitToolOutputsParamsStreaming, type RunsPage, type RunCreateAndPollParams, type RunCreateAndStreamParams, type RunStreamParams, type RunSubmitToolOutputsAndPollParams, type RunSubmitToolOutputsStreamParams, } from "./runs/index.mjs";
|
||||
export { Threads, type AssistantResponseFormatOption, type AssistantToolChoice, type AssistantToolChoiceFunction, type AssistantToolChoiceOption, type Thread, type ThreadDeleted, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, type ThreadCreateAndRunParamsNonStreaming, type ThreadCreateAndRunParamsStreaming, type ThreadCreateAndRunPollParams, type ThreadCreateAndRunStreamParams, } from "./threads.mjs";
|
||||
//# sourceMappingURL=index.d.mts.map
|
||||
1
node_modules/openai/resources/beta/threads/index.d.mts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/index.d.mts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/threads/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACT,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,YAAY,GAClB;OACM,EACL,IAAI,EACJ,KAAK,8BAA8B,EACnC,KAAK,GAAG,EACR,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,sCAAsC,EAC3C,KAAK,mCAAmC,EACxC,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,iCAAiC,EACtC,KAAK,gCAAgC,GACtC;OACM,EACL,OAAO,EACP,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,oCAAoC,EACzC,KAAK,iCAAiC,EACtC,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,GACpC"}
|
||||
4
node_modules/openai/resources/beta/threads/index.d.ts
generated
vendored
Normal file
4
node_modules/openai/resources/beta/threads/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { Messages, type Annotation, type AnnotationDelta, type FileCitationAnnotation, type FileCitationDeltaAnnotation, type FilePathAnnotation, type FilePathDeltaAnnotation, type ImageFile, type ImageFileContentBlock, type ImageFileDelta, type ImageFileDeltaBlock, type ImageURL, type ImageURLContentBlock, type ImageURLDelta, type ImageURLDeltaBlock, type Message, type MessageContent, type MessageContentDelta, type MessageContentPartParam, type MessageDeleted, type MessageDelta, type MessageDeltaEvent, type RefusalContentBlock, type RefusalDeltaBlock, type Text, type TextContentBlock, type TextContentBlockParam, type TextDelta, type TextDeltaBlock, type MessageCreateParams, type MessageRetrieveParams, type MessageUpdateParams, type MessageListParams, type MessageDeleteParams, type MessagesPage, } from "./messages.js";
|
||||
export { Runs, type RequiredActionFunctionToolCall, type Run, type RunStatus, type RunCreateParams, type RunCreateParamsNonStreaming, type RunCreateParamsStreaming, type RunRetrieveParams, type RunUpdateParams, type RunListParams, type RunCancelParams, type RunSubmitToolOutputsParams, type RunSubmitToolOutputsParamsNonStreaming, type RunSubmitToolOutputsParamsStreaming, type RunsPage, type RunCreateAndPollParams, type RunCreateAndStreamParams, type RunStreamParams, type RunSubmitToolOutputsAndPollParams, type RunSubmitToolOutputsStreamParams, } from "./runs/index.js";
|
||||
export { Threads, type AssistantResponseFormatOption, type AssistantToolChoice, type AssistantToolChoiceFunction, type AssistantToolChoiceOption, type Thread, type ThreadDeleted, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, type ThreadCreateAndRunParamsNonStreaming, type ThreadCreateAndRunParamsStreaming, type ThreadCreateAndRunPollParams, type ThreadCreateAndRunStreamParams, } from "./threads.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/openai/resources/beta/threads/index.d.ts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/threads/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACT,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,YAAY,GAClB;OACM,EACL,IAAI,EACJ,KAAK,8BAA8B,EACnC,KAAK,GAAG,EACR,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,sCAAsC,EAC3C,KAAK,mCAAmC,EACxC,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,iCAAiC,EACtC,KAAK,gCAAgC,GACtC;OACM,EACL,OAAO,EACP,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC9B,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,oCAAoC,EACzC,KAAK,iCAAiC,EACtC,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,GACpC"}
|
||||
11
node_modules/openai/resources/beta/threads/index.js
generated
vendored
Normal file
11
node_modules/openai/resources/beta/threads/index.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Threads = exports.Runs = exports.Messages = void 0;
|
||||
var messages_1 = require("./messages.js");
|
||||
Object.defineProperty(exports, "Messages", { enumerable: true, get: function () { return messages_1.Messages; } });
|
||||
var index_1 = require("./runs/index.js");
|
||||
Object.defineProperty(exports, "Runs", { enumerable: true, get: function () { return index_1.Runs; } });
|
||||
var threads_1 = require("./threads.js");
|
||||
Object.defineProperty(exports, "Threads", { enumerable: true, get: function () { return threads_1.Threads; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/openai/resources/beta/threads/index.js.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/beta/threads/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0CAoCoB;AAnClB,oGAAA,QAAQ,OAAA;AAoCV,yCAqBsB;AApBpB,6FAAA,IAAI,OAAA;AAqBN,wCAemB;AAdjB,kGAAA,OAAO,OAAA"}
|
||||
5
node_modules/openai/resources/beta/threads/index.mjs
generated
vendored
Normal file
5
node_modules/openai/resources/beta/threads/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
export { Messages, } from "./messages.mjs";
|
||||
export { Runs, } from "./runs/index.mjs";
|
||||
export { Threads, } from "./threads.mjs";
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
node_modules/openai/resources/beta/threads/index.mjs.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/resources/beta/threads/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,QAAQ,GAmCT;OACM,EACL,IAAI,GAoBL;OACM,EACL,OAAO,GAcR"}
|
||||
594
node_modules/openai/resources/beta/threads/messages.d.mts
generated
vendored
Normal file
594
node_modules/openai/resources/beta/threads/messages.d.mts
generated
vendored
Normal file
@@ -0,0 +1,594 @@
|
||||
import { APIResource } from "../../../core/resource.mjs";
|
||||
import * as Shared from "../../shared.mjs";
|
||||
import * as AssistantsAPI from "../assistants.mjs";
|
||||
import { APIPromise } from "../../../core/api-promise.mjs";
|
||||
import { CursorPage, type CursorPageParams, PagePromise } from "../../../core/pagination.mjs";
|
||||
import { RequestOptions } from "../../../internal/request-options.mjs";
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
export declare class Messages extends APIResource {
|
||||
/**
|
||||
* Create a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
create(threadID: string, body: MessageCreateParams, options?: RequestOptions): APIPromise<Message>;
|
||||
/**
|
||||
* Retrieve a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(messageID: string, params: MessageRetrieveParams, options?: RequestOptions): APIPromise<Message>;
|
||||
/**
|
||||
* Modifies a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
update(messageID: string, params: MessageUpdateParams, options?: RequestOptions): APIPromise<Message>;
|
||||
/**
|
||||
* Returns a list of messages for a given thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(threadID: string, query?: MessageListParams | null | undefined, options?: RequestOptions): PagePromise<MessagesPage, Message>;
|
||||
/**
|
||||
* Deletes a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
delete(messageID: string, params: MessageDeleteParams, options?: RequestOptions): APIPromise<MessageDeleted>;
|
||||
}
|
||||
export type MessagesPage = CursorPage<Message>;
|
||||
/**
|
||||
* A citation within the message that points to a specific quote from a specific
|
||||
* File associated with the assistant or the message. Generated when the assistant
|
||||
* uses the "file_search" tool to search files.
|
||||
*/
|
||||
export type Annotation = FileCitationAnnotation | FilePathAnnotation;
|
||||
/**
|
||||
* A citation within the message that points to a specific quote from a specific
|
||||
* File associated with the assistant or the message. Generated when the assistant
|
||||
* uses the "file_search" tool to search files.
|
||||
*/
|
||||
export type AnnotationDelta = FileCitationDeltaAnnotation | FilePathDeltaAnnotation;
|
||||
/**
|
||||
* A citation within the message that points to a specific quote from a specific
|
||||
* File associated with the assistant or the message. Generated when the assistant
|
||||
* uses the "file_search" tool to search files.
|
||||
*/
|
||||
export interface FileCitationAnnotation {
|
||||
end_index: number;
|
||||
file_citation: FileCitationAnnotation.FileCitation;
|
||||
start_index: number;
|
||||
/**
|
||||
* The text in the message content that needs to be replaced.
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* Always `file_citation`.
|
||||
*/
|
||||
type: 'file_citation';
|
||||
}
|
||||
export declare namespace FileCitationAnnotation {
|
||||
interface FileCitation {
|
||||
/**
|
||||
* The ID of the specific File the citation is from.
|
||||
*/
|
||||
file_id: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A citation within the message that points to a specific quote from a specific
|
||||
* File associated with the assistant or the message. Generated when the assistant
|
||||
* uses the "file_search" tool to search files.
|
||||
*/
|
||||
export interface FileCitationDeltaAnnotation {
|
||||
/**
|
||||
* The index of the annotation in the text content part.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `file_citation`.
|
||||
*/
|
||||
type: 'file_citation';
|
||||
end_index?: number;
|
||||
file_citation?: FileCitationDeltaAnnotation.FileCitation;
|
||||
start_index?: number;
|
||||
/**
|
||||
* The text in the message content that needs to be replaced.
|
||||
*/
|
||||
text?: string;
|
||||
}
|
||||
export declare namespace FileCitationDeltaAnnotation {
|
||||
interface FileCitation {
|
||||
/**
|
||||
* The ID of the specific File the citation is from.
|
||||
*/
|
||||
file_id?: string;
|
||||
/**
|
||||
* The specific quote in the file.
|
||||
*/
|
||||
quote?: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A URL for the file that's generated when the assistant used the
|
||||
* `code_interpreter` tool to generate a file.
|
||||
*/
|
||||
export interface FilePathAnnotation {
|
||||
end_index: number;
|
||||
file_path: FilePathAnnotation.FilePath;
|
||||
start_index: number;
|
||||
/**
|
||||
* The text in the message content that needs to be replaced.
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* Always `file_path`.
|
||||
*/
|
||||
type: 'file_path';
|
||||
}
|
||||
export declare namespace FilePathAnnotation {
|
||||
interface FilePath {
|
||||
/**
|
||||
* The ID of the file that was generated.
|
||||
*/
|
||||
file_id: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A URL for the file that's generated when the assistant used the
|
||||
* `code_interpreter` tool to generate a file.
|
||||
*/
|
||||
export interface FilePathDeltaAnnotation {
|
||||
/**
|
||||
* The index of the annotation in the text content part.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `file_path`.
|
||||
*/
|
||||
type: 'file_path';
|
||||
end_index?: number;
|
||||
file_path?: FilePathDeltaAnnotation.FilePath;
|
||||
start_index?: number;
|
||||
/**
|
||||
* The text in the message content that needs to be replaced.
|
||||
*/
|
||||
text?: string;
|
||||
}
|
||||
export declare namespace FilePathDeltaAnnotation {
|
||||
interface FilePath {
|
||||
/**
|
||||
* The ID of the file that was generated.
|
||||
*/
|
||||
file_id?: string;
|
||||
}
|
||||
}
|
||||
export interface ImageFile {
|
||||
/**
|
||||
* The [File](https://platform.openai.com/docs/api-reference/files) ID of the image
|
||||
* in the message content. Set `purpose="vision"` when uploading the File if you
|
||||
* need to later display the file content.
|
||||
*/
|
||||
file_id: string;
|
||||
/**
|
||||
* Specifies the detail level of the image if specified by the user. `low` uses
|
||||
* fewer tokens, you can opt in to high resolution using `high`.
|
||||
*/
|
||||
detail?: 'auto' | 'low' | 'high';
|
||||
}
|
||||
/**
|
||||
* References an image [File](https://platform.openai.com/docs/api-reference/files)
|
||||
* in the content of a message.
|
||||
*/
|
||||
export interface ImageFileContentBlock {
|
||||
image_file: ImageFile;
|
||||
/**
|
||||
* Always `image_file`.
|
||||
*/
|
||||
type: 'image_file';
|
||||
}
|
||||
export interface ImageFileDelta {
|
||||
/**
|
||||
* Specifies the detail level of the image if specified by the user. `low` uses
|
||||
* fewer tokens, you can opt in to high resolution using `high`.
|
||||
*/
|
||||
detail?: 'auto' | 'low' | 'high';
|
||||
/**
|
||||
* The [File](https://platform.openai.com/docs/api-reference/files) ID of the image
|
||||
* in the message content. Set `purpose="vision"` when uploading the File if you
|
||||
* need to later display the file content.
|
||||
*/
|
||||
file_id?: string;
|
||||
}
|
||||
/**
|
||||
* References an image [File](https://platform.openai.com/docs/api-reference/files)
|
||||
* in the content of a message.
|
||||
*/
|
||||
export interface ImageFileDeltaBlock {
|
||||
/**
|
||||
* The index of the content part in the message.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `image_file`.
|
||||
*/
|
||||
type: 'image_file';
|
||||
image_file?: ImageFileDelta;
|
||||
}
|
||||
export interface ImageURL {
|
||||
/**
|
||||
* The external URL of the image, must be a supported image types: jpeg, jpg, png,
|
||||
* gif, webp.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Specifies the detail level of the image. `low` uses fewer tokens, you can opt in
|
||||
* to high resolution using `high`. Default value is `auto`
|
||||
*/
|
||||
detail?: 'auto' | 'low' | 'high';
|
||||
}
|
||||
/**
|
||||
* References an image URL in the content of a message.
|
||||
*/
|
||||
export interface ImageURLContentBlock {
|
||||
image_url: ImageURL;
|
||||
/**
|
||||
* The type of the content part.
|
||||
*/
|
||||
type: 'image_url';
|
||||
}
|
||||
export interface ImageURLDelta {
|
||||
/**
|
||||
* Specifies the detail level of the image. `low` uses fewer tokens, you can opt in
|
||||
* to high resolution using `high`.
|
||||
*/
|
||||
detail?: 'auto' | 'low' | 'high';
|
||||
/**
|
||||
* The URL of the image, must be a supported image types: jpeg, jpg, png, gif,
|
||||
* webp.
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
/**
|
||||
* References an image URL in the content of a message.
|
||||
*/
|
||||
export interface ImageURLDeltaBlock {
|
||||
/**
|
||||
* The index of the content part in the message.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `image_url`.
|
||||
*/
|
||||
type: 'image_url';
|
||||
image_url?: ImageURLDelta;
|
||||
}
|
||||
/**
|
||||
* Represents a message within a
|
||||
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
||||
*/
|
||||
export interface Message {
|
||||
/**
|
||||
* The identifier, which can be referenced in API endpoints.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* If applicable, the ID of the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) that
|
||||
* authored this message.
|
||||
*/
|
||||
assistant_id: string | null;
|
||||
/**
|
||||
* A list of files attached to the message, and the tools they were added to.
|
||||
*/
|
||||
attachments: Array<Message.Attachment> | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the message was completed.
|
||||
*/
|
||||
completed_at: number | null;
|
||||
/**
|
||||
* The content of the message in array of text and/or images.
|
||||
*/
|
||||
content: Array<MessageContent>;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the message was created.
|
||||
*/
|
||||
created_at: number;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the message was marked as incomplete.
|
||||
*/
|
||||
incomplete_at: number | null;
|
||||
/**
|
||||
* On an incomplete message, details about why the message is incomplete.
|
||||
*/
|
||||
incomplete_details: Message.IncompleteDetails | null;
|
||||
/**
|
||||
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
||||
* for storing additional information about the object in a structured format, and
|
||||
* querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata: Shared.Metadata | null;
|
||||
/**
|
||||
* The object type, which is always `thread.message`.
|
||||
*/
|
||||
object: 'thread.message';
|
||||
/**
|
||||
* The entity that produced the message. One of `user` or `assistant`.
|
||||
*/
|
||||
role: 'user' | 'assistant';
|
||||
/**
|
||||
* The ID of the [run](https://platform.openai.com/docs/api-reference/runs)
|
||||
* associated with the creation of this message. Value is `null` when messages are
|
||||
* created manually using the create message or create thread endpoints.
|
||||
*/
|
||||
run_id: string | null;
|
||||
/**
|
||||
* The status of the message, which can be either `in_progress`, `incomplete`, or
|
||||
* `completed`.
|
||||
*/
|
||||
status: 'in_progress' | 'incomplete' | 'completed';
|
||||
/**
|
||||
* The [thread](https://platform.openai.com/docs/api-reference/threads) ID that
|
||||
* this message belongs to.
|
||||
*/
|
||||
thread_id: string;
|
||||
}
|
||||
export declare namespace Message {
|
||||
interface Attachment {
|
||||
/**
|
||||
* The ID of the file to attach to the message.
|
||||
*/
|
||||
file_id?: string;
|
||||
/**
|
||||
* The tools to add this file to.
|
||||
*/
|
||||
tools?: Array<AssistantsAPI.CodeInterpreterTool | Attachment.AssistantToolsFileSearchTypeOnly>;
|
||||
}
|
||||
namespace Attachment {
|
||||
interface AssistantToolsFileSearchTypeOnly {
|
||||
/**
|
||||
* The type of tool being defined: `file_search`
|
||||
*/
|
||||
type: 'file_search';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* On an incomplete message, details about why the message is incomplete.
|
||||
*/
|
||||
interface IncompleteDetails {
|
||||
/**
|
||||
* The reason the message is incomplete.
|
||||
*/
|
||||
reason: 'content_filter' | 'max_tokens' | 'run_cancelled' | 'run_expired' | 'run_failed';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* References an image [File](https://platform.openai.com/docs/api-reference/files)
|
||||
* in the content of a message.
|
||||
*/
|
||||
export type MessageContent = ImageFileContentBlock | ImageURLContentBlock | TextContentBlock | RefusalContentBlock;
|
||||
/**
|
||||
* References an image [File](https://platform.openai.com/docs/api-reference/files)
|
||||
* in the content of a message.
|
||||
*/
|
||||
export type MessageContentDelta = ImageFileDeltaBlock | TextDeltaBlock | RefusalDeltaBlock | ImageURLDeltaBlock;
|
||||
/**
|
||||
* References an image [File](https://platform.openai.com/docs/api-reference/files)
|
||||
* in the content of a message.
|
||||
*/
|
||||
export type MessageContentPartParam = ImageFileContentBlock | ImageURLContentBlock | TextContentBlockParam;
|
||||
export interface MessageDeleted {
|
||||
id: string;
|
||||
deleted: boolean;
|
||||
object: 'thread.message.deleted';
|
||||
}
|
||||
/**
|
||||
* The delta containing the fields that have changed on the Message.
|
||||
*/
|
||||
export interface MessageDelta {
|
||||
/**
|
||||
* The content of the message in array of text and/or images.
|
||||
*/
|
||||
content?: Array<MessageContentDelta>;
|
||||
/**
|
||||
* The entity that produced the message. One of `user` or `assistant`.
|
||||
*/
|
||||
role?: 'user' | 'assistant';
|
||||
}
|
||||
/**
|
||||
* Represents a message delta i.e. any changed fields on a message during
|
||||
* streaming.
|
||||
*/
|
||||
export interface MessageDeltaEvent {
|
||||
/**
|
||||
* The identifier of the message, which can be referenced in API endpoints.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The delta containing the fields that have changed on the Message.
|
||||
*/
|
||||
delta: MessageDelta;
|
||||
/**
|
||||
* The object type, which is always `thread.message.delta`.
|
||||
*/
|
||||
object: 'thread.message.delta';
|
||||
}
|
||||
/**
|
||||
* The refusal content generated by the assistant.
|
||||
*/
|
||||
export interface RefusalContentBlock {
|
||||
refusal: string;
|
||||
/**
|
||||
* Always `refusal`.
|
||||
*/
|
||||
type: 'refusal';
|
||||
}
|
||||
/**
|
||||
* The refusal content that is part of a message.
|
||||
*/
|
||||
export interface RefusalDeltaBlock {
|
||||
/**
|
||||
* The index of the refusal part in the message.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `refusal`.
|
||||
*/
|
||||
type: 'refusal';
|
||||
refusal?: string;
|
||||
}
|
||||
export interface Text {
|
||||
annotations: Array<Annotation>;
|
||||
/**
|
||||
* The data that makes up the text.
|
||||
*/
|
||||
value: string;
|
||||
}
|
||||
/**
|
||||
* The text content that is part of a message.
|
||||
*/
|
||||
export interface TextContentBlock {
|
||||
text: Text;
|
||||
/**
|
||||
* Always `text`.
|
||||
*/
|
||||
type: 'text';
|
||||
}
|
||||
/**
|
||||
* The text content that is part of a message.
|
||||
*/
|
||||
export interface TextContentBlockParam {
|
||||
/**
|
||||
* Text content to be sent to the model
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* Always `text`.
|
||||
*/
|
||||
type: 'text';
|
||||
}
|
||||
export interface TextDelta {
|
||||
annotations?: Array<AnnotationDelta>;
|
||||
/**
|
||||
* The data that makes up the text.
|
||||
*/
|
||||
value?: string;
|
||||
}
|
||||
/**
|
||||
* The text content that is part of a message.
|
||||
*/
|
||||
export interface TextDeltaBlock {
|
||||
/**
|
||||
* The index of the content part in the message.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `text`.
|
||||
*/
|
||||
type: 'text';
|
||||
text?: TextDelta;
|
||||
}
|
||||
export interface MessageCreateParams {
|
||||
/**
|
||||
* The text contents of the message.
|
||||
*/
|
||||
content: string | Array<MessageContentPartParam>;
|
||||
/**
|
||||
* The role of the entity that is creating the message. Allowed values include:
|
||||
*
|
||||
* - `user`: Indicates the message is sent by an actual user and should be used in
|
||||
* most cases to represent user-generated messages.
|
||||
* - `assistant`: Indicates the message is generated by the assistant. Use this
|
||||
* value to insert messages from the assistant into the conversation.
|
||||
*/
|
||||
role: 'user' | 'assistant';
|
||||
/**
|
||||
* A list of files attached to the message, and the tools they should be added to.
|
||||
*/
|
||||
attachments?: Array<MessageCreateParams.Attachment> | null;
|
||||
/**
|
||||
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
||||
* for storing additional information about the object in a structured format, and
|
||||
* querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata?: Shared.Metadata | null;
|
||||
}
|
||||
export declare namespace MessageCreateParams {
|
||||
interface Attachment {
|
||||
/**
|
||||
* The ID of the file to attach to the message.
|
||||
*/
|
||||
file_id?: string;
|
||||
/**
|
||||
* The tools to add this file to.
|
||||
*/
|
||||
tools?: Array<AssistantsAPI.CodeInterpreterTool | Attachment.FileSearch>;
|
||||
}
|
||||
namespace Attachment {
|
||||
interface FileSearch {
|
||||
/**
|
||||
* The type of tool being defined: `file_search`
|
||||
*/
|
||||
type: 'file_search';
|
||||
}
|
||||
}
|
||||
}
|
||||
export interface MessageRetrieveParams {
|
||||
/**
|
||||
* The ID of the [thread](https://platform.openai.com/docs/api-reference/threads)
|
||||
* to which this message belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
}
|
||||
export interface MessageUpdateParams {
|
||||
/**
|
||||
* Path param: The ID of the thread to which this message belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Body param: Set of 16 key-value pairs that can be attached to an object. This
|
||||
* can be useful for storing additional information about the object in a
|
||||
* structured format, and querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata?: Shared.Metadata | null;
|
||||
}
|
||||
export interface MessageListParams extends CursorPageParams {
|
||||
/**
|
||||
* A cursor for use in pagination. `before` is an object ID that defines your place
|
||||
* in the list. For instance, if you make a list request and receive 100 objects,
|
||||
* starting with obj_foo, your subsequent call can include before=obj_foo in order
|
||||
* to fetch the previous page of the list.
|
||||
*/
|
||||
before?: string;
|
||||
/**
|
||||
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending
|
||||
* order and `desc` for descending order.
|
||||
*/
|
||||
order?: 'asc' | 'desc';
|
||||
/**
|
||||
* Filter messages by the run ID that generated them.
|
||||
*/
|
||||
run_id?: string;
|
||||
}
|
||||
export interface MessageDeleteParams {
|
||||
/**
|
||||
* The ID of the thread to which this message belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
}
|
||||
export declare namespace Messages {
|
||||
export { type Annotation as Annotation, type AnnotationDelta as AnnotationDelta, type FileCitationAnnotation as FileCitationAnnotation, type FileCitationDeltaAnnotation as FileCitationDeltaAnnotation, type FilePathAnnotation as FilePathAnnotation, type FilePathDeltaAnnotation as FilePathDeltaAnnotation, type ImageFile as ImageFile, type ImageFileContentBlock as ImageFileContentBlock, type ImageFileDelta as ImageFileDelta, type ImageFileDeltaBlock as ImageFileDeltaBlock, type ImageURL as ImageURL, type ImageURLContentBlock as ImageURLContentBlock, type ImageURLDelta as ImageURLDelta, type ImageURLDeltaBlock as ImageURLDeltaBlock, type Message as Message, type MessageContent as MessageContent, type MessageContentDelta as MessageContentDelta, type MessageContentPartParam as MessageContentPartParam, type MessageDeleted as MessageDeleted, type MessageDelta as MessageDelta, type MessageDeltaEvent as MessageDeltaEvent, type RefusalContentBlock as RefusalContentBlock, type RefusalDeltaBlock as RefusalDeltaBlock, type Text as Text, type TextContentBlock as TextContentBlock, type TextContentBlockParam as TextContentBlockParam, type TextDelta as TextDelta, type TextDeltaBlock as TextDeltaBlock, type MessagesPage as MessagesPage, type MessageCreateParams as MessageCreateParams, type MessageRetrieveParams as MessageRetrieveParams, type MessageUpdateParams as MessageUpdateParams, type MessageListParams as MessageListParams, type MessageDeleteParams as MessageDeleteParams, };
|
||||
}
|
||||
//# sourceMappingURL=messages.d.mts.map
|
||||
1
node_modules/openai/resources/beta/threads/messages.d.mts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/messages.d.mts.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
594
node_modules/openai/resources/beta/threads/messages.d.ts
generated
vendored
Normal file
594
node_modules/openai/resources/beta/threads/messages.d.ts
generated
vendored
Normal file
@@ -0,0 +1,594 @@
|
||||
import { APIResource } from "../../../core/resource.js";
|
||||
import * as Shared from "../../shared.js";
|
||||
import * as AssistantsAPI from "../assistants.js";
|
||||
import { APIPromise } from "../../../core/api-promise.js";
|
||||
import { CursorPage, type CursorPageParams, PagePromise } from "../../../core/pagination.js";
|
||||
import { RequestOptions } from "../../../internal/request-options.js";
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
export declare class Messages extends APIResource {
|
||||
/**
|
||||
* Create a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
create(threadID: string, body: MessageCreateParams, options?: RequestOptions): APIPromise<Message>;
|
||||
/**
|
||||
* Retrieve a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(messageID: string, params: MessageRetrieveParams, options?: RequestOptions): APIPromise<Message>;
|
||||
/**
|
||||
* Modifies a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
update(messageID: string, params: MessageUpdateParams, options?: RequestOptions): APIPromise<Message>;
|
||||
/**
|
||||
* Returns a list of messages for a given thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(threadID: string, query?: MessageListParams | null | undefined, options?: RequestOptions): PagePromise<MessagesPage, Message>;
|
||||
/**
|
||||
* Deletes a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
delete(messageID: string, params: MessageDeleteParams, options?: RequestOptions): APIPromise<MessageDeleted>;
|
||||
}
|
||||
export type MessagesPage = CursorPage<Message>;
|
||||
/**
|
||||
* A citation within the message that points to a specific quote from a specific
|
||||
* File associated with the assistant or the message. Generated when the assistant
|
||||
* uses the "file_search" tool to search files.
|
||||
*/
|
||||
export type Annotation = FileCitationAnnotation | FilePathAnnotation;
|
||||
/**
|
||||
* A citation within the message that points to a specific quote from a specific
|
||||
* File associated with the assistant or the message. Generated when the assistant
|
||||
* uses the "file_search" tool to search files.
|
||||
*/
|
||||
export type AnnotationDelta = FileCitationDeltaAnnotation | FilePathDeltaAnnotation;
|
||||
/**
|
||||
* A citation within the message that points to a specific quote from a specific
|
||||
* File associated with the assistant or the message. Generated when the assistant
|
||||
* uses the "file_search" tool to search files.
|
||||
*/
|
||||
export interface FileCitationAnnotation {
|
||||
end_index: number;
|
||||
file_citation: FileCitationAnnotation.FileCitation;
|
||||
start_index: number;
|
||||
/**
|
||||
* The text in the message content that needs to be replaced.
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* Always `file_citation`.
|
||||
*/
|
||||
type: 'file_citation';
|
||||
}
|
||||
export declare namespace FileCitationAnnotation {
|
||||
interface FileCitation {
|
||||
/**
|
||||
* The ID of the specific File the citation is from.
|
||||
*/
|
||||
file_id: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A citation within the message that points to a specific quote from a specific
|
||||
* File associated with the assistant or the message. Generated when the assistant
|
||||
* uses the "file_search" tool to search files.
|
||||
*/
|
||||
export interface FileCitationDeltaAnnotation {
|
||||
/**
|
||||
* The index of the annotation in the text content part.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `file_citation`.
|
||||
*/
|
||||
type: 'file_citation';
|
||||
end_index?: number;
|
||||
file_citation?: FileCitationDeltaAnnotation.FileCitation;
|
||||
start_index?: number;
|
||||
/**
|
||||
* The text in the message content that needs to be replaced.
|
||||
*/
|
||||
text?: string;
|
||||
}
|
||||
export declare namespace FileCitationDeltaAnnotation {
|
||||
interface FileCitation {
|
||||
/**
|
||||
* The ID of the specific File the citation is from.
|
||||
*/
|
||||
file_id?: string;
|
||||
/**
|
||||
* The specific quote in the file.
|
||||
*/
|
||||
quote?: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A URL for the file that's generated when the assistant used the
|
||||
* `code_interpreter` tool to generate a file.
|
||||
*/
|
||||
export interface FilePathAnnotation {
|
||||
end_index: number;
|
||||
file_path: FilePathAnnotation.FilePath;
|
||||
start_index: number;
|
||||
/**
|
||||
* The text in the message content that needs to be replaced.
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* Always `file_path`.
|
||||
*/
|
||||
type: 'file_path';
|
||||
}
|
||||
export declare namespace FilePathAnnotation {
|
||||
interface FilePath {
|
||||
/**
|
||||
* The ID of the file that was generated.
|
||||
*/
|
||||
file_id: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A URL for the file that's generated when the assistant used the
|
||||
* `code_interpreter` tool to generate a file.
|
||||
*/
|
||||
export interface FilePathDeltaAnnotation {
|
||||
/**
|
||||
* The index of the annotation in the text content part.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `file_path`.
|
||||
*/
|
||||
type: 'file_path';
|
||||
end_index?: number;
|
||||
file_path?: FilePathDeltaAnnotation.FilePath;
|
||||
start_index?: number;
|
||||
/**
|
||||
* The text in the message content that needs to be replaced.
|
||||
*/
|
||||
text?: string;
|
||||
}
|
||||
export declare namespace FilePathDeltaAnnotation {
|
||||
interface FilePath {
|
||||
/**
|
||||
* The ID of the file that was generated.
|
||||
*/
|
||||
file_id?: string;
|
||||
}
|
||||
}
|
||||
export interface ImageFile {
|
||||
/**
|
||||
* The [File](https://platform.openai.com/docs/api-reference/files) ID of the image
|
||||
* in the message content. Set `purpose="vision"` when uploading the File if you
|
||||
* need to later display the file content.
|
||||
*/
|
||||
file_id: string;
|
||||
/**
|
||||
* Specifies the detail level of the image if specified by the user. `low` uses
|
||||
* fewer tokens, you can opt in to high resolution using `high`.
|
||||
*/
|
||||
detail?: 'auto' | 'low' | 'high';
|
||||
}
|
||||
/**
|
||||
* References an image [File](https://platform.openai.com/docs/api-reference/files)
|
||||
* in the content of a message.
|
||||
*/
|
||||
export interface ImageFileContentBlock {
|
||||
image_file: ImageFile;
|
||||
/**
|
||||
* Always `image_file`.
|
||||
*/
|
||||
type: 'image_file';
|
||||
}
|
||||
export interface ImageFileDelta {
|
||||
/**
|
||||
* Specifies the detail level of the image if specified by the user. `low` uses
|
||||
* fewer tokens, you can opt in to high resolution using `high`.
|
||||
*/
|
||||
detail?: 'auto' | 'low' | 'high';
|
||||
/**
|
||||
* The [File](https://platform.openai.com/docs/api-reference/files) ID of the image
|
||||
* in the message content. Set `purpose="vision"` when uploading the File if you
|
||||
* need to later display the file content.
|
||||
*/
|
||||
file_id?: string;
|
||||
}
|
||||
/**
|
||||
* References an image [File](https://platform.openai.com/docs/api-reference/files)
|
||||
* in the content of a message.
|
||||
*/
|
||||
export interface ImageFileDeltaBlock {
|
||||
/**
|
||||
* The index of the content part in the message.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `image_file`.
|
||||
*/
|
||||
type: 'image_file';
|
||||
image_file?: ImageFileDelta;
|
||||
}
|
||||
export interface ImageURL {
|
||||
/**
|
||||
* The external URL of the image, must be a supported image types: jpeg, jpg, png,
|
||||
* gif, webp.
|
||||
*/
|
||||
url: string;
|
||||
/**
|
||||
* Specifies the detail level of the image. `low` uses fewer tokens, you can opt in
|
||||
* to high resolution using `high`. Default value is `auto`
|
||||
*/
|
||||
detail?: 'auto' | 'low' | 'high';
|
||||
}
|
||||
/**
|
||||
* References an image URL in the content of a message.
|
||||
*/
|
||||
export interface ImageURLContentBlock {
|
||||
image_url: ImageURL;
|
||||
/**
|
||||
* The type of the content part.
|
||||
*/
|
||||
type: 'image_url';
|
||||
}
|
||||
export interface ImageURLDelta {
|
||||
/**
|
||||
* Specifies the detail level of the image. `low` uses fewer tokens, you can opt in
|
||||
* to high resolution using `high`.
|
||||
*/
|
||||
detail?: 'auto' | 'low' | 'high';
|
||||
/**
|
||||
* The URL of the image, must be a supported image types: jpeg, jpg, png, gif,
|
||||
* webp.
|
||||
*/
|
||||
url?: string;
|
||||
}
|
||||
/**
|
||||
* References an image URL in the content of a message.
|
||||
*/
|
||||
export interface ImageURLDeltaBlock {
|
||||
/**
|
||||
* The index of the content part in the message.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `image_url`.
|
||||
*/
|
||||
type: 'image_url';
|
||||
image_url?: ImageURLDelta;
|
||||
}
|
||||
/**
|
||||
* Represents a message within a
|
||||
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
||||
*/
|
||||
export interface Message {
|
||||
/**
|
||||
* The identifier, which can be referenced in API endpoints.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* If applicable, the ID of the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) that
|
||||
* authored this message.
|
||||
*/
|
||||
assistant_id: string | null;
|
||||
/**
|
||||
* A list of files attached to the message, and the tools they were added to.
|
||||
*/
|
||||
attachments: Array<Message.Attachment> | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the message was completed.
|
||||
*/
|
||||
completed_at: number | null;
|
||||
/**
|
||||
* The content of the message in array of text and/or images.
|
||||
*/
|
||||
content: Array<MessageContent>;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the message was created.
|
||||
*/
|
||||
created_at: number;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the message was marked as incomplete.
|
||||
*/
|
||||
incomplete_at: number | null;
|
||||
/**
|
||||
* On an incomplete message, details about why the message is incomplete.
|
||||
*/
|
||||
incomplete_details: Message.IncompleteDetails | null;
|
||||
/**
|
||||
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
||||
* for storing additional information about the object in a structured format, and
|
||||
* querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata: Shared.Metadata | null;
|
||||
/**
|
||||
* The object type, which is always `thread.message`.
|
||||
*/
|
||||
object: 'thread.message';
|
||||
/**
|
||||
* The entity that produced the message. One of `user` or `assistant`.
|
||||
*/
|
||||
role: 'user' | 'assistant';
|
||||
/**
|
||||
* The ID of the [run](https://platform.openai.com/docs/api-reference/runs)
|
||||
* associated with the creation of this message. Value is `null` when messages are
|
||||
* created manually using the create message or create thread endpoints.
|
||||
*/
|
||||
run_id: string | null;
|
||||
/**
|
||||
* The status of the message, which can be either `in_progress`, `incomplete`, or
|
||||
* `completed`.
|
||||
*/
|
||||
status: 'in_progress' | 'incomplete' | 'completed';
|
||||
/**
|
||||
* The [thread](https://platform.openai.com/docs/api-reference/threads) ID that
|
||||
* this message belongs to.
|
||||
*/
|
||||
thread_id: string;
|
||||
}
|
||||
export declare namespace Message {
|
||||
interface Attachment {
|
||||
/**
|
||||
* The ID of the file to attach to the message.
|
||||
*/
|
||||
file_id?: string;
|
||||
/**
|
||||
* The tools to add this file to.
|
||||
*/
|
||||
tools?: Array<AssistantsAPI.CodeInterpreterTool | Attachment.AssistantToolsFileSearchTypeOnly>;
|
||||
}
|
||||
namespace Attachment {
|
||||
interface AssistantToolsFileSearchTypeOnly {
|
||||
/**
|
||||
* The type of tool being defined: `file_search`
|
||||
*/
|
||||
type: 'file_search';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* On an incomplete message, details about why the message is incomplete.
|
||||
*/
|
||||
interface IncompleteDetails {
|
||||
/**
|
||||
* The reason the message is incomplete.
|
||||
*/
|
||||
reason: 'content_filter' | 'max_tokens' | 'run_cancelled' | 'run_expired' | 'run_failed';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* References an image [File](https://platform.openai.com/docs/api-reference/files)
|
||||
* in the content of a message.
|
||||
*/
|
||||
export type MessageContent = ImageFileContentBlock | ImageURLContentBlock | TextContentBlock | RefusalContentBlock;
|
||||
/**
|
||||
* References an image [File](https://platform.openai.com/docs/api-reference/files)
|
||||
* in the content of a message.
|
||||
*/
|
||||
export type MessageContentDelta = ImageFileDeltaBlock | TextDeltaBlock | RefusalDeltaBlock | ImageURLDeltaBlock;
|
||||
/**
|
||||
* References an image [File](https://platform.openai.com/docs/api-reference/files)
|
||||
* in the content of a message.
|
||||
*/
|
||||
export type MessageContentPartParam = ImageFileContentBlock | ImageURLContentBlock | TextContentBlockParam;
|
||||
export interface MessageDeleted {
|
||||
id: string;
|
||||
deleted: boolean;
|
||||
object: 'thread.message.deleted';
|
||||
}
|
||||
/**
|
||||
* The delta containing the fields that have changed on the Message.
|
||||
*/
|
||||
export interface MessageDelta {
|
||||
/**
|
||||
* The content of the message in array of text and/or images.
|
||||
*/
|
||||
content?: Array<MessageContentDelta>;
|
||||
/**
|
||||
* The entity that produced the message. One of `user` or `assistant`.
|
||||
*/
|
||||
role?: 'user' | 'assistant';
|
||||
}
|
||||
/**
|
||||
* Represents a message delta i.e. any changed fields on a message during
|
||||
* streaming.
|
||||
*/
|
||||
export interface MessageDeltaEvent {
|
||||
/**
|
||||
* The identifier of the message, which can be referenced in API endpoints.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The delta containing the fields that have changed on the Message.
|
||||
*/
|
||||
delta: MessageDelta;
|
||||
/**
|
||||
* The object type, which is always `thread.message.delta`.
|
||||
*/
|
||||
object: 'thread.message.delta';
|
||||
}
|
||||
/**
|
||||
* The refusal content generated by the assistant.
|
||||
*/
|
||||
export interface RefusalContentBlock {
|
||||
refusal: string;
|
||||
/**
|
||||
* Always `refusal`.
|
||||
*/
|
||||
type: 'refusal';
|
||||
}
|
||||
/**
|
||||
* The refusal content that is part of a message.
|
||||
*/
|
||||
export interface RefusalDeltaBlock {
|
||||
/**
|
||||
* The index of the refusal part in the message.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `refusal`.
|
||||
*/
|
||||
type: 'refusal';
|
||||
refusal?: string;
|
||||
}
|
||||
export interface Text {
|
||||
annotations: Array<Annotation>;
|
||||
/**
|
||||
* The data that makes up the text.
|
||||
*/
|
||||
value: string;
|
||||
}
|
||||
/**
|
||||
* The text content that is part of a message.
|
||||
*/
|
||||
export interface TextContentBlock {
|
||||
text: Text;
|
||||
/**
|
||||
* Always `text`.
|
||||
*/
|
||||
type: 'text';
|
||||
}
|
||||
/**
|
||||
* The text content that is part of a message.
|
||||
*/
|
||||
export interface TextContentBlockParam {
|
||||
/**
|
||||
* Text content to be sent to the model
|
||||
*/
|
||||
text: string;
|
||||
/**
|
||||
* Always `text`.
|
||||
*/
|
||||
type: 'text';
|
||||
}
|
||||
export interface TextDelta {
|
||||
annotations?: Array<AnnotationDelta>;
|
||||
/**
|
||||
* The data that makes up the text.
|
||||
*/
|
||||
value?: string;
|
||||
}
|
||||
/**
|
||||
* The text content that is part of a message.
|
||||
*/
|
||||
export interface TextDeltaBlock {
|
||||
/**
|
||||
* The index of the content part in the message.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `text`.
|
||||
*/
|
||||
type: 'text';
|
||||
text?: TextDelta;
|
||||
}
|
||||
export interface MessageCreateParams {
|
||||
/**
|
||||
* The text contents of the message.
|
||||
*/
|
||||
content: string | Array<MessageContentPartParam>;
|
||||
/**
|
||||
* The role of the entity that is creating the message. Allowed values include:
|
||||
*
|
||||
* - `user`: Indicates the message is sent by an actual user and should be used in
|
||||
* most cases to represent user-generated messages.
|
||||
* - `assistant`: Indicates the message is generated by the assistant. Use this
|
||||
* value to insert messages from the assistant into the conversation.
|
||||
*/
|
||||
role: 'user' | 'assistant';
|
||||
/**
|
||||
* A list of files attached to the message, and the tools they should be added to.
|
||||
*/
|
||||
attachments?: Array<MessageCreateParams.Attachment> | null;
|
||||
/**
|
||||
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
||||
* for storing additional information about the object in a structured format, and
|
||||
* querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata?: Shared.Metadata | null;
|
||||
}
|
||||
export declare namespace MessageCreateParams {
|
||||
interface Attachment {
|
||||
/**
|
||||
* The ID of the file to attach to the message.
|
||||
*/
|
||||
file_id?: string;
|
||||
/**
|
||||
* The tools to add this file to.
|
||||
*/
|
||||
tools?: Array<AssistantsAPI.CodeInterpreterTool | Attachment.FileSearch>;
|
||||
}
|
||||
namespace Attachment {
|
||||
interface FileSearch {
|
||||
/**
|
||||
* The type of tool being defined: `file_search`
|
||||
*/
|
||||
type: 'file_search';
|
||||
}
|
||||
}
|
||||
}
|
||||
export interface MessageRetrieveParams {
|
||||
/**
|
||||
* The ID of the [thread](https://platform.openai.com/docs/api-reference/threads)
|
||||
* to which this message belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
}
|
||||
export interface MessageUpdateParams {
|
||||
/**
|
||||
* Path param: The ID of the thread to which this message belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Body param: Set of 16 key-value pairs that can be attached to an object. This
|
||||
* can be useful for storing additional information about the object in a
|
||||
* structured format, and querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata?: Shared.Metadata | null;
|
||||
}
|
||||
export interface MessageListParams extends CursorPageParams {
|
||||
/**
|
||||
* A cursor for use in pagination. `before` is an object ID that defines your place
|
||||
* in the list. For instance, if you make a list request and receive 100 objects,
|
||||
* starting with obj_foo, your subsequent call can include before=obj_foo in order
|
||||
* to fetch the previous page of the list.
|
||||
*/
|
||||
before?: string;
|
||||
/**
|
||||
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending
|
||||
* order and `desc` for descending order.
|
||||
*/
|
||||
order?: 'asc' | 'desc';
|
||||
/**
|
||||
* Filter messages by the run ID that generated them.
|
||||
*/
|
||||
run_id?: string;
|
||||
}
|
||||
export interface MessageDeleteParams {
|
||||
/**
|
||||
* The ID of the thread to which this message belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
}
|
||||
export declare namespace Messages {
|
||||
export { type Annotation as Annotation, type AnnotationDelta as AnnotationDelta, type FileCitationAnnotation as FileCitationAnnotation, type FileCitationDeltaAnnotation as FileCitationDeltaAnnotation, type FilePathAnnotation as FilePathAnnotation, type FilePathDeltaAnnotation as FilePathDeltaAnnotation, type ImageFile as ImageFile, type ImageFileContentBlock as ImageFileContentBlock, type ImageFileDelta as ImageFileDelta, type ImageFileDeltaBlock as ImageFileDeltaBlock, type ImageURL as ImageURL, type ImageURLContentBlock as ImageURLContentBlock, type ImageURLDelta as ImageURLDelta, type ImageURLDeltaBlock as ImageURLDeltaBlock, type Message as Message, type MessageContent as MessageContent, type MessageContentDelta as MessageContentDelta, type MessageContentPartParam as MessageContentPartParam, type MessageDeleted as MessageDeleted, type MessageDelta as MessageDelta, type MessageDeltaEvent as MessageDeltaEvent, type RefusalContentBlock as RefusalContentBlock, type RefusalDeltaBlock as RefusalDeltaBlock, type Text as Text, type TextContentBlock as TextContentBlock, type TextContentBlockParam as TextContentBlockParam, type TextDelta as TextDelta, type TextDeltaBlock as TextDeltaBlock, type MessagesPage as MessagesPage, type MessageCreateParams as MessageCreateParams, type MessageRetrieveParams as MessageRetrieveParams, type MessageUpdateParams as MessageUpdateParams, type MessageListParams as MessageListParams, type MessageDeleteParams as MessageDeleteParams, };
|
||||
}
|
||||
//# sourceMappingURL=messages.d.ts.map
|
||||
1
node_modules/openai/resources/beta/threads/messages.d.ts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/messages.d.ts.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
76
node_modules/openai/resources/beta/threads/messages.js
generated
vendored
Normal file
76
node_modules/openai/resources/beta/threads/messages.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Messages = void 0;
|
||||
const resource_1 = require("../../../core/resource.js");
|
||||
const pagination_1 = require("../../../core/pagination.js");
|
||||
const headers_1 = require("../../../internal/headers.js");
|
||||
const path_1 = require("../../../internal/utils/path.js");
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
class Messages extends resource_1.APIResource {
|
||||
/**
|
||||
* Create a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
create(threadID, body, options) {
|
||||
return this._client.post((0, path_1.path) `/threads/${threadID}/messages`, {
|
||||
body,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Retrieve a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(messageID, params, options) {
|
||||
const { thread_id } = params;
|
||||
return this._client.get((0, path_1.path) `/threads/${thread_id}/messages/${messageID}`, {
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Modifies a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
update(messageID, params, options) {
|
||||
const { thread_id, ...body } = params;
|
||||
return this._client.post((0, path_1.path) `/threads/${thread_id}/messages/${messageID}`, {
|
||||
body,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of messages for a given thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(threadID, query = {}, options) {
|
||||
return this._client.getAPIList((0, path_1.path) `/threads/${threadID}/messages`, (pagination_1.CursorPage), {
|
||||
query,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Deletes a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
delete(messageID, params, options) {
|
||||
const { thread_id } = params;
|
||||
return this._client.delete((0, path_1.path) `/threads/${thread_id}/messages/${messageID}`, {
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Messages = Messages;
|
||||
//# sourceMappingURL=messages.js.map
|
||||
1
node_modules/openai/resources/beta/threads/messages.js.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/messages.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/resources/beta/threads/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAIrD,4DAA0F;AAC1F,0DAAyD;AAEzD,0DAAoD;AAEpD;;GAEG;AACH,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;OAIG;IACH,MAAM,CAAC,QAAgB,EAAE,IAAyB,EAAE,OAAwB;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WA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AC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,MAAM,CACJ,SAAiB,EACjB,MAA2B,EAC3B,OAAwB;QAExB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,YAAY,SAAS,aAAa,SAAS,EAAE,EAAE;YAC5E,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;CACF;AA1ED,4BA0EC"}
|
||||
72
node_modules/openai/resources/beta/threads/messages.mjs
generated
vendored
Normal file
72
node_modules/openai/resources/beta/threads/messages.mjs
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
import { APIResource } from "../../../core/resource.mjs";
|
||||
import { CursorPage } from "../../../core/pagination.mjs";
|
||||
import { buildHeaders } from "../../../internal/headers.mjs";
|
||||
import { path } from "../../../internal/utils/path.mjs";
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
export class Messages extends APIResource {
|
||||
/**
|
||||
* Create a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
create(threadID, body, options) {
|
||||
return this._client.post(path `/threads/${threadID}/messages`, {
|
||||
body,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Retrieve a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(messageID, params, options) {
|
||||
const { thread_id } = params;
|
||||
return this._client.get(path `/threads/${thread_id}/messages/${messageID}`, {
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Modifies a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
update(messageID, params, options) {
|
||||
const { thread_id, ...body } = params;
|
||||
return this._client.post(path `/threads/${thread_id}/messages/${messageID}`, {
|
||||
body,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of messages for a given thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(threadID, query = {}, options) {
|
||||
return this._client.getAPIList(path `/threads/${threadID}/messages`, (CursorPage), {
|
||||
query,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Deletes a message.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
delete(messageID, params, options) {
|
||||
const { thread_id } = params;
|
||||
return this._client.delete(path `/threads/${thread_id}/messages/${messageID}`, {
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=messages.mjs.map
|
||||
1
node_modules/openai/resources/beta/threads/messages.mjs.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/messages.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../../../src/resources/beta/threads/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,UAAU,EAAsC;OACl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QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAA,YAAY,QAAQ,WAAW,EAAE,CAAA,UAAmB,CAAA,EAAE;YACvF,KAAK;YACL,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,MAAM,CACJ,SAAiB,EACjB,MAA2B,EAC3B,OAAwB;QAExB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,YAAY,SAAS,aAAa,SAAS,EAAE,EAAE;YAC5E,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;CACF"}
|
||||
2
node_modules/openai/resources/beta/threads/runs.d.mts
generated
vendored
Normal file
2
node_modules/openai/resources/beta/threads/runs.d.mts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./runs/index.mjs";
|
||||
//# sourceMappingURL=runs.d.mts.map
|
||||
1
node_modules/openai/resources/beta/threads/runs.d.mts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs.d.mts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"runs.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/threads/runs.ts"],"names":[],"mappings":""}
|
||||
2
node_modules/openai/resources/beta/threads/runs.d.ts
generated
vendored
Normal file
2
node_modules/openai/resources/beta/threads/runs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./runs/index.js";
|
||||
//# sourceMappingURL=runs.d.ts.map
|
||||
1
node_modules/openai/resources/beta/threads/runs.d.ts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/threads/runs.ts"],"names":[],"mappings":""}
|
||||
6
node_modules/openai/resources/beta/threads/runs.js
generated
vendored
Normal file
6
node_modules/openai/resources/beta/threads/runs.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("../../../internal/tslib.js");
|
||||
tslib_1.__exportStar(require("./runs/index.js"), exports);
|
||||
//# sourceMappingURL=runs.js.map
|
||||
1
node_modules/openai/resources/beta/threads/runs.js.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"runs.js","sourceRoot":"","sources":["../../../src/resources/beta/threads/runs.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0DAA6B"}
|
||||
3
node_modules/openai/resources/beta/threads/runs.mjs
generated
vendored
Normal file
3
node_modules/openai/resources/beta/threads/runs.mjs
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
export * from "./runs/index.mjs";
|
||||
//# sourceMappingURL=runs.mjs.map
|
||||
1
node_modules/openai/resources/beta/threads/runs.mjs.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"runs.mjs","sourceRoot":"","sources":["../../../src/resources/beta/threads/runs.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
||||
3
node_modules/openai/resources/beta/threads/runs/index.d.mts
generated
vendored
Normal file
3
node_modules/openai/resources/beta/threads/runs/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { Runs, type RequiredActionFunctionToolCall, type Run, type RunStatus, type RunCreateParams, type RunCreateParamsNonStreaming, type RunCreateParamsStreaming, type RunRetrieveParams, type RunUpdateParams, type RunListParams, type RunCancelParams, type RunSubmitToolOutputsParams, type RunSubmitToolOutputsParamsNonStreaming, type RunSubmitToolOutputsParamsStreaming, type RunsPage, type RunCreateAndPollParams, type RunCreateAndStreamParams, type RunStreamParams, type RunSubmitToolOutputsAndPollParams, type RunSubmitToolOutputsStreamParams, } from "./runs.mjs";
|
||||
export { Steps, type CodeInterpreterLogs, type CodeInterpreterOutputImage, type CodeInterpreterToolCall, type CodeInterpreterToolCallDelta, type FileSearchToolCall, type FileSearchToolCallDelta, type FunctionToolCall, type FunctionToolCallDelta, type MessageCreationStepDetails, type RunStep, type RunStepInclude, type RunStepDelta, type RunStepDeltaEvent, type RunStepDeltaMessageDelta, type ToolCall, type ToolCallDelta, type ToolCallDeltaObject, type ToolCallsStepDetails, type StepRetrieveParams, type StepListParams, type RunStepsPage, } from "./steps.mjs";
|
||||
//# sourceMappingURL=index.d.mts.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/index.d.mts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/index.d.mts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/resources/beta/threads/runs/index.ts"],"names":[],"mappings":"OAEO,EACL,IAAI,EACJ,KAAK,8BAA8B,EACnC,KAAK,GAAG,EACR,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,sCAAsC,EAC3C,KAAK,mCAAmC,EACxC,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,iCAAiC,EACtC,KAAK,gCAAgC,GACtC;OACM,EACL,KAAK,EACL,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,GAClB"}
|
||||
3
node_modules/openai/resources/beta/threads/runs/index.d.ts
generated
vendored
Normal file
3
node_modules/openai/resources/beta/threads/runs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { Runs, type RequiredActionFunctionToolCall, type Run, type RunStatus, type RunCreateParams, type RunCreateParamsNonStreaming, type RunCreateParamsStreaming, type RunRetrieveParams, type RunUpdateParams, type RunListParams, type RunCancelParams, type RunSubmitToolOutputsParams, type RunSubmitToolOutputsParamsNonStreaming, type RunSubmitToolOutputsParamsStreaming, type RunsPage, type RunCreateAndPollParams, type RunCreateAndStreamParams, type RunStreamParams, type RunSubmitToolOutputsAndPollParams, type RunSubmitToolOutputsStreamParams, } from "./runs.js";
|
||||
export { Steps, type CodeInterpreterLogs, type CodeInterpreterOutputImage, type CodeInterpreterToolCall, type CodeInterpreterToolCallDelta, type FileSearchToolCall, type FileSearchToolCallDelta, type FunctionToolCall, type FunctionToolCallDelta, type MessageCreationStepDetails, type RunStep, type RunStepInclude, type RunStepDelta, type RunStepDeltaEvent, type RunStepDeltaMessageDelta, type ToolCall, type ToolCallDelta, type ToolCallDeltaObject, type ToolCallsStepDetails, type StepRetrieveParams, type StepListParams, type RunStepsPage, } from "./steps.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/index.d.ts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/resources/beta/threads/runs/index.ts"],"names":[],"mappings":"OAEO,EACL,IAAI,EACJ,KAAK,8BAA8B,EACnC,KAAK,GAAG,EACR,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,sCAAsC,EAC3C,KAAK,mCAAmC,EACxC,KAAK,QAAQ,EACb,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,iCAAiC,EACtC,KAAK,gCAAgC,GACtC;OACM,EACL,KAAK,EACL,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,GAClB"}
|
||||
9
node_modules/openai/resources/beta/threads/runs/index.js
generated
vendored
Normal file
9
node_modules/openai/resources/beta/threads/runs/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Steps = exports.Runs = void 0;
|
||||
var runs_1 = require("./runs.js");
|
||||
Object.defineProperty(exports, "Runs", { enumerable: true, get: function () { return runs_1.Runs; } });
|
||||
var steps_1 = require("./steps.js");
|
||||
Object.defineProperty(exports, "Steps", { enumerable: true, get: function () { return steps_1.Steps; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/index.js.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/resources/beta/threads/runs/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kCAqBgB;AApBd,4FAAA,IAAI,OAAA;AAqBN,oCAuBiB;AAtBf,8FAAA,KAAK,OAAA"}
|
||||
4
node_modules/openai/resources/beta/threads/runs/index.mjs
generated
vendored
Normal file
4
node_modules/openai/resources/beta/threads/runs/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
export { Runs, } from "./runs.mjs";
|
||||
export { Steps, } from "./steps.mjs";
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/index.mjs.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/resources/beta/threads/runs/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,IAAI,GAoBL;OACM,EACL,KAAK,GAsBN"}
|
||||
734
node_modules/openai/resources/beta/threads/runs/runs.d.mts
generated
vendored
Normal file
734
node_modules/openai/resources/beta/threads/runs/runs.d.mts
generated
vendored
Normal file
@@ -0,0 +1,734 @@
|
||||
import { APIResource } from "../../../../core/resource.mjs";
|
||||
import * as RunsAPI from "./runs.mjs";
|
||||
import * as Shared from "../../../shared.mjs";
|
||||
import * as AssistantsAPI from "../../assistants.mjs";
|
||||
import * as MessagesAPI from "../messages.mjs";
|
||||
import * as ThreadsAPI from "../threads.mjs";
|
||||
import * as StepsAPI from "./steps.mjs";
|
||||
import { CodeInterpreterLogs, CodeInterpreterOutputImage, CodeInterpreterToolCall, CodeInterpreterToolCallDelta, FileSearchToolCall, FileSearchToolCallDelta, FunctionToolCall, FunctionToolCallDelta, MessageCreationStepDetails, RunStep, RunStepDelta, RunStepDeltaEvent, RunStepDeltaMessageDelta, RunStepInclude, RunStepsPage, StepListParams, StepRetrieveParams, Steps, ToolCall, ToolCallDelta, ToolCallDeltaObject, ToolCallsStepDetails } from "./steps.mjs";
|
||||
import { APIPromise } from "../../../../core/api-promise.mjs";
|
||||
import { CursorPage, type CursorPageParams, PagePromise } from "../../../../core/pagination.mjs";
|
||||
import { Stream } from "../../../../core/streaming.mjs";
|
||||
import { RequestOptions } from "../../../../internal/request-options.mjs";
|
||||
import { AssistantStream, RunCreateParamsBaseStream } from "../../../../lib/AssistantStream.mjs";
|
||||
import { RunSubmitToolOutputsParamsStream } from "../../../../lib/AssistantStream.mjs";
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
export declare class Runs extends APIResource {
|
||||
steps: StepsAPI.Steps;
|
||||
/**
|
||||
* Create a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
create(threadID: string, params: RunCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Run>;
|
||||
create(threadID: string, params: RunCreateParamsStreaming, options?: RequestOptions): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>;
|
||||
create(threadID: string, params: RunCreateParamsBase, options?: RequestOptions): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent> | Run>;
|
||||
/**
|
||||
* Retrieves a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(runID: string, params: RunRetrieveParams, options?: RequestOptions): APIPromise<Run>;
|
||||
/**
|
||||
* Modifies a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
update(runID: string, params: RunUpdateParams, options?: RequestOptions): APIPromise<Run>;
|
||||
/**
|
||||
* Returns a list of runs belonging to a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(threadID: string, query?: RunListParams | null | undefined, options?: RequestOptions): PagePromise<RunsPage, Run>;
|
||||
/**
|
||||
* Cancels a run that is `in_progress`.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
cancel(runID: string, params: RunCancelParams, options?: RequestOptions): APIPromise<Run>;
|
||||
/**
|
||||
* A helper to create a run an poll for a terminal state. More information on Run
|
||||
* lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
createAndPoll(threadId: string, body: RunCreateParamsNonStreaming, options?: RequestOptions & {
|
||||
pollIntervalMs?: number;
|
||||
}): Promise<Run>;
|
||||
/**
|
||||
* Create a Run stream
|
||||
*
|
||||
* @deprecated use `stream` instead
|
||||
*/
|
||||
createAndStream(threadId: string, body: RunCreateParamsBaseStream, options?: RequestOptions): AssistantStream;
|
||||
/**
|
||||
* A helper to poll a run status until it reaches a terminal state. More
|
||||
* information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
poll(runId: string, params: RunRetrieveParams, options?: RequestOptions & {
|
||||
pollIntervalMs?: number;
|
||||
}): Promise<Run>;
|
||||
/**
|
||||
* Create a Run stream
|
||||
*/
|
||||
stream(threadId: string, body: RunCreateParamsBaseStream, options?: RequestOptions): AssistantStream;
|
||||
/**
|
||||
* When a run has the `status: "requires_action"` and `required_action.type` is
|
||||
* `submit_tool_outputs`, this endpoint can be used to submit the outputs from the
|
||||
* tool calls once they're all completed. All outputs must be submitted in a single
|
||||
* request.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
submitToolOutputs(runID: string, params: RunSubmitToolOutputsParamsNonStreaming, options?: RequestOptions): APIPromise<Run>;
|
||||
submitToolOutputs(runID: string, params: RunSubmitToolOutputsParamsStreaming, options?: RequestOptions): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>;
|
||||
submitToolOutputs(runID: string, params: RunSubmitToolOutputsParamsBase, options?: RequestOptions): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent> | Run>;
|
||||
/**
|
||||
* A helper to submit a tool output to a run and poll for a terminal run state.
|
||||
* More information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
submitToolOutputsAndPoll(runId: string, params: RunSubmitToolOutputsParamsNonStreaming, options?: RequestOptions & {
|
||||
pollIntervalMs?: number;
|
||||
}): Promise<Run>;
|
||||
/**
|
||||
* Submit the tool outputs from a previous run and stream the run to a terminal
|
||||
* state. More information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
submitToolOutputsStream(runId: string, params: RunSubmitToolOutputsParamsStream, options?: RequestOptions): AssistantStream;
|
||||
}
|
||||
export type RunsPage = CursorPage<Run>;
|
||||
/**
|
||||
* Tool call objects
|
||||
*/
|
||||
export interface RequiredActionFunctionToolCall {
|
||||
/**
|
||||
* The ID of the tool call. This ID must be referenced when you submit the tool
|
||||
* outputs in using the
|
||||
* [Submit tool outputs to run](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs)
|
||||
* endpoint.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The function definition.
|
||||
*/
|
||||
function: RequiredActionFunctionToolCall.Function;
|
||||
/**
|
||||
* The type of tool call the output is required for. For now, this is always
|
||||
* `function`.
|
||||
*/
|
||||
type: 'function';
|
||||
}
|
||||
export declare namespace RequiredActionFunctionToolCall {
|
||||
/**
|
||||
* The function definition.
|
||||
*/
|
||||
interface Function {
|
||||
/**
|
||||
* The arguments that the model expects you to pass to the function.
|
||||
*/
|
||||
arguments: string;
|
||||
/**
|
||||
* The name of the function.
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Represents an execution run on a
|
||||
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
||||
*/
|
||||
export interface Run {
|
||||
/**
|
||||
* The identifier, which can be referenced in API endpoints.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The ID of the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) used for
|
||||
* execution of this run.
|
||||
*/
|
||||
assistant_id: string;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run was cancelled.
|
||||
*/
|
||||
cancelled_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run was completed.
|
||||
*/
|
||||
completed_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run was created.
|
||||
*/
|
||||
created_at: number;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run will expire.
|
||||
*/
|
||||
expires_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run failed.
|
||||
*/
|
||||
failed_at: number | null;
|
||||
/**
|
||||
* Details on why the run is incomplete. Will be `null` if the run is not
|
||||
* incomplete.
|
||||
*/
|
||||
incomplete_details: Run.IncompleteDetails | null;
|
||||
/**
|
||||
* The instructions that the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) used for
|
||||
* this run.
|
||||
*/
|
||||
instructions: string;
|
||||
/**
|
||||
* The last error associated with this run. Will be `null` if there are no errors.
|
||||
*/
|
||||
last_error: Run.LastError | null;
|
||||
/**
|
||||
* The maximum number of completion tokens specified to have been used over the
|
||||
* course of the run.
|
||||
*/
|
||||
max_completion_tokens: number | null;
|
||||
/**
|
||||
* The maximum number of prompt tokens specified to have been used over the course
|
||||
* of the run.
|
||||
*/
|
||||
max_prompt_tokens: number | null;
|
||||
/**
|
||||
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
||||
* for storing additional information about the object in a structured format, and
|
||||
* querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata: Shared.Metadata | null;
|
||||
/**
|
||||
* The model that the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) used for
|
||||
* this run.
|
||||
*/
|
||||
model: string;
|
||||
/**
|
||||
* The object type, which is always `thread.run`.
|
||||
*/
|
||||
object: 'thread.run';
|
||||
/**
|
||||
* Whether to enable
|
||||
* [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
|
||||
* during tool use.
|
||||
*/
|
||||
parallel_tool_calls: boolean;
|
||||
/**
|
||||
* Details on the action required to continue the run. Will be `null` if no action
|
||||
* is required.
|
||||
*/
|
||||
required_action: Run.RequiredAction | null;
|
||||
/**
|
||||
* Specifies the format that the model must output. Compatible with
|
||||
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
|
||||
* [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
|
||||
* and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
|
||||
*
|
||||
* Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
|
||||
* Outputs which ensures the model will match your supplied JSON schema. Learn more
|
||||
* in the
|
||||
* [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
||||
*
|
||||
* Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
|
||||
* message the model generates is valid JSON.
|
||||
*
|
||||
* **Important:** when using JSON mode, you **must** also instruct the model to
|
||||
* produce JSON yourself via a system or user message. Without this, the model may
|
||||
* generate an unending stream of whitespace until the generation reaches the token
|
||||
* limit, resulting in a long-running and seemingly "stuck" request. Also note that
|
||||
* the message content may be partially cut off if `finish_reason="length"`, which
|
||||
* indicates the generation exceeded `max_tokens` or the conversation exceeded the
|
||||
* max context length.
|
||||
*/
|
||||
response_format: ThreadsAPI.AssistantResponseFormatOption | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run was started.
|
||||
*/
|
||||
started_at: number | null;
|
||||
/**
|
||||
* The status of the run, which can be either `queued`, `in_progress`,
|
||||
* `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`,
|
||||
* `incomplete`, or `expired`.
|
||||
*/
|
||||
status: RunStatus;
|
||||
/**
|
||||
* The ID of the [thread](https://platform.openai.com/docs/api-reference/threads)
|
||||
* that was executed on as a part of this run.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Controls which (if any) tool is called by the model. `none` means the model will
|
||||
* not call any tools and instead generates a message. `auto` is the default value
|
||||
* and means the model can pick between generating a message or calling one or more
|
||||
* tools. `required` means the model must call one or more tools before responding
|
||||
* to the user. Specifying a particular tool like `{"type": "file_search"}` or
|
||||
* `{"type": "function", "function": {"name": "my_function"}}` forces the model to
|
||||
* call that tool.
|
||||
*/
|
||||
tool_choice: ThreadsAPI.AssistantToolChoiceOption | null;
|
||||
/**
|
||||
* The list of tools that the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) used for
|
||||
* this run.
|
||||
*/
|
||||
tools: Array<AssistantsAPI.AssistantTool>;
|
||||
/**
|
||||
* Controls for how a thread will be truncated prior to the run. Use this to
|
||||
* control the intial context window of the run.
|
||||
*/
|
||||
truncation_strategy: Run.TruncationStrategy | null;
|
||||
/**
|
||||
* Usage statistics related to the run. This value will be `null` if the run is not
|
||||
* in a terminal state (i.e. `in_progress`, `queued`, etc.).
|
||||
*/
|
||||
usage: Run.Usage | null;
|
||||
/**
|
||||
* The sampling temperature used for this run. If not set, defaults to 1.
|
||||
*/
|
||||
temperature?: number | null;
|
||||
/**
|
||||
* The nucleus sampling value used for this run. If not set, defaults to 1.
|
||||
*/
|
||||
top_p?: number | null;
|
||||
}
|
||||
export declare namespace Run {
|
||||
/**
|
||||
* Details on why the run is incomplete. Will be `null` if the run is not
|
||||
* incomplete.
|
||||
*/
|
||||
interface IncompleteDetails {
|
||||
/**
|
||||
* The reason why the run is incomplete. This will point to which specific token
|
||||
* limit was reached over the course of the run.
|
||||
*/
|
||||
reason?: 'max_completion_tokens' | 'max_prompt_tokens';
|
||||
}
|
||||
/**
|
||||
* The last error associated with this run. Will be `null` if there are no errors.
|
||||
*/
|
||||
interface LastError {
|
||||
/**
|
||||
* One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.
|
||||
*/
|
||||
code: 'server_error' | 'rate_limit_exceeded' | 'invalid_prompt';
|
||||
/**
|
||||
* A human-readable description of the error.
|
||||
*/
|
||||
message: string;
|
||||
}
|
||||
/**
|
||||
* Details on the action required to continue the run. Will be `null` if no action
|
||||
* is required.
|
||||
*/
|
||||
interface RequiredAction {
|
||||
/**
|
||||
* Details on the tool outputs needed for this run to continue.
|
||||
*/
|
||||
submit_tool_outputs: RequiredAction.SubmitToolOutputs;
|
||||
/**
|
||||
* For now, this is always `submit_tool_outputs`.
|
||||
*/
|
||||
type: 'submit_tool_outputs';
|
||||
}
|
||||
namespace RequiredAction {
|
||||
/**
|
||||
* Details on the tool outputs needed for this run to continue.
|
||||
*/
|
||||
interface SubmitToolOutputs {
|
||||
/**
|
||||
* A list of the relevant tool calls.
|
||||
*/
|
||||
tool_calls: Array<RunsAPI.RequiredActionFunctionToolCall>;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Controls for how a thread will be truncated prior to the run. Use this to
|
||||
* control the intial context window of the run.
|
||||
*/
|
||||
interface TruncationStrategy {
|
||||
/**
|
||||
* The truncation strategy to use for the thread. The default is `auto`. If set to
|
||||
* `last_messages`, the thread will be truncated to the n most recent messages in
|
||||
* the thread. When set to `auto`, messages in the middle of the thread will be
|
||||
* dropped to fit the context length of the model, `max_prompt_tokens`.
|
||||
*/
|
||||
type: 'auto' | 'last_messages';
|
||||
/**
|
||||
* The number of most recent messages from the thread when constructing the context
|
||||
* for the run.
|
||||
*/
|
||||
last_messages?: number | null;
|
||||
}
|
||||
/**
|
||||
* Usage statistics related to the run. This value will be `null` if the run is not
|
||||
* in a terminal state (i.e. `in_progress`, `queued`, etc.).
|
||||
*/
|
||||
interface Usage {
|
||||
/**
|
||||
* Number of completion tokens used over the course of the run.
|
||||
*/
|
||||
completion_tokens: number;
|
||||
/**
|
||||
* Number of prompt tokens used over the course of the run.
|
||||
*/
|
||||
prompt_tokens: number;
|
||||
/**
|
||||
* Total number of tokens used (prompt + completion).
|
||||
*/
|
||||
total_tokens: number;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The status of the run, which can be either `queued`, `in_progress`,
|
||||
* `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`,
|
||||
* `incomplete`, or `expired`.
|
||||
*/
|
||||
export type RunStatus = 'queued' | 'in_progress' | 'requires_action' | 'cancelling' | 'cancelled' | 'failed' | 'completed' | 'incomplete' | 'expired';
|
||||
export type RunCreateParams = RunCreateParamsNonStreaming | RunCreateParamsStreaming;
|
||||
export interface RunCreateParamsBase {
|
||||
/**
|
||||
* Body param: The ID of the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
|
||||
* execute this run.
|
||||
*/
|
||||
assistant_id: string;
|
||||
/**
|
||||
* Query param: A list of additional fields to include in the response. Currently
|
||||
* the only supported value is
|
||||
* `step_details.tool_calls[*].file_search.results[*].content` to fetch the file
|
||||
* search result content.
|
||||
*
|
||||
* See the
|
||||
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
|
||||
* for more information.
|
||||
*/
|
||||
include?: Array<StepsAPI.RunStepInclude>;
|
||||
/**
|
||||
* Body param: Appends additional instructions at the end of the instructions for
|
||||
* the run. This is useful for modifying the behavior on a per-run basis without
|
||||
* overriding other instructions.
|
||||
*/
|
||||
additional_instructions?: string | null;
|
||||
/**
|
||||
* Body param: Adds additional messages to the thread before creating the run.
|
||||
*/
|
||||
additional_messages?: Array<RunCreateParams.AdditionalMessage> | null;
|
||||
/**
|
||||
* Body param: Overrides the
|
||||
* [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
|
||||
* of the assistant. This is useful for modifying the behavior on a per-run basis.
|
||||
*/
|
||||
instructions?: string | null;
|
||||
/**
|
||||
* Body param: The maximum number of completion tokens that may be used over the
|
||||
* course of the run. The run will make a best effort to use only the number of
|
||||
* completion tokens specified, across multiple turns of the run. If the run
|
||||
* exceeds the number of completion tokens specified, the run will end with status
|
||||
* `incomplete`. See `incomplete_details` for more info.
|
||||
*/
|
||||
max_completion_tokens?: number | null;
|
||||
/**
|
||||
* Body param: The maximum number of prompt tokens that may be used over the course
|
||||
* of the run. The run will make a best effort to use only the number of prompt
|
||||
* tokens specified, across multiple turns of the run. If the run exceeds the
|
||||
* number of prompt tokens specified, the run will end with status `incomplete`.
|
||||
* See `incomplete_details` for more info.
|
||||
*/
|
||||
max_prompt_tokens?: number | null;
|
||||
/**
|
||||
* Body param: Set of 16 key-value pairs that can be attached to an object. This
|
||||
* can be useful for storing additional information about the object in a
|
||||
* structured format, and querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata?: Shared.Metadata | null;
|
||||
/**
|
||||
* Body param: The ID of the
|
||||
* [Model](https://platform.openai.com/docs/api-reference/models) to be used to
|
||||
* execute this run. If a value is provided here, it will override the model
|
||||
* associated with the assistant. If not, the model associated with the assistant
|
||||
* will be used.
|
||||
*/
|
||||
model?: (string & {}) | Shared.ChatModel | null;
|
||||
/**
|
||||
* Body param: Whether to enable
|
||||
* [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
|
||||
* during tool use.
|
||||
*/
|
||||
parallel_tool_calls?: boolean;
|
||||
/**
|
||||
* Body param: **o-series models only**
|
||||
*
|
||||
* Constrains effort on reasoning for
|
||||
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
||||
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
|
||||
* result in faster responses and fewer tokens used on reasoning in a response.
|
||||
*/
|
||||
reasoning_effort?: Shared.ReasoningEffort | null;
|
||||
/**
|
||||
* Body param: Specifies the format that the model must output. Compatible with
|
||||
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
|
||||
* [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
|
||||
* and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
|
||||
*
|
||||
* Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
|
||||
* Outputs which ensures the model will match your supplied JSON schema. Learn more
|
||||
* in the
|
||||
* [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
||||
*
|
||||
* Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
|
||||
* message the model generates is valid JSON.
|
||||
*
|
||||
* **Important:** when using JSON mode, you **must** also instruct the model to
|
||||
* produce JSON yourself via a system or user message. Without this, the model may
|
||||
* generate an unending stream of whitespace until the generation reaches the token
|
||||
* limit, resulting in a long-running and seemingly "stuck" request. Also note that
|
||||
* the message content may be partially cut off if `finish_reason="length"`, which
|
||||
* indicates the generation exceeded `max_tokens` or the conversation exceeded the
|
||||
* max context length.
|
||||
*/
|
||||
response_format?: ThreadsAPI.AssistantResponseFormatOption | null;
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream?: boolean | null;
|
||||
/**
|
||||
* Body param: What sampling temperature to use, between 0 and 2. Higher values
|
||||
* like 0.8 will make the output more random, while lower values like 0.2 will make
|
||||
* it more focused and deterministic.
|
||||
*/
|
||||
temperature?: number | null;
|
||||
/**
|
||||
* Body param: Controls which (if any) tool is called by the model. `none` means
|
||||
* the model will not call any tools and instead generates a message. `auto` is the
|
||||
* default value and means the model can pick between generating a message or
|
||||
* calling one or more tools. `required` means the model must call one or more
|
||||
* tools before responding to the user. Specifying a particular tool like
|
||||
* `{"type": "file_search"}` or
|
||||
* `{"type": "function", "function": {"name": "my_function"}}` forces the model to
|
||||
* call that tool.
|
||||
*/
|
||||
tool_choice?: ThreadsAPI.AssistantToolChoiceOption | null;
|
||||
/**
|
||||
* Body param: Override the tools the assistant can use for this run. This is
|
||||
* useful for modifying the behavior on a per-run basis.
|
||||
*/
|
||||
tools?: Array<AssistantsAPI.AssistantTool> | null;
|
||||
/**
|
||||
* Body param: An alternative to sampling with temperature, called nucleus
|
||||
* sampling, where the model considers the results of the tokens with top_p
|
||||
* probability mass. So 0.1 means only the tokens comprising the top 10%
|
||||
* probability mass are considered.
|
||||
*
|
||||
* We generally recommend altering this or temperature but not both.
|
||||
*/
|
||||
top_p?: number | null;
|
||||
/**
|
||||
* Body param: Controls for how a thread will be truncated prior to the run. Use
|
||||
* this to control the intial context window of the run.
|
||||
*/
|
||||
truncation_strategy?: RunCreateParams.TruncationStrategy | null;
|
||||
}
|
||||
export declare namespace RunCreateParams {
|
||||
interface AdditionalMessage {
|
||||
/**
|
||||
* The text contents of the message.
|
||||
*/
|
||||
content: string | Array<MessagesAPI.MessageContentPartParam>;
|
||||
/**
|
||||
* The role of the entity that is creating the message. Allowed values include:
|
||||
*
|
||||
* - `user`: Indicates the message is sent by an actual user and should be used in
|
||||
* most cases to represent user-generated messages.
|
||||
* - `assistant`: Indicates the message is generated by the assistant. Use this
|
||||
* value to insert messages from the assistant into the conversation.
|
||||
*/
|
||||
role: 'user' | 'assistant';
|
||||
/**
|
||||
* A list of files attached to the message, and the tools they should be added to.
|
||||
*/
|
||||
attachments?: Array<AdditionalMessage.Attachment> | null;
|
||||
/**
|
||||
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
||||
* for storing additional information about the object in a structured format, and
|
||||
* querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata?: Shared.Metadata | null;
|
||||
}
|
||||
namespace AdditionalMessage {
|
||||
interface Attachment {
|
||||
/**
|
||||
* The ID of the file to attach to the message.
|
||||
*/
|
||||
file_id?: string;
|
||||
/**
|
||||
* The tools to add this file to.
|
||||
*/
|
||||
tools?: Array<AssistantsAPI.CodeInterpreterTool | Attachment.FileSearch>;
|
||||
}
|
||||
namespace Attachment {
|
||||
interface FileSearch {
|
||||
/**
|
||||
* The type of tool being defined: `file_search`
|
||||
*/
|
||||
type: 'file_search';
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Controls for how a thread will be truncated prior to the run. Use this to
|
||||
* control the intial context window of the run.
|
||||
*/
|
||||
interface TruncationStrategy {
|
||||
/**
|
||||
* The truncation strategy to use for the thread. The default is `auto`. If set to
|
||||
* `last_messages`, the thread will be truncated to the n most recent messages in
|
||||
* the thread. When set to `auto`, messages in the middle of the thread will be
|
||||
* dropped to fit the context length of the model, `max_prompt_tokens`.
|
||||
*/
|
||||
type: 'auto' | 'last_messages';
|
||||
/**
|
||||
* The number of most recent messages from the thread when constructing the context
|
||||
* for the run.
|
||||
*/
|
||||
last_messages?: number | null;
|
||||
}
|
||||
type RunCreateParamsNonStreaming = RunsAPI.RunCreateParamsNonStreaming;
|
||||
type RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming;
|
||||
}
|
||||
export interface RunCreateParamsNonStreaming extends RunCreateParamsBase {
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream?: false | null;
|
||||
}
|
||||
export interface RunCreateParamsStreaming extends RunCreateParamsBase {
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream: true;
|
||||
}
|
||||
export interface RunRetrieveParams {
|
||||
/**
|
||||
* The ID of the [thread](https://platform.openai.com/docs/api-reference/threads)
|
||||
* that was run.
|
||||
*/
|
||||
thread_id: string;
|
||||
}
|
||||
export interface RunUpdateParams {
|
||||
/**
|
||||
* Path param: The ID of the
|
||||
* [thread](https://platform.openai.com/docs/api-reference/threads) that was run.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Body param: Set of 16 key-value pairs that can be attached to an object. This
|
||||
* can be useful for storing additional information about the object in a
|
||||
* structured format, and querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata?: Shared.Metadata | null;
|
||||
}
|
||||
export interface RunListParams extends CursorPageParams {
|
||||
/**
|
||||
* A cursor for use in pagination. `before` is an object ID that defines your place
|
||||
* in the list. For instance, if you make a list request and receive 100 objects,
|
||||
* starting with obj_foo, your subsequent call can include before=obj_foo in order
|
||||
* to fetch the previous page of the list.
|
||||
*/
|
||||
before?: string;
|
||||
/**
|
||||
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending
|
||||
* order and `desc` for descending order.
|
||||
*/
|
||||
order?: 'asc' | 'desc';
|
||||
}
|
||||
export interface RunCancelParams {
|
||||
/**
|
||||
* The ID of the thread to which this run belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
}
|
||||
export type RunCreateAndPollParams = ThreadsAPI.ThreadCreateAndRunParamsNonStreaming;
|
||||
export type RunCreateAndStreamParams = RunCreateParamsBaseStream;
|
||||
export type RunStreamParams = RunCreateParamsBaseStream;
|
||||
export type RunSubmitToolOutputsParams = RunSubmitToolOutputsParamsNonStreaming | RunSubmitToolOutputsParamsStreaming;
|
||||
export interface RunSubmitToolOutputsParamsBase {
|
||||
/**
|
||||
* Path param: The ID of the
|
||||
* [thread](https://platform.openai.com/docs/api-reference/threads) to which this
|
||||
* run belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Body param: A list of tools for which the outputs are being submitted.
|
||||
*/
|
||||
tool_outputs: Array<RunSubmitToolOutputsParams.ToolOutput>;
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream?: boolean | null;
|
||||
}
|
||||
export declare namespace RunSubmitToolOutputsParams {
|
||||
interface ToolOutput {
|
||||
/**
|
||||
* The output of the tool call to be submitted to continue the run.
|
||||
*/
|
||||
output?: string;
|
||||
/**
|
||||
* The ID of the tool call in the `required_action` object within the run object
|
||||
* the output is being submitted for.
|
||||
*/
|
||||
tool_call_id?: string;
|
||||
}
|
||||
type RunSubmitToolOutputsParamsNonStreaming = RunsAPI.RunSubmitToolOutputsParamsNonStreaming;
|
||||
type RunSubmitToolOutputsParamsStreaming = RunsAPI.RunSubmitToolOutputsParamsStreaming;
|
||||
}
|
||||
export interface RunSubmitToolOutputsParamsNonStreaming extends RunSubmitToolOutputsParamsBase {
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream?: false | null;
|
||||
}
|
||||
export interface RunSubmitToolOutputsParamsStreaming extends RunSubmitToolOutputsParamsBase {
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream: true;
|
||||
}
|
||||
export type RunSubmitToolOutputsAndPollParams = RunSubmitToolOutputsParamsNonStreaming;
|
||||
export type RunSubmitToolOutputsStreamParams = RunSubmitToolOutputsParamsStream;
|
||||
export declare namespace Runs {
|
||||
export { type RequiredActionFunctionToolCall as RequiredActionFunctionToolCall, type Run as Run, type RunStatus as RunStatus, type RunsPage as RunsPage, type RunCreateParams as RunCreateParams, type RunCreateParamsNonStreaming as RunCreateParamsNonStreaming, type RunCreateParamsStreaming as RunCreateParamsStreaming, type RunRetrieveParams as RunRetrieveParams, type RunUpdateParams as RunUpdateParams, type RunListParams as RunListParams, type RunCreateAndPollParams, type RunCreateAndStreamParams, type RunStreamParams, type RunSubmitToolOutputsParams as RunSubmitToolOutputsParams, type RunSubmitToolOutputsParamsNonStreaming as RunSubmitToolOutputsParamsNonStreaming, type RunSubmitToolOutputsParamsStreaming as RunSubmitToolOutputsParamsStreaming, type RunSubmitToolOutputsAndPollParams, type RunSubmitToolOutputsStreamParams, };
|
||||
export { Steps as Steps, type CodeInterpreterLogs as CodeInterpreterLogs, type CodeInterpreterOutputImage as CodeInterpreterOutputImage, type CodeInterpreterToolCall as CodeInterpreterToolCall, type CodeInterpreterToolCallDelta as CodeInterpreterToolCallDelta, type FileSearchToolCall as FileSearchToolCall, type FileSearchToolCallDelta as FileSearchToolCallDelta, type FunctionToolCall as FunctionToolCall, type FunctionToolCallDelta as FunctionToolCallDelta, type MessageCreationStepDetails as MessageCreationStepDetails, type RunStep as RunStep, type RunStepDelta as RunStepDelta, type RunStepDeltaEvent as RunStepDeltaEvent, type RunStepDeltaMessageDelta as RunStepDeltaMessageDelta, type RunStepInclude as RunStepInclude, type ToolCall as ToolCall, type ToolCallDelta as ToolCallDelta, type ToolCallDeltaObject as ToolCallDeltaObject, type ToolCallsStepDetails as ToolCallsStepDetails, type RunStepsPage as RunStepsPage, type StepRetrieveParams as StepRetrieveParams, type StepListParams as StepListParams, };
|
||||
}
|
||||
//# sourceMappingURL=runs.d.mts.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/runs.d.mts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/runs.d.mts.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
734
node_modules/openai/resources/beta/threads/runs/runs.d.ts
generated
vendored
Normal file
734
node_modules/openai/resources/beta/threads/runs/runs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,734 @@
|
||||
import { APIResource } from "../../../../core/resource.js";
|
||||
import * as RunsAPI from "./runs.js";
|
||||
import * as Shared from "../../../shared.js";
|
||||
import * as AssistantsAPI from "../../assistants.js";
|
||||
import * as MessagesAPI from "../messages.js";
|
||||
import * as ThreadsAPI from "../threads.js";
|
||||
import * as StepsAPI from "./steps.js";
|
||||
import { CodeInterpreterLogs, CodeInterpreterOutputImage, CodeInterpreterToolCall, CodeInterpreterToolCallDelta, FileSearchToolCall, FileSearchToolCallDelta, FunctionToolCall, FunctionToolCallDelta, MessageCreationStepDetails, RunStep, RunStepDelta, RunStepDeltaEvent, RunStepDeltaMessageDelta, RunStepInclude, RunStepsPage, StepListParams, StepRetrieveParams, Steps, ToolCall, ToolCallDelta, ToolCallDeltaObject, ToolCallsStepDetails } from "./steps.js";
|
||||
import { APIPromise } from "../../../../core/api-promise.js";
|
||||
import { CursorPage, type CursorPageParams, PagePromise } from "../../../../core/pagination.js";
|
||||
import { Stream } from "../../../../core/streaming.js";
|
||||
import { RequestOptions } from "../../../../internal/request-options.js";
|
||||
import { AssistantStream, RunCreateParamsBaseStream } from "../../../../lib/AssistantStream.js";
|
||||
import { RunSubmitToolOutputsParamsStream } from "../../../../lib/AssistantStream.js";
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
export declare class Runs extends APIResource {
|
||||
steps: StepsAPI.Steps;
|
||||
/**
|
||||
* Create a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
create(threadID: string, params: RunCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Run>;
|
||||
create(threadID: string, params: RunCreateParamsStreaming, options?: RequestOptions): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>;
|
||||
create(threadID: string, params: RunCreateParamsBase, options?: RequestOptions): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent> | Run>;
|
||||
/**
|
||||
* Retrieves a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(runID: string, params: RunRetrieveParams, options?: RequestOptions): APIPromise<Run>;
|
||||
/**
|
||||
* Modifies a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
update(runID: string, params: RunUpdateParams, options?: RequestOptions): APIPromise<Run>;
|
||||
/**
|
||||
* Returns a list of runs belonging to a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(threadID: string, query?: RunListParams | null | undefined, options?: RequestOptions): PagePromise<RunsPage, Run>;
|
||||
/**
|
||||
* Cancels a run that is `in_progress`.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
cancel(runID: string, params: RunCancelParams, options?: RequestOptions): APIPromise<Run>;
|
||||
/**
|
||||
* A helper to create a run an poll for a terminal state. More information on Run
|
||||
* lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
createAndPoll(threadId: string, body: RunCreateParamsNonStreaming, options?: RequestOptions & {
|
||||
pollIntervalMs?: number;
|
||||
}): Promise<Run>;
|
||||
/**
|
||||
* Create a Run stream
|
||||
*
|
||||
* @deprecated use `stream` instead
|
||||
*/
|
||||
createAndStream(threadId: string, body: RunCreateParamsBaseStream, options?: RequestOptions): AssistantStream;
|
||||
/**
|
||||
* A helper to poll a run status until it reaches a terminal state. More
|
||||
* information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
poll(runId: string, params: RunRetrieveParams, options?: RequestOptions & {
|
||||
pollIntervalMs?: number;
|
||||
}): Promise<Run>;
|
||||
/**
|
||||
* Create a Run stream
|
||||
*/
|
||||
stream(threadId: string, body: RunCreateParamsBaseStream, options?: RequestOptions): AssistantStream;
|
||||
/**
|
||||
* When a run has the `status: "requires_action"` and `required_action.type` is
|
||||
* `submit_tool_outputs`, this endpoint can be used to submit the outputs from the
|
||||
* tool calls once they're all completed. All outputs must be submitted in a single
|
||||
* request.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
submitToolOutputs(runID: string, params: RunSubmitToolOutputsParamsNonStreaming, options?: RequestOptions): APIPromise<Run>;
|
||||
submitToolOutputs(runID: string, params: RunSubmitToolOutputsParamsStreaming, options?: RequestOptions): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent>>;
|
||||
submitToolOutputs(runID: string, params: RunSubmitToolOutputsParamsBase, options?: RequestOptions): APIPromise<Stream<AssistantsAPI.AssistantStreamEvent> | Run>;
|
||||
/**
|
||||
* A helper to submit a tool output to a run and poll for a terminal run state.
|
||||
* More information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
submitToolOutputsAndPoll(runId: string, params: RunSubmitToolOutputsParamsNonStreaming, options?: RequestOptions & {
|
||||
pollIntervalMs?: number;
|
||||
}): Promise<Run>;
|
||||
/**
|
||||
* Submit the tool outputs from a previous run and stream the run to a terminal
|
||||
* state. More information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
submitToolOutputsStream(runId: string, params: RunSubmitToolOutputsParamsStream, options?: RequestOptions): AssistantStream;
|
||||
}
|
||||
export type RunsPage = CursorPage<Run>;
|
||||
/**
|
||||
* Tool call objects
|
||||
*/
|
||||
export interface RequiredActionFunctionToolCall {
|
||||
/**
|
||||
* The ID of the tool call. This ID must be referenced when you submit the tool
|
||||
* outputs in using the
|
||||
* [Submit tool outputs to run](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs)
|
||||
* endpoint.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The function definition.
|
||||
*/
|
||||
function: RequiredActionFunctionToolCall.Function;
|
||||
/**
|
||||
* The type of tool call the output is required for. For now, this is always
|
||||
* `function`.
|
||||
*/
|
||||
type: 'function';
|
||||
}
|
||||
export declare namespace RequiredActionFunctionToolCall {
|
||||
/**
|
||||
* The function definition.
|
||||
*/
|
||||
interface Function {
|
||||
/**
|
||||
* The arguments that the model expects you to pass to the function.
|
||||
*/
|
||||
arguments: string;
|
||||
/**
|
||||
* The name of the function.
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Represents an execution run on a
|
||||
* [thread](https://platform.openai.com/docs/api-reference/threads).
|
||||
*/
|
||||
export interface Run {
|
||||
/**
|
||||
* The identifier, which can be referenced in API endpoints.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The ID of the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) used for
|
||||
* execution of this run.
|
||||
*/
|
||||
assistant_id: string;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run was cancelled.
|
||||
*/
|
||||
cancelled_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run was completed.
|
||||
*/
|
||||
completed_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run was created.
|
||||
*/
|
||||
created_at: number;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run will expire.
|
||||
*/
|
||||
expires_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run failed.
|
||||
*/
|
||||
failed_at: number | null;
|
||||
/**
|
||||
* Details on why the run is incomplete. Will be `null` if the run is not
|
||||
* incomplete.
|
||||
*/
|
||||
incomplete_details: Run.IncompleteDetails | null;
|
||||
/**
|
||||
* The instructions that the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) used for
|
||||
* this run.
|
||||
*/
|
||||
instructions: string;
|
||||
/**
|
||||
* The last error associated with this run. Will be `null` if there are no errors.
|
||||
*/
|
||||
last_error: Run.LastError | null;
|
||||
/**
|
||||
* The maximum number of completion tokens specified to have been used over the
|
||||
* course of the run.
|
||||
*/
|
||||
max_completion_tokens: number | null;
|
||||
/**
|
||||
* The maximum number of prompt tokens specified to have been used over the course
|
||||
* of the run.
|
||||
*/
|
||||
max_prompt_tokens: number | null;
|
||||
/**
|
||||
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
||||
* for storing additional information about the object in a structured format, and
|
||||
* querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata: Shared.Metadata | null;
|
||||
/**
|
||||
* The model that the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) used for
|
||||
* this run.
|
||||
*/
|
||||
model: string;
|
||||
/**
|
||||
* The object type, which is always `thread.run`.
|
||||
*/
|
||||
object: 'thread.run';
|
||||
/**
|
||||
* Whether to enable
|
||||
* [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
|
||||
* during tool use.
|
||||
*/
|
||||
parallel_tool_calls: boolean;
|
||||
/**
|
||||
* Details on the action required to continue the run. Will be `null` if no action
|
||||
* is required.
|
||||
*/
|
||||
required_action: Run.RequiredAction | null;
|
||||
/**
|
||||
* Specifies the format that the model must output. Compatible with
|
||||
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
|
||||
* [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
|
||||
* and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
|
||||
*
|
||||
* Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
|
||||
* Outputs which ensures the model will match your supplied JSON schema. Learn more
|
||||
* in the
|
||||
* [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
||||
*
|
||||
* Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
|
||||
* message the model generates is valid JSON.
|
||||
*
|
||||
* **Important:** when using JSON mode, you **must** also instruct the model to
|
||||
* produce JSON yourself via a system or user message. Without this, the model may
|
||||
* generate an unending stream of whitespace until the generation reaches the token
|
||||
* limit, resulting in a long-running and seemingly "stuck" request. Also note that
|
||||
* the message content may be partially cut off if `finish_reason="length"`, which
|
||||
* indicates the generation exceeded `max_tokens` or the conversation exceeded the
|
||||
* max context length.
|
||||
*/
|
||||
response_format: ThreadsAPI.AssistantResponseFormatOption | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run was started.
|
||||
*/
|
||||
started_at: number | null;
|
||||
/**
|
||||
* The status of the run, which can be either `queued`, `in_progress`,
|
||||
* `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`,
|
||||
* `incomplete`, or `expired`.
|
||||
*/
|
||||
status: RunStatus;
|
||||
/**
|
||||
* The ID of the [thread](https://platform.openai.com/docs/api-reference/threads)
|
||||
* that was executed on as a part of this run.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Controls which (if any) tool is called by the model. `none` means the model will
|
||||
* not call any tools and instead generates a message. `auto` is the default value
|
||||
* and means the model can pick between generating a message or calling one or more
|
||||
* tools. `required` means the model must call one or more tools before responding
|
||||
* to the user. Specifying a particular tool like `{"type": "file_search"}` or
|
||||
* `{"type": "function", "function": {"name": "my_function"}}` forces the model to
|
||||
* call that tool.
|
||||
*/
|
||||
tool_choice: ThreadsAPI.AssistantToolChoiceOption | null;
|
||||
/**
|
||||
* The list of tools that the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) used for
|
||||
* this run.
|
||||
*/
|
||||
tools: Array<AssistantsAPI.AssistantTool>;
|
||||
/**
|
||||
* Controls for how a thread will be truncated prior to the run. Use this to
|
||||
* control the intial context window of the run.
|
||||
*/
|
||||
truncation_strategy: Run.TruncationStrategy | null;
|
||||
/**
|
||||
* Usage statistics related to the run. This value will be `null` if the run is not
|
||||
* in a terminal state (i.e. `in_progress`, `queued`, etc.).
|
||||
*/
|
||||
usage: Run.Usage | null;
|
||||
/**
|
||||
* The sampling temperature used for this run. If not set, defaults to 1.
|
||||
*/
|
||||
temperature?: number | null;
|
||||
/**
|
||||
* The nucleus sampling value used for this run. If not set, defaults to 1.
|
||||
*/
|
||||
top_p?: number | null;
|
||||
}
|
||||
export declare namespace Run {
|
||||
/**
|
||||
* Details on why the run is incomplete. Will be `null` if the run is not
|
||||
* incomplete.
|
||||
*/
|
||||
interface IncompleteDetails {
|
||||
/**
|
||||
* The reason why the run is incomplete. This will point to which specific token
|
||||
* limit was reached over the course of the run.
|
||||
*/
|
||||
reason?: 'max_completion_tokens' | 'max_prompt_tokens';
|
||||
}
|
||||
/**
|
||||
* The last error associated with this run. Will be `null` if there are no errors.
|
||||
*/
|
||||
interface LastError {
|
||||
/**
|
||||
* One of `server_error`, `rate_limit_exceeded`, or `invalid_prompt`.
|
||||
*/
|
||||
code: 'server_error' | 'rate_limit_exceeded' | 'invalid_prompt';
|
||||
/**
|
||||
* A human-readable description of the error.
|
||||
*/
|
||||
message: string;
|
||||
}
|
||||
/**
|
||||
* Details on the action required to continue the run. Will be `null` if no action
|
||||
* is required.
|
||||
*/
|
||||
interface RequiredAction {
|
||||
/**
|
||||
* Details on the tool outputs needed for this run to continue.
|
||||
*/
|
||||
submit_tool_outputs: RequiredAction.SubmitToolOutputs;
|
||||
/**
|
||||
* For now, this is always `submit_tool_outputs`.
|
||||
*/
|
||||
type: 'submit_tool_outputs';
|
||||
}
|
||||
namespace RequiredAction {
|
||||
/**
|
||||
* Details on the tool outputs needed for this run to continue.
|
||||
*/
|
||||
interface SubmitToolOutputs {
|
||||
/**
|
||||
* A list of the relevant tool calls.
|
||||
*/
|
||||
tool_calls: Array<RunsAPI.RequiredActionFunctionToolCall>;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Controls for how a thread will be truncated prior to the run. Use this to
|
||||
* control the intial context window of the run.
|
||||
*/
|
||||
interface TruncationStrategy {
|
||||
/**
|
||||
* The truncation strategy to use for the thread. The default is `auto`. If set to
|
||||
* `last_messages`, the thread will be truncated to the n most recent messages in
|
||||
* the thread. When set to `auto`, messages in the middle of the thread will be
|
||||
* dropped to fit the context length of the model, `max_prompt_tokens`.
|
||||
*/
|
||||
type: 'auto' | 'last_messages';
|
||||
/**
|
||||
* The number of most recent messages from the thread when constructing the context
|
||||
* for the run.
|
||||
*/
|
||||
last_messages?: number | null;
|
||||
}
|
||||
/**
|
||||
* Usage statistics related to the run. This value will be `null` if the run is not
|
||||
* in a terminal state (i.e. `in_progress`, `queued`, etc.).
|
||||
*/
|
||||
interface Usage {
|
||||
/**
|
||||
* Number of completion tokens used over the course of the run.
|
||||
*/
|
||||
completion_tokens: number;
|
||||
/**
|
||||
* Number of prompt tokens used over the course of the run.
|
||||
*/
|
||||
prompt_tokens: number;
|
||||
/**
|
||||
* Total number of tokens used (prompt + completion).
|
||||
*/
|
||||
total_tokens: number;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The status of the run, which can be either `queued`, `in_progress`,
|
||||
* `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`,
|
||||
* `incomplete`, or `expired`.
|
||||
*/
|
||||
export type RunStatus = 'queued' | 'in_progress' | 'requires_action' | 'cancelling' | 'cancelled' | 'failed' | 'completed' | 'incomplete' | 'expired';
|
||||
export type RunCreateParams = RunCreateParamsNonStreaming | RunCreateParamsStreaming;
|
||||
export interface RunCreateParamsBase {
|
||||
/**
|
||||
* Body param: The ID of the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
|
||||
* execute this run.
|
||||
*/
|
||||
assistant_id: string;
|
||||
/**
|
||||
* Query param: A list of additional fields to include in the response. Currently
|
||||
* the only supported value is
|
||||
* `step_details.tool_calls[*].file_search.results[*].content` to fetch the file
|
||||
* search result content.
|
||||
*
|
||||
* See the
|
||||
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
|
||||
* for more information.
|
||||
*/
|
||||
include?: Array<StepsAPI.RunStepInclude>;
|
||||
/**
|
||||
* Body param: Appends additional instructions at the end of the instructions for
|
||||
* the run. This is useful for modifying the behavior on a per-run basis without
|
||||
* overriding other instructions.
|
||||
*/
|
||||
additional_instructions?: string | null;
|
||||
/**
|
||||
* Body param: Adds additional messages to the thread before creating the run.
|
||||
*/
|
||||
additional_messages?: Array<RunCreateParams.AdditionalMessage> | null;
|
||||
/**
|
||||
* Body param: Overrides the
|
||||
* [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
|
||||
* of the assistant. This is useful for modifying the behavior on a per-run basis.
|
||||
*/
|
||||
instructions?: string | null;
|
||||
/**
|
||||
* Body param: The maximum number of completion tokens that may be used over the
|
||||
* course of the run. The run will make a best effort to use only the number of
|
||||
* completion tokens specified, across multiple turns of the run. If the run
|
||||
* exceeds the number of completion tokens specified, the run will end with status
|
||||
* `incomplete`. See `incomplete_details` for more info.
|
||||
*/
|
||||
max_completion_tokens?: number | null;
|
||||
/**
|
||||
* Body param: The maximum number of prompt tokens that may be used over the course
|
||||
* of the run. The run will make a best effort to use only the number of prompt
|
||||
* tokens specified, across multiple turns of the run. If the run exceeds the
|
||||
* number of prompt tokens specified, the run will end with status `incomplete`.
|
||||
* See `incomplete_details` for more info.
|
||||
*/
|
||||
max_prompt_tokens?: number | null;
|
||||
/**
|
||||
* Body param: Set of 16 key-value pairs that can be attached to an object. This
|
||||
* can be useful for storing additional information about the object in a
|
||||
* structured format, and querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata?: Shared.Metadata | null;
|
||||
/**
|
||||
* Body param: The ID of the
|
||||
* [Model](https://platform.openai.com/docs/api-reference/models) to be used to
|
||||
* execute this run. If a value is provided here, it will override the model
|
||||
* associated with the assistant. If not, the model associated with the assistant
|
||||
* will be used.
|
||||
*/
|
||||
model?: (string & {}) | Shared.ChatModel | null;
|
||||
/**
|
||||
* Body param: Whether to enable
|
||||
* [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling)
|
||||
* during tool use.
|
||||
*/
|
||||
parallel_tool_calls?: boolean;
|
||||
/**
|
||||
* Body param: **o-series models only**
|
||||
*
|
||||
* Constrains effort on reasoning for
|
||||
* [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently
|
||||
* supported values are `low`, `medium`, and `high`. Reducing reasoning effort can
|
||||
* result in faster responses and fewer tokens used on reasoning in a response.
|
||||
*/
|
||||
reasoning_effort?: Shared.ReasoningEffort | null;
|
||||
/**
|
||||
* Body param: Specifies the format that the model must output. Compatible with
|
||||
* [GPT-4o](https://platform.openai.com/docs/models#gpt-4o),
|
||||
* [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4),
|
||||
* and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
|
||||
*
|
||||
* Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
|
||||
* Outputs which ensures the model will match your supplied JSON schema. Learn more
|
||||
* in the
|
||||
* [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).
|
||||
*
|
||||
* Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the
|
||||
* message the model generates is valid JSON.
|
||||
*
|
||||
* **Important:** when using JSON mode, you **must** also instruct the model to
|
||||
* produce JSON yourself via a system or user message. Without this, the model may
|
||||
* generate an unending stream of whitespace until the generation reaches the token
|
||||
* limit, resulting in a long-running and seemingly "stuck" request. Also note that
|
||||
* the message content may be partially cut off if `finish_reason="length"`, which
|
||||
* indicates the generation exceeded `max_tokens` or the conversation exceeded the
|
||||
* max context length.
|
||||
*/
|
||||
response_format?: ThreadsAPI.AssistantResponseFormatOption | null;
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream?: boolean | null;
|
||||
/**
|
||||
* Body param: What sampling temperature to use, between 0 and 2. Higher values
|
||||
* like 0.8 will make the output more random, while lower values like 0.2 will make
|
||||
* it more focused and deterministic.
|
||||
*/
|
||||
temperature?: number | null;
|
||||
/**
|
||||
* Body param: Controls which (if any) tool is called by the model. `none` means
|
||||
* the model will not call any tools and instead generates a message. `auto` is the
|
||||
* default value and means the model can pick between generating a message or
|
||||
* calling one or more tools. `required` means the model must call one or more
|
||||
* tools before responding to the user. Specifying a particular tool like
|
||||
* `{"type": "file_search"}` or
|
||||
* `{"type": "function", "function": {"name": "my_function"}}` forces the model to
|
||||
* call that tool.
|
||||
*/
|
||||
tool_choice?: ThreadsAPI.AssistantToolChoiceOption | null;
|
||||
/**
|
||||
* Body param: Override the tools the assistant can use for this run. This is
|
||||
* useful for modifying the behavior on a per-run basis.
|
||||
*/
|
||||
tools?: Array<AssistantsAPI.AssistantTool> | null;
|
||||
/**
|
||||
* Body param: An alternative to sampling with temperature, called nucleus
|
||||
* sampling, where the model considers the results of the tokens with top_p
|
||||
* probability mass. So 0.1 means only the tokens comprising the top 10%
|
||||
* probability mass are considered.
|
||||
*
|
||||
* We generally recommend altering this or temperature but not both.
|
||||
*/
|
||||
top_p?: number | null;
|
||||
/**
|
||||
* Body param: Controls for how a thread will be truncated prior to the run. Use
|
||||
* this to control the intial context window of the run.
|
||||
*/
|
||||
truncation_strategy?: RunCreateParams.TruncationStrategy | null;
|
||||
}
|
||||
export declare namespace RunCreateParams {
|
||||
interface AdditionalMessage {
|
||||
/**
|
||||
* The text contents of the message.
|
||||
*/
|
||||
content: string | Array<MessagesAPI.MessageContentPartParam>;
|
||||
/**
|
||||
* The role of the entity that is creating the message. Allowed values include:
|
||||
*
|
||||
* - `user`: Indicates the message is sent by an actual user and should be used in
|
||||
* most cases to represent user-generated messages.
|
||||
* - `assistant`: Indicates the message is generated by the assistant. Use this
|
||||
* value to insert messages from the assistant into the conversation.
|
||||
*/
|
||||
role: 'user' | 'assistant';
|
||||
/**
|
||||
* A list of files attached to the message, and the tools they should be added to.
|
||||
*/
|
||||
attachments?: Array<AdditionalMessage.Attachment> | null;
|
||||
/**
|
||||
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
||||
* for storing additional information about the object in a structured format, and
|
||||
* querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata?: Shared.Metadata | null;
|
||||
}
|
||||
namespace AdditionalMessage {
|
||||
interface Attachment {
|
||||
/**
|
||||
* The ID of the file to attach to the message.
|
||||
*/
|
||||
file_id?: string;
|
||||
/**
|
||||
* The tools to add this file to.
|
||||
*/
|
||||
tools?: Array<AssistantsAPI.CodeInterpreterTool | Attachment.FileSearch>;
|
||||
}
|
||||
namespace Attachment {
|
||||
interface FileSearch {
|
||||
/**
|
||||
* The type of tool being defined: `file_search`
|
||||
*/
|
||||
type: 'file_search';
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Controls for how a thread will be truncated prior to the run. Use this to
|
||||
* control the intial context window of the run.
|
||||
*/
|
||||
interface TruncationStrategy {
|
||||
/**
|
||||
* The truncation strategy to use for the thread. The default is `auto`. If set to
|
||||
* `last_messages`, the thread will be truncated to the n most recent messages in
|
||||
* the thread. When set to `auto`, messages in the middle of the thread will be
|
||||
* dropped to fit the context length of the model, `max_prompt_tokens`.
|
||||
*/
|
||||
type: 'auto' | 'last_messages';
|
||||
/**
|
||||
* The number of most recent messages from the thread when constructing the context
|
||||
* for the run.
|
||||
*/
|
||||
last_messages?: number | null;
|
||||
}
|
||||
type RunCreateParamsNonStreaming = RunsAPI.RunCreateParamsNonStreaming;
|
||||
type RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming;
|
||||
}
|
||||
export interface RunCreateParamsNonStreaming extends RunCreateParamsBase {
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream?: false | null;
|
||||
}
|
||||
export interface RunCreateParamsStreaming extends RunCreateParamsBase {
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream: true;
|
||||
}
|
||||
export interface RunRetrieveParams {
|
||||
/**
|
||||
* The ID of the [thread](https://platform.openai.com/docs/api-reference/threads)
|
||||
* that was run.
|
||||
*/
|
||||
thread_id: string;
|
||||
}
|
||||
export interface RunUpdateParams {
|
||||
/**
|
||||
* Path param: The ID of the
|
||||
* [thread](https://platform.openai.com/docs/api-reference/threads) that was run.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Body param: Set of 16 key-value pairs that can be attached to an object. This
|
||||
* can be useful for storing additional information about the object in a
|
||||
* structured format, and querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata?: Shared.Metadata | null;
|
||||
}
|
||||
export interface RunListParams extends CursorPageParams {
|
||||
/**
|
||||
* A cursor for use in pagination. `before` is an object ID that defines your place
|
||||
* in the list. For instance, if you make a list request and receive 100 objects,
|
||||
* starting with obj_foo, your subsequent call can include before=obj_foo in order
|
||||
* to fetch the previous page of the list.
|
||||
*/
|
||||
before?: string;
|
||||
/**
|
||||
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending
|
||||
* order and `desc` for descending order.
|
||||
*/
|
||||
order?: 'asc' | 'desc';
|
||||
}
|
||||
export interface RunCancelParams {
|
||||
/**
|
||||
* The ID of the thread to which this run belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
}
|
||||
export type RunCreateAndPollParams = ThreadsAPI.ThreadCreateAndRunParamsNonStreaming;
|
||||
export type RunCreateAndStreamParams = RunCreateParamsBaseStream;
|
||||
export type RunStreamParams = RunCreateParamsBaseStream;
|
||||
export type RunSubmitToolOutputsParams = RunSubmitToolOutputsParamsNonStreaming | RunSubmitToolOutputsParamsStreaming;
|
||||
export interface RunSubmitToolOutputsParamsBase {
|
||||
/**
|
||||
* Path param: The ID of the
|
||||
* [thread](https://platform.openai.com/docs/api-reference/threads) to which this
|
||||
* run belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Body param: A list of tools for which the outputs are being submitted.
|
||||
*/
|
||||
tool_outputs: Array<RunSubmitToolOutputsParams.ToolOutput>;
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream?: boolean | null;
|
||||
}
|
||||
export declare namespace RunSubmitToolOutputsParams {
|
||||
interface ToolOutput {
|
||||
/**
|
||||
* The output of the tool call to be submitted to continue the run.
|
||||
*/
|
||||
output?: string;
|
||||
/**
|
||||
* The ID of the tool call in the `required_action` object within the run object
|
||||
* the output is being submitted for.
|
||||
*/
|
||||
tool_call_id?: string;
|
||||
}
|
||||
type RunSubmitToolOutputsParamsNonStreaming = RunsAPI.RunSubmitToolOutputsParamsNonStreaming;
|
||||
type RunSubmitToolOutputsParamsStreaming = RunsAPI.RunSubmitToolOutputsParamsStreaming;
|
||||
}
|
||||
export interface RunSubmitToolOutputsParamsNonStreaming extends RunSubmitToolOutputsParamsBase {
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream?: false | null;
|
||||
}
|
||||
export interface RunSubmitToolOutputsParamsStreaming extends RunSubmitToolOutputsParamsBase {
|
||||
/**
|
||||
* Body param: If `true`, returns a stream of events that happen during the Run as
|
||||
* server-sent events, terminating when the Run enters a terminal state with a
|
||||
* `data: [DONE]` message.
|
||||
*/
|
||||
stream: true;
|
||||
}
|
||||
export type RunSubmitToolOutputsAndPollParams = RunSubmitToolOutputsParamsNonStreaming;
|
||||
export type RunSubmitToolOutputsStreamParams = RunSubmitToolOutputsParamsStream;
|
||||
export declare namespace Runs {
|
||||
export { type RequiredActionFunctionToolCall as RequiredActionFunctionToolCall, type Run as Run, type RunStatus as RunStatus, type RunsPage as RunsPage, type RunCreateParams as RunCreateParams, type RunCreateParamsNonStreaming as RunCreateParamsNonStreaming, type RunCreateParamsStreaming as RunCreateParamsStreaming, type RunRetrieveParams as RunRetrieveParams, type RunUpdateParams as RunUpdateParams, type RunListParams as RunListParams, type RunCreateAndPollParams, type RunCreateAndStreamParams, type RunStreamParams, type RunSubmitToolOutputsParams as RunSubmitToolOutputsParams, type RunSubmitToolOutputsParamsNonStreaming as RunSubmitToolOutputsParamsNonStreaming, type RunSubmitToolOutputsParamsStreaming as RunSubmitToolOutputsParamsStreaming, type RunSubmitToolOutputsAndPollParams, type RunSubmitToolOutputsStreamParams, };
|
||||
export { Steps as Steps, type CodeInterpreterLogs as CodeInterpreterLogs, type CodeInterpreterOutputImage as CodeInterpreterOutputImage, type CodeInterpreterToolCall as CodeInterpreterToolCall, type CodeInterpreterToolCallDelta as CodeInterpreterToolCallDelta, type FileSearchToolCall as FileSearchToolCall, type FileSearchToolCallDelta as FileSearchToolCallDelta, type FunctionToolCall as FunctionToolCall, type FunctionToolCallDelta as FunctionToolCallDelta, type MessageCreationStepDetails as MessageCreationStepDetails, type RunStep as RunStep, type RunStepDelta as RunStepDelta, type RunStepDeltaEvent as RunStepDeltaEvent, type RunStepDeltaMessageDelta as RunStepDeltaMessageDelta, type RunStepInclude as RunStepInclude, type ToolCall as ToolCall, type ToolCallDelta as ToolCallDelta, type ToolCallDeltaObject as ToolCallDeltaObject, type ToolCallsStepDetails as ToolCallsStepDetails, type RunStepsPage as RunStepsPage, type StepRetrieveParams as StepRetrieveParams, type StepListParams as StepListParams, };
|
||||
}
|
||||
//# sourceMappingURL=runs.d.ts.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/runs.d.ts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/runs.d.ts.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
182
node_modules/openai/resources/beta/threads/runs/runs.js
generated
vendored
Normal file
182
node_modules/openai/resources/beta/threads/runs/runs.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Runs = void 0;
|
||||
const tslib_1 = require("../../../../internal/tslib.js");
|
||||
const resource_1 = require("../../../../core/resource.js");
|
||||
const StepsAPI = tslib_1.__importStar(require("./steps.js"));
|
||||
const steps_1 = require("./steps.js");
|
||||
const pagination_1 = require("../../../../core/pagination.js");
|
||||
const headers_1 = require("../../../../internal/headers.js");
|
||||
const AssistantStream_1 = require("../../../../lib/AssistantStream.js");
|
||||
const sleep_1 = require("../../../../internal/utils/sleep.js");
|
||||
const path_1 = require("../../../../internal/utils/path.js");
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
class Runs extends resource_1.APIResource {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.steps = new StepsAPI.Steps(this._client);
|
||||
}
|
||||
create(threadID, params, options) {
|
||||
const { include, ...body } = params;
|
||||
return this._client.post((0, path_1.path) `/threads/${threadID}/runs`, {
|
||||
query: { include },
|
||||
body,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
stream: params.stream ?? false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Retrieves a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(runID, params, options) {
|
||||
const { thread_id } = params;
|
||||
return this._client.get((0, path_1.path) `/threads/${thread_id}/runs/${runID}`, {
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Modifies a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
update(runID, params, options) {
|
||||
const { thread_id, ...body } = params;
|
||||
return this._client.post((0, path_1.path) `/threads/${thread_id}/runs/${runID}`, {
|
||||
body,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of runs belonging to a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(threadID, query = {}, options) {
|
||||
return this._client.getAPIList((0, path_1.path) `/threads/${threadID}/runs`, (pagination_1.CursorPage), {
|
||||
query,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Cancels a run that is `in_progress`.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
cancel(runID, params, options) {
|
||||
const { thread_id } = params;
|
||||
return this._client.post((0, path_1.path) `/threads/${thread_id}/runs/${runID}/cancel`, {
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* A helper to create a run an poll for a terminal state. More information on Run
|
||||
* lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
async createAndPoll(threadId, body, options) {
|
||||
const run = await this.create(threadId, body, options);
|
||||
return await this.poll(run.id, { thread_id: threadId }, options);
|
||||
}
|
||||
/**
|
||||
* Create a Run stream
|
||||
*
|
||||
* @deprecated use `stream` instead
|
||||
*/
|
||||
createAndStream(threadId, body, options) {
|
||||
return AssistantStream_1.AssistantStream.createAssistantStream(threadId, this._client.beta.threads.runs, body, options);
|
||||
}
|
||||
/**
|
||||
* A helper to poll a run status until it reaches a terminal state. More
|
||||
* information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
async poll(runId, params, options) {
|
||||
const headers = (0, headers_1.buildHeaders)([
|
||||
options?.headers,
|
||||
{
|
||||
'X-Stainless-Poll-Helper': 'true',
|
||||
'X-Stainless-Custom-Poll-Interval': options?.pollIntervalMs?.toString() ?? undefined,
|
||||
},
|
||||
]);
|
||||
while (true) {
|
||||
const { data: run, response } = await this.retrieve(runId, params, {
|
||||
...options,
|
||||
headers: { ...options?.headers, ...headers },
|
||||
}).withResponse();
|
||||
switch (run.status) {
|
||||
//If we are in any sort of intermediate state we poll
|
||||
case 'queued':
|
||||
case 'in_progress':
|
||||
case 'cancelling':
|
||||
let sleepInterval = 5000;
|
||||
if (options?.pollIntervalMs) {
|
||||
sleepInterval = options.pollIntervalMs;
|
||||
}
|
||||
else {
|
||||
const headerInterval = response.headers.get('openai-poll-after-ms');
|
||||
if (headerInterval) {
|
||||
const headerIntervalMs = parseInt(headerInterval);
|
||||
if (!isNaN(headerIntervalMs)) {
|
||||
sleepInterval = headerIntervalMs;
|
||||
}
|
||||
}
|
||||
}
|
||||
await (0, sleep_1.sleep)(sleepInterval);
|
||||
break;
|
||||
//We return the run in any terminal state.
|
||||
case 'requires_action':
|
||||
case 'incomplete':
|
||||
case 'cancelled':
|
||||
case 'completed':
|
||||
case 'failed':
|
||||
case 'expired':
|
||||
return run;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create a Run stream
|
||||
*/
|
||||
stream(threadId, body, options) {
|
||||
return AssistantStream_1.AssistantStream.createAssistantStream(threadId, this._client.beta.threads.runs, body, options);
|
||||
}
|
||||
submitToolOutputs(runID, params, options) {
|
||||
const { thread_id, ...body } = params;
|
||||
return this._client.post((0, path_1.path) `/threads/${thread_id}/runs/${runID}/submit_tool_outputs`, {
|
||||
body,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
stream: params.stream ?? false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* A helper to submit a tool output to a run and poll for a terminal run state.
|
||||
* More information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
async submitToolOutputsAndPoll(runId, params, options) {
|
||||
const run = await this.submitToolOutputs(runId, params, options);
|
||||
return await this.poll(run.id, params, options);
|
||||
}
|
||||
/**
|
||||
* Submit the tool outputs from a previous run and stream the run to a terminal
|
||||
* state. More information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
submitToolOutputsStream(runId, params, options) {
|
||||
return AssistantStream_1.AssistantStream.createToolAssistantStream(runId, this._client.beta.threads.runs, params, options);
|
||||
}
|
||||
}
|
||||
exports.Runs = Runs;
|
||||
Runs.Steps = steps_1.Steps;
|
||||
//# sourceMappingURL=runs.js.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/runs.js.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/runs.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"runs.js","sourceRoot":"","sources":["../../../../src/resources/beta/threads/runs/runs.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,2DAAwD;AAMxD,6DAAoC;AACpC,sCAuBiB;AAEjB,+DAA6F;AAE7F,6DAA4D;AAE5D,wEAA6F;AAC7F,+DAAyD;AAEzD,6DAAuD;AAEvD;;GAEG;AACH,MAAa,IAAK,SAAQ,sBAAW;IAArC;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CA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AAa,EACb,MAAwC,EACxC,OAAwB;QAExB,OAAO,iCAAe,CAAC,yBAAyB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;CACF;AApPD,oBAoPC;AA8tBD,IAAI,CAAC,KAAK,GAAG,aAAK,CAAC"}
|
||||
177
node_modules/openai/resources/beta/threads/runs/runs.mjs
generated
vendored
Normal file
177
node_modules/openai/resources/beta/threads/runs/runs.mjs
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
import { APIResource } from "../../../../core/resource.mjs";
|
||||
import * as StepsAPI from "./steps.mjs";
|
||||
import { Steps, } from "./steps.mjs";
|
||||
import { CursorPage } from "../../../../core/pagination.mjs";
|
||||
import { buildHeaders } from "../../../../internal/headers.mjs";
|
||||
import { AssistantStream } from "../../../../lib/AssistantStream.mjs";
|
||||
import { sleep } from "../../../../internal/utils/sleep.mjs";
|
||||
import { path } from "../../../../internal/utils/path.mjs";
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
export class Runs extends APIResource {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.steps = new StepsAPI.Steps(this._client);
|
||||
}
|
||||
create(threadID, params, options) {
|
||||
const { include, ...body } = params;
|
||||
return this._client.post(path `/threads/${threadID}/runs`, {
|
||||
query: { include },
|
||||
body,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
stream: params.stream ?? false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Retrieves a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(runID, params, options) {
|
||||
const { thread_id } = params;
|
||||
return this._client.get(path `/threads/${thread_id}/runs/${runID}`, {
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Modifies a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
update(runID, params, options) {
|
||||
const { thread_id, ...body } = params;
|
||||
return this._client.post(path `/threads/${thread_id}/runs/${runID}`, {
|
||||
body,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of runs belonging to a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(threadID, query = {}, options) {
|
||||
return this._client.getAPIList(path `/threads/${threadID}/runs`, (CursorPage), {
|
||||
query,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Cancels a run that is `in_progress`.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
cancel(runID, params, options) {
|
||||
const { thread_id } = params;
|
||||
return this._client.post(path `/threads/${thread_id}/runs/${runID}/cancel`, {
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* A helper to create a run an poll for a terminal state. More information on Run
|
||||
* lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
async createAndPoll(threadId, body, options) {
|
||||
const run = await this.create(threadId, body, options);
|
||||
return await this.poll(run.id, { thread_id: threadId }, options);
|
||||
}
|
||||
/**
|
||||
* Create a Run stream
|
||||
*
|
||||
* @deprecated use `stream` instead
|
||||
*/
|
||||
createAndStream(threadId, body, options) {
|
||||
return AssistantStream.createAssistantStream(threadId, this._client.beta.threads.runs, body, options);
|
||||
}
|
||||
/**
|
||||
* A helper to poll a run status until it reaches a terminal state. More
|
||||
* information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
async poll(runId, params, options) {
|
||||
const headers = buildHeaders([
|
||||
options?.headers,
|
||||
{
|
||||
'X-Stainless-Poll-Helper': 'true',
|
||||
'X-Stainless-Custom-Poll-Interval': options?.pollIntervalMs?.toString() ?? undefined,
|
||||
},
|
||||
]);
|
||||
while (true) {
|
||||
const { data: run, response } = await this.retrieve(runId, params, {
|
||||
...options,
|
||||
headers: { ...options?.headers, ...headers },
|
||||
}).withResponse();
|
||||
switch (run.status) {
|
||||
//If we are in any sort of intermediate state we poll
|
||||
case 'queued':
|
||||
case 'in_progress':
|
||||
case 'cancelling':
|
||||
let sleepInterval = 5000;
|
||||
if (options?.pollIntervalMs) {
|
||||
sleepInterval = options.pollIntervalMs;
|
||||
}
|
||||
else {
|
||||
const headerInterval = response.headers.get('openai-poll-after-ms');
|
||||
if (headerInterval) {
|
||||
const headerIntervalMs = parseInt(headerInterval);
|
||||
if (!isNaN(headerIntervalMs)) {
|
||||
sleepInterval = headerIntervalMs;
|
||||
}
|
||||
}
|
||||
}
|
||||
await sleep(sleepInterval);
|
||||
break;
|
||||
//We return the run in any terminal state.
|
||||
case 'requires_action':
|
||||
case 'incomplete':
|
||||
case 'cancelled':
|
||||
case 'completed':
|
||||
case 'failed':
|
||||
case 'expired':
|
||||
return run;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create a Run stream
|
||||
*/
|
||||
stream(threadId, body, options) {
|
||||
return AssistantStream.createAssistantStream(threadId, this._client.beta.threads.runs, body, options);
|
||||
}
|
||||
submitToolOutputs(runID, params, options) {
|
||||
const { thread_id, ...body } = params;
|
||||
return this._client.post(path `/threads/${thread_id}/runs/${runID}/submit_tool_outputs`, {
|
||||
body,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
stream: params.stream ?? false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* A helper to submit a tool output to a run and poll for a terminal run state.
|
||||
* More information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
async submitToolOutputsAndPoll(runId, params, options) {
|
||||
const run = await this.submitToolOutputs(runId, params, options);
|
||||
return await this.poll(run.id, params, options);
|
||||
}
|
||||
/**
|
||||
* Submit the tool outputs from a previous run and stream the run to a terminal
|
||||
* state. More information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
submitToolOutputsStream(runId, params, options) {
|
||||
return AssistantStream.createToolAssistantStream(runId, this._client.beta.threads.runs, params, options);
|
||||
}
|
||||
}
|
||||
Runs.Steps = Steps;
|
||||
//# sourceMappingURL=runs.mjs.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/runs.mjs.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/runs.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"runs.mjs","sourceRoot":"","sources":["../../../../src/resources/beta/threads/runs/runs.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAMf,KAAK,QAAQ;OACb,EAkBL,KAAK,GAKN;OAEM,EAAE,UAAU,EAAsC;OAElD,EAAE,YAAY,EAAE;OAEhB,EAAE,eAAe,EAA6B;OAC9C,EAAE,KAAK,EAAE;OAET,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,IAAK,SAAQ,WAAW;IAArC;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAmP3D,CAAC;IAjOC,MAAM,CACJ,QAAgB,EAChB,MAAuB,EACvB,OAAwB;QAExB,MAAM,EAAE,OAAO,EA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AK,GAAG,KAAK,CAAC"}
|
||||
615
node_modules/openai/resources/beta/threads/runs/steps.d.mts
generated
vendored
Normal file
615
node_modules/openai/resources/beta/threads/runs/steps.d.mts
generated
vendored
Normal file
@@ -0,0 +1,615 @@
|
||||
import { APIResource } from "../../../../core/resource.mjs";
|
||||
import * as StepsAPI from "./steps.mjs";
|
||||
import * as Shared from "../../../shared.mjs";
|
||||
import { APIPromise } from "../../../../core/api-promise.mjs";
|
||||
import { CursorPage, type CursorPageParams, PagePromise } from "../../../../core/pagination.mjs";
|
||||
import { RequestOptions } from "../../../../internal/request-options.mjs";
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
export declare class Steps extends APIResource {
|
||||
/**
|
||||
* Retrieves a run step.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(stepID: string, params: StepRetrieveParams, options?: RequestOptions): APIPromise<RunStep>;
|
||||
/**
|
||||
* Returns a list of run steps belonging to a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(runID: string, params: StepListParams, options?: RequestOptions): PagePromise<RunStepsPage, RunStep>;
|
||||
}
|
||||
export type RunStepsPage = CursorPage<RunStep>;
|
||||
/**
|
||||
* Text output from the Code Interpreter tool call as part of a run step.
|
||||
*/
|
||||
export interface CodeInterpreterLogs {
|
||||
/**
|
||||
* The index of the output in the outputs array.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `logs`.
|
||||
*/
|
||||
type: 'logs';
|
||||
/**
|
||||
* The text output from the Code Interpreter tool call.
|
||||
*/
|
||||
logs?: string;
|
||||
}
|
||||
export interface CodeInterpreterOutputImage {
|
||||
/**
|
||||
* The index of the output in the outputs array.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `image`.
|
||||
*/
|
||||
type: 'image';
|
||||
image?: CodeInterpreterOutputImage.Image;
|
||||
}
|
||||
export declare namespace CodeInterpreterOutputImage {
|
||||
interface Image {
|
||||
/**
|
||||
* The [file](https://platform.openai.com/docs/api-reference/files) ID of the
|
||||
* image.
|
||||
*/
|
||||
file_id?: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Details of the Code Interpreter tool call the run step was involved in.
|
||||
*/
|
||||
export interface CodeInterpreterToolCall {
|
||||
/**
|
||||
* The ID of the tool call.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The Code Interpreter tool call definition.
|
||||
*/
|
||||
code_interpreter: CodeInterpreterToolCall.CodeInterpreter;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `code_interpreter` for this
|
||||
* type of tool call.
|
||||
*/
|
||||
type: 'code_interpreter';
|
||||
}
|
||||
export declare namespace CodeInterpreterToolCall {
|
||||
/**
|
||||
* The Code Interpreter tool call definition.
|
||||
*/
|
||||
interface CodeInterpreter {
|
||||
/**
|
||||
* The input to the Code Interpreter tool call.
|
||||
*/
|
||||
input: string;
|
||||
/**
|
||||
* The outputs from the Code Interpreter tool call. Code Interpreter can output one
|
||||
* or more items, including text (`logs`) or images (`image`). Each of these are
|
||||
* represented by a different object type.
|
||||
*/
|
||||
outputs: Array<CodeInterpreter.Logs | CodeInterpreter.Image>;
|
||||
}
|
||||
namespace CodeInterpreter {
|
||||
/**
|
||||
* Text output from the Code Interpreter tool call as part of a run step.
|
||||
*/
|
||||
interface Logs {
|
||||
/**
|
||||
* The text output from the Code Interpreter tool call.
|
||||
*/
|
||||
logs: string;
|
||||
/**
|
||||
* Always `logs`.
|
||||
*/
|
||||
type: 'logs';
|
||||
}
|
||||
interface Image {
|
||||
image: Image.Image;
|
||||
/**
|
||||
* Always `image`.
|
||||
*/
|
||||
type: 'image';
|
||||
}
|
||||
namespace Image {
|
||||
interface Image {
|
||||
/**
|
||||
* The [file](https://platform.openai.com/docs/api-reference/files) ID of the
|
||||
* image.
|
||||
*/
|
||||
file_id: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Details of the Code Interpreter tool call the run step was involved in.
|
||||
*/
|
||||
export interface CodeInterpreterToolCallDelta {
|
||||
/**
|
||||
* The index of the tool call in the tool calls array.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `code_interpreter` for this
|
||||
* type of tool call.
|
||||
*/
|
||||
type: 'code_interpreter';
|
||||
/**
|
||||
* The ID of the tool call.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The Code Interpreter tool call definition.
|
||||
*/
|
||||
code_interpreter?: CodeInterpreterToolCallDelta.CodeInterpreter;
|
||||
}
|
||||
export declare namespace CodeInterpreterToolCallDelta {
|
||||
/**
|
||||
* The Code Interpreter tool call definition.
|
||||
*/
|
||||
interface CodeInterpreter {
|
||||
/**
|
||||
* The input to the Code Interpreter tool call.
|
||||
*/
|
||||
input?: string;
|
||||
/**
|
||||
* The outputs from the Code Interpreter tool call. Code Interpreter can output one
|
||||
* or more items, including text (`logs`) or images (`image`). Each of these are
|
||||
* represented by a different object type.
|
||||
*/
|
||||
outputs?: Array<StepsAPI.CodeInterpreterLogs | StepsAPI.CodeInterpreterOutputImage>;
|
||||
}
|
||||
}
|
||||
export interface FileSearchToolCall {
|
||||
/**
|
||||
* The ID of the tool call object.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* For now, this is always going to be an empty object.
|
||||
*/
|
||||
file_search: FileSearchToolCall.FileSearch;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `file_search` for this type of
|
||||
* tool call.
|
||||
*/
|
||||
type: 'file_search';
|
||||
}
|
||||
export declare namespace FileSearchToolCall {
|
||||
/**
|
||||
* For now, this is always going to be an empty object.
|
||||
*/
|
||||
interface FileSearch {
|
||||
/**
|
||||
* The ranking options for the file search.
|
||||
*/
|
||||
ranking_options?: FileSearch.RankingOptions;
|
||||
/**
|
||||
* The results of the file search.
|
||||
*/
|
||||
results?: Array<FileSearch.Result>;
|
||||
}
|
||||
namespace FileSearch {
|
||||
/**
|
||||
* The ranking options for the file search.
|
||||
*/
|
||||
interface RankingOptions {
|
||||
/**
|
||||
* The ranker to use for the file search. If not specified will use the `auto`
|
||||
* ranker.
|
||||
*/
|
||||
ranker: 'auto' | 'default_2024_08_21';
|
||||
/**
|
||||
* The score threshold for the file search. All values must be a floating point
|
||||
* number between 0 and 1.
|
||||
*/
|
||||
score_threshold: number;
|
||||
}
|
||||
/**
|
||||
* A result instance of the file search.
|
||||
*/
|
||||
interface Result {
|
||||
/**
|
||||
* The ID of the file that result was found in.
|
||||
*/
|
||||
file_id: string;
|
||||
/**
|
||||
* The name of the file that result was found in.
|
||||
*/
|
||||
file_name: string;
|
||||
/**
|
||||
* The score of the result. All values must be a floating point number between 0
|
||||
* and 1.
|
||||
*/
|
||||
score: number;
|
||||
/**
|
||||
* The content of the result that was found. The content is only included if
|
||||
* requested via the include query parameter.
|
||||
*/
|
||||
content?: Array<Result.Content>;
|
||||
}
|
||||
namespace Result {
|
||||
interface Content {
|
||||
/**
|
||||
* The text content of the file.
|
||||
*/
|
||||
text?: string;
|
||||
/**
|
||||
* The type of the content.
|
||||
*/
|
||||
type?: 'text';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
export interface FileSearchToolCallDelta {
|
||||
/**
|
||||
* For now, this is always going to be an empty object.
|
||||
*/
|
||||
file_search: unknown;
|
||||
/**
|
||||
* The index of the tool call in the tool calls array.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `file_search` for this type of
|
||||
* tool call.
|
||||
*/
|
||||
type: 'file_search';
|
||||
/**
|
||||
* The ID of the tool call object.
|
||||
*/
|
||||
id?: string;
|
||||
}
|
||||
export interface FunctionToolCall {
|
||||
/**
|
||||
* The ID of the tool call object.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The definition of the function that was called.
|
||||
*/
|
||||
function: FunctionToolCall.Function;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `function` for this type of
|
||||
* tool call.
|
||||
*/
|
||||
type: 'function';
|
||||
}
|
||||
export declare namespace FunctionToolCall {
|
||||
/**
|
||||
* The definition of the function that was called.
|
||||
*/
|
||||
interface Function {
|
||||
/**
|
||||
* The arguments passed to the function.
|
||||
*/
|
||||
arguments: string;
|
||||
/**
|
||||
* The name of the function.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The output of the function. This will be `null` if the outputs have not been
|
||||
* [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs)
|
||||
* yet.
|
||||
*/
|
||||
output: string | null;
|
||||
}
|
||||
}
|
||||
export interface FunctionToolCallDelta {
|
||||
/**
|
||||
* The index of the tool call in the tool calls array.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `function` for this type of
|
||||
* tool call.
|
||||
*/
|
||||
type: 'function';
|
||||
/**
|
||||
* The ID of the tool call object.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The definition of the function that was called.
|
||||
*/
|
||||
function?: FunctionToolCallDelta.Function;
|
||||
}
|
||||
export declare namespace FunctionToolCallDelta {
|
||||
/**
|
||||
* The definition of the function that was called.
|
||||
*/
|
||||
interface Function {
|
||||
/**
|
||||
* The arguments passed to the function.
|
||||
*/
|
||||
arguments?: string;
|
||||
/**
|
||||
* The name of the function.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The output of the function. This will be `null` if the outputs have not been
|
||||
* [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs)
|
||||
* yet.
|
||||
*/
|
||||
output?: string | null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Details of the message creation by the run step.
|
||||
*/
|
||||
export interface MessageCreationStepDetails {
|
||||
message_creation: MessageCreationStepDetails.MessageCreation;
|
||||
/**
|
||||
* Always `message_creation`.
|
||||
*/
|
||||
type: 'message_creation';
|
||||
}
|
||||
export declare namespace MessageCreationStepDetails {
|
||||
interface MessageCreation {
|
||||
/**
|
||||
* The ID of the message that was created by this run step.
|
||||
*/
|
||||
message_id: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Represents a step in execution of a run.
|
||||
*/
|
||||
export interface RunStep {
|
||||
/**
|
||||
* The identifier of the run step, which can be referenced in API endpoints.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The ID of the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants)
|
||||
* associated with the run step.
|
||||
*/
|
||||
assistant_id: string;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run step was cancelled.
|
||||
*/
|
||||
cancelled_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run step completed.
|
||||
*/
|
||||
completed_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run step was created.
|
||||
*/
|
||||
created_at: number;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run step expired. A step is
|
||||
* considered expired if the parent run is expired.
|
||||
*/
|
||||
expired_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run step failed.
|
||||
*/
|
||||
failed_at: number | null;
|
||||
/**
|
||||
* The last error associated with this run step. Will be `null` if there are no
|
||||
* errors.
|
||||
*/
|
||||
last_error: RunStep.LastError | null;
|
||||
/**
|
||||
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
||||
* for storing additional information about the object in a structured format, and
|
||||
* querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata: Shared.Metadata | null;
|
||||
/**
|
||||
* The object type, which is always `thread.run.step`.
|
||||
*/
|
||||
object: 'thread.run.step';
|
||||
/**
|
||||
* The ID of the [run](https://platform.openai.com/docs/api-reference/runs) that
|
||||
* this run step is a part of.
|
||||
*/
|
||||
run_id: string;
|
||||
/**
|
||||
* The status of the run step, which can be either `in_progress`, `cancelled`,
|
||||
* `failed`, `completed`, or `expired`.
|
||||
*/
|
||||
status: 'in_progress' | 'cancelled' | 'failed' | 'completed' | 'expired';
|
||||
/**
|
||||
* The details of the run step.
|
||||
*/
|
||||
step_details: MessageCreationStepDetails | ToolCallsStepDetails;
|
||||
/**
|
||||
* The ID of the [thread](https://platform.openai.com/docs/api-reference/threads)
|
||||
* that was run.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* The type of run step, which can be either `message_creation` or `tool_calls`.
|
||||
*/
|
||||
type: 'message_creation' | 'tool_calls';
|
||||
/**
|
||||
* Usage statistics related to the run step. This value will be `null` while the
|
||||
* run step's status is `in_progress`.
|
||||
*/
|
||||
usage: RunStep.Usage | null;
|
||||
}
|
||||
export declare namespace RunStep {
|
||||
/**
|
||||
* The last error associated with this run step. Will be `null` if there are no
|
||||
* errors.
|
||||
*/
|
||||
interface LastError {
|
||||
/**
|
||||
* One of `server_error` or `rate_limit_exceeded`.
|
||||
*/
|
||||
code: 'server_error' | 'rate_limit_exceeded';
|
||||
/**
|
||||
* A human-readable description of the error.
|
||||
*/
|
||||
message: string;
|
||||
}
|
||||
/**
|
||||
* Usage statistics related to the run step. This value will be `null` while the
|
||||
* run step's status is `in_progress`.
|
||||
*/
|
||||
interface Usage {
|
||||
/**
|
||||
* Number of completion tokens used over the course of the run step.
|
||||
*/
|
||||
completion_tokens: number;
|
||||
/**
|
||||
* Number of prompt tokens used over the course of the run step.
|
||||
*/
|
||||
prompt_tokens: number;
|
||||
/**
|
||||
* Total number of tokens used (prompt + completion).
|
||||
*/
|
||||
total_tokens: number;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The delta containing the fields that have changed on the run step.
|
||||
*/
|
||||
export interface RunStepDelta {
|
||||
/**
|
||||
* The details of the run step.
|
||||
*/
|
||||
step_details?: RunStepDeltaMessageDelta | ToolCallDeltaObject;
|
||||
}
|
||||
/**
|
||||
* Represents a run step delta i.e. any changed fields on a run step during
|
||||
* streaming.
|
||||
*/
|
||||
export interface RunStepDeltaEvent {
|
||||
/**
|
||||
* The identifier of the run step, which can be referenced in API endpoints.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The delta containing the fields that have changed on the run step.
|
||||
*/
|
||||
delta: RunStepDelta;
|
||||
/**
|
||||
* The object type, which is always `thread.run.step.delta`.
|
||||
*/
|
||||
object: 'thread.run.step.delta';
|
||||
}
|
||||
/**
|
||||
* Details of the message creation by the run step.
|
||||
*/
|
||||
export interface RunStepDeltaMessageDelta {
|
||||
/**
|
||||
* Always `message_creation`.
|
||||
*/
|
||||
type: 'message_creation';
|
||||
message_creation?: RunStepDeltaMessageDelta.MessageCreation;
|
||||
}
|
||||
export declare namespace RunStepDeltaMessageDelta {
|
||||
interface MessageCreation {
|
||||
/**
|
||||
* The ID of the message that was created by this run step.
|
||||
*/
|
||||
message_id?: string;
|
||||
}
|
||||
}
|
||||
export type RunStepInclude = 'step_details.tool_calls[*].file_search.results[*].content';
|
||||
/**
|
||||
* Details of the Code Interpreter tool call the run step was involved in.
|
||||
*/
|
||||
export type ToolCall = CodeInterpreterToolCall | FileSearchToolCall | FunctionToolCall;
|
||||
/**
|
||||
* Details of the Code Interpreter tool call the run step was involved in.
|
||||
*/
|
||||
export type ToolCallDelta = CodeInterpreterToolCallDelta | FileSearchToolCallDelta | FunctionToolCallDelta;
|
||||
/**
|
||||
* Details of the tool call.
|
||||
*/
|
||||
export interface ToolCallDeltaObject {
|
||||
/**
|
||||
* Always `tool_calls`.
|
||||
*/
|
||||
type: 'tool_calls';
|
||||
/**
|
||||
* An array of tool calls the run step was involved in. These can be associated
|
||||
* with one of three types of tools: `code_interpreter`, `file_search`, or
|
||||
* `function`.
|
||||
*/
|
||||
tool_calls?: Array<ToolCallDelta>;
|
||||
}
|
||||
/**
|
||||
* Details of the tool call.
|
||||
*/
|
||||
export interface ToolCallsStepDetails {
|
||||
/**
|
||||
* An array of tool calls the run step was involved in. These can be associated
|
||||
* with one of three types of tools: `code_interpreter`, `file_search`, or
|
||||
* `function`.
|
||||
*/
|
||||
tool_calls: Array<ToolCall>;
|
||||
/**
|
||||
* Always `tool_calls`.
|
||||
*/
|
||||
type: 'tool_calls';
|
||||
}
|
||||
export interface StepRetrieveParams {
|
||||
/**
|
||||
* Path param: The ID of the thread to which the run and run step belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Path param: The ID of the run to which the run step belongs.
|
||||
*/
|
||||
run_id: string;
|
||||
/**
|
||||
* Query param: A list of additional fields to include in the response. Currently
|
||||
* the only supported value is
|
||||
* `step_details.tool_calls[*].file_search.results[*].content` to fetch the file
|
||||
* search result content.
|
||||
*
|
||||
* See the
|
||||
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
|
||||
* for more information.
|
||||
*/
|
||||
include?: Array<RunStepInclude>;
|
||||
}
|
||||
export interface StepListParams extends CursorPageParams {
|
||||
/**
|
||||
* Path param: The ID of the thread the run and run steps belong to.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Query param: A cursor for use in pagination. `before` is an object ID that
|
||||
* defines your place in the list. For instance, if you make a list request and
|
||||
* receive 100 objects, starting with obj_foo, your subsequent call can include
|
||||
* before=obj_foo in order to fetch the previous page of the list.
|
||||
*/
|
||||
before?: string;
|
||||
/**
|
||||
* Query param: A list of additional fields to include in the response. Currently
|
||||
* the only supported value is
|
||||
* `step_details.tool_calls[*].file_search.results[*].content` to fetch the file
|
||||
* search result content.
|
||||
*
|
||||
* See the
|
||||
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
|
||||
* for more information.
|
||||
*/
|
||||
include?: Array<RunStepInclude>;
|
||||
/**
|
||||
* Query param: Sort order by the `created_at` timestamp of the objects. `asc` for
|
||||
* ascending order and `desc` for descending order.
|
||||
*/
|
||||
order?: 'asc' | 'desc';
|
||||
}
|
||||
export declare namespace Steps {
|
||||
export { type CodeInterpreterLogs as CodeInterpreterLogs, type CodeInterpreterOutputImage as CodeInterpreterOutputImage, type CodeInterpreterToolCall as CodeInterpreterToolCall, type CodeInterpreterToolCallDelta as CodeInterpreterToolCallDelta, type FileSearchToolCall as FileSearchToolCall, type FileSearchToolCallDelta as FileSearchToolCallDelta, type FunctionToolCall as FunctionToolCall, type FunctionToolCallDelta as FunctionToolCallDelta, type MessageCreationStepDetails as MessageCreationStepDetails, type RunStep as RunStep, type RunStepDelta as RunStepDelta, type RunStepDeltaEvent as RunStepDeltaEvent, type RunStepDeltaMessageDelta as RunStepDeltaMessageDelta, type RunStepInclude as RunStepInclude, type ToolCall as ToolCall, type ToolCallDelta as ToolCallDelta, type ToolCallDeltaObject as ToolCallDeltaObject, type ToolCallsStepDetails as ToolCallsStepDetails, type RunStepsPage as RunStepsPage, type StepRetrieveParams as StepRetrieveParams, type StepListParams as StepListParams, };
|
||||
}
|
||||
//# sourceMappingURL=steps.d.mts.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/steps.d.mts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/steps.d.mts.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
615
node_modules/openai/resources/beta/threads/runs/steps.d.ts
generated
vendored
Normal file
615
node_modules/openai/resources/beta/threads/runs/steps.d.ts
generated
vendored
Normal file
@@ -0,0 +1,615 @@
|
||||
import { APIResource } from "../../../../core/resource.js";
|
||||
import * as StepsAPI from "./steps.js";
|
||||
import * as Shared from "../../../shared.js";
|
||||
import { APIPromise } from "../../../../core/api-promise.js";
|
||||
import { CursorPage, type CursorPageParams, PagePromise } from "../../../../core/pagination.js";
|
||||
import { RequestOptions } from "../../../../internal/request-options.js";
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
export declare class Steps extends APIResource {
|
||||
/**
|
||||
* Retrieves a run step.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(stepID: string, params: StepRetrieveParams, options?: RequestOptions): APIPromise<RunStep>;
|
||||
/**
|
||||
* Returns a list of run steps belonging to a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(runID: string, params: StepListParams, options?: RequestOptions): PagePromise<RunStepsPage, RunStep>;
|
||||
}
|
||||
export type RunStepsPage = CursorPage<RunStep>;
|
||||
/**
|
||||
* Text output from the Code Interpreter tool call as part of a run step.
|
||||
*/
|
||||
export interface CodeInterpreterLogs {
|
||||
/**
|
||||
* The index of the output in the outputs array.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `logs`.
|
||||
*/
|
||||
type: 'logs';
|
||||
/**
|
||||
* The text output from the Code Interpreter tool call.
|
||||
*/
|
||||
logs?: string;
|
||||
}
|
||||
export interface CodeInterpreterOutputImage {
|
||||
/**
|
||||
* The index of the output in the outputs array.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* Always `image`.
|
||||
*/
|
||||
type: 'image';
|
||||
image?: CodeInterpreterOutputImage.Image;
|
||||
}
|
||||
export declare namespace CodeInterpreterOutputImage {
|
||||
interface Image {
|
||||
/**
|
||||
* The [file](https://platform.openai.com/docs/api-reference/files) ID of the
|
||||
* image.
|
||||
*/
|
||||
file_id?: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Details of the Code Interpreter tool call the run step was involved in.
|
||||
*/
|
||||
export interface CodeInterpreterToolCall {
|
||||
/**
|
||||
* The ID of the tool call.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The Code Interpreter tool call definition.
|
||||
*/
|
||||
code_interpreter: CodeInterpreterToolCall.CodeInterpreter;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `code_interpreter` for this
|
||||
* type of tool call.
|
||||
*/
|
||||
type: 'code_interpreter';
|
||||
}
|
||||
export declare namespace CodeInterpreterToolCall {
|
||||
/**
|
||||
* The Code Interpreter tool call definition.
|
||||
*/
|
||||
interface CodeInterpreter {
|
||||
/**
|
||||
* The input to the Code Interpreter tool call.
|
||||
*/
|
||||
input: string;
|
||||
/**
|
||||
* The outputs from the Code Interpreter tool call. Code Interpreter can output one
|
||||
* or more items, including text (`logs`) or images (`image`). Each of these are
|
||||
* represented by a different object type.
|
||||
*/
|
||||
outputs: Array<CodeInterpreter.Logs | CodeInterpreter.Image>;
|
||||
}
|
||||
namespace CodeInterpreter {
|
||||
/**
|
||||
* Text output from the Code Interpreter tool call as part of a run step.
|
||||
*/
|
||||
interface Logs {
|
||||
/**
|
||||
* The text output from the Code Interpreter tool call.
|
||||
*/
|
||||
logs: string;
|
||||
/**
|
||||
* Always `logs`.
|
||||
*/
|
||||
type: 'logs';
|
||||
}
|
||||
interface Image {
|
||||
image: Image.Image;
|
||||
/**
|
||||
* Always `image`.
|
||||
*/
|
||||
type: 'image';
|
||||
}
|
||||
namespace Image {
|
||||
interface Image {
|
||||
/**
|
||||
* The [file](https://platform.openai.com/docs/api-reference/files) ID of the
|
||||
* image.
|
||||
*/
|
||||
file_id: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Details of the Code Interpreter tool call the run step was involved in.
|
||||
*/
|
||||
export interface CodeInterpreterToolCallDelta {
|
||||
/**
|
||||
* The index of the tool call in the tool calls array.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `code_interpreter` for this
|
||||
* type of tool call.
|
||||
*/
|
||||
type: 'code_interpreter';
|
||||
/**
|
||||
* The ID of the tool call.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The Code Interpreter tool call definition.
|
||||
*/
|
||||
code_interpreter?: CodeInterpreterToolCallDelta.CodeInterpreter;
|
||||
}
|
||||
export declare namespace CodeInterpreterToolCallDelta {
|
||||
/**
|
||||
* The Code Interpreter tool call definition.
|
||||
*/
|
||||
interface CodeInterpreter {
|
||||
/**
|
||||
* The input to the Code Interpreter tool call.
|
||||
*/
|
||||
input?: string;
|
||||
/**
|
||||
* The outputs from the Code Interpreter tool call. Code Interpreter can output one
|
||||
* or more items, including text (`logs`) or images (`image`). Each of these are
|
||||
* represented by a different object type.
|
||||
*/
|
||||
outputs?: Array<StepsAPI.CodeInterpreterLogs | StepsAPI.CodeInterpreterOutputImage>;
|
||||
}
|
||||
}
|
||||
export interface FileSearchToolCall {
|
||||
/**
|
||||
* The ID of the tool call object.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* For now, this is always going to be an empty object.
|
||||
*/
|
||||
file_search: FileSearchToolCall.FileSearch;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `file_search` for this type of
|
||||
* tool call.
|
||||
*/
|
||||
type: 'file_search';
|
||||
}
|
||||
export declare namespace FileSearchToolCall {
|
||||
/**
|
||||
* For now, this is always going to be an empty object.
|
||||
*/
|
||||
interface FileSearch {
|
||||
/**
|
||||
* The ranking options for the file search.
|
||||
*/
|
||||
ranking_options?: FileSearch.RankingOptions;
|
||||
/**
|
||||
* The results of the file search.
|
||||
*/
|
||||
results?: Array<FileSearch.Result>;
|
||||
}
|
||||
namespace FileSearch {
|
||||
/**
|
||||
* The ranking options for the file search.
|
||||
*/
|
||||
interface RankingOptions {
|
||||
/**
|
||||
* The ranker to use for the file search. If not specified will use the `auto`
|
||||
* ranker.
|
||||
*/
|
||||
ranker: 'auto' | 'default_2024_08_21';
|
||||
/**
|
||||
* The score threshold for the file search. All values must be a floating point
|
||||
* number between 0 and 1.
|
||||
*/
|
||||
score_threshold: number;
|
||||
}
|
||||
/**
|
||||
* A result instance of the file search.
|
||||
*/
|
||||
interface Result {
|
||||
/**
|
||||
* The ID of the file that result was found in.
|
||||
*/
|
||||
file_id: string;
|
||||
/**
|
||||
* The name of the file that result was found in.
|
||||
*/
|
||||
file_name: string;
|
||||
/**
|
||||
* The score of the result. All values must be a floating point number between 0
|
||||
* and 1.
|
||||
*/
|
||||
score: number;
|
||||
/**
|
||||
* The content of the result that was found. The content is only included if
|
||||
* requested via the include query parameter.
|
||||
*/
|
||||
content?: Array<Result.Content>;
|
||||
}
|
||||
namespace Result {
|
||||
interface Content {
|
||||
/**
|
||||
* The text content of the file.
|
||||
*/
|
||||
text?: string;
|
||||
/**
|
||||
* The type of the content.
|
||||
*/
|
||||
type?: 'text';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
export interface FileSearchToolCallDelta {
|
||||
/**
|
||||
* For now, this is always going to be an empty object.
|
||||
*/
|
||||
file_search: unknown;
|
||||
/**
|
||||
* The index of the tool call in the tool calls array.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `file_search` for this type of
|
||||
* tool call.
|
||||
*/
|
||||
type: 'file_search';
|
||||
/**
|
||||
* The ID of the tool call object.
|
||||
*/
|
||||
id?: string;
|
||||
}
|
||||
export interface FunctionToolCall {
|
||||
/**
|
||||
* The ID of the tool call object.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The definition of the function that was called.
|
||||
*/
|
||||
function: FunctionToolCall.Function;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `function` for this type of
|
||||
* tool call.
|
||||
*/
|
||||
type: 'function';
|
||||
}
|
||||
export declare namespace FunctionToolCall {
|
||||
/**
|
||||
* The definition of the function that was called.
|
||||
*/
|
||||
interface Function {
|
||||
/**
|
||||
* The arguments passed to the function.
|
||||
*/
|
||||
arguments: string;
|
||||
/**
|
||||
* The name of the function.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The output of the function. This will be `null` if the outputs have not been
|
||||
* [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs)
|
||||
* yet.
|
||||
*/
|
||||
output: string | null;
|
||||
}
|
||||
}
|
||||
export interface FunctionToolCallDelta {
|
||||
/**
|
||||
* The index of the tool call in the tool calls array.
|
||||
*/
|
||||
index: number;
|
||||
/**
|
||||
* The type of tool call. This is always going to be `function` for this type of
|
||||
* tool call.
|
||||
*/
|
||||
type: 'function';
|
||||
/**
|
||||
* The ID of the tool call object.
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* The definition of the function that was called.
|
||||
*/
|
||||
function?: FunctionToolCallDelta.Function;
|
||||
}
|
||||
export declare namespace FunctionToolCallDelta {
|
||||
/**
|
||||
* The definition of the function that was called.
|
||||
*/
|
||||
interface Function {
|
||||
/**
|
||||
* The arguments passed to the function.
|
||||
*/
|
||||
arguments?: string;
|
||||
/**
|
||||
* The name of the function.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The output of the function. This will be `null` if the outputs have not been
|
||||
* [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs)
|
||||
* yet.
|
||||
*/
|
||||
output?: string | null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Details of the message creation by the run step.
|
||||
*/
|
||||
export interface MessageCreationStepDetails {
|
||||
message_creation: MessageCreationStepDetails.MessageCreation;
|
||||
/**
|
||||
* Always `message_creation`.
|
||||
*/
|
||||
type: 'message_creation';
|
||||
}
|
||||
export declare namespace MessageCreationStepDetails {
|
||||
interface MessageCreation {
|
||||
/**
|
||||
* The ID of the message that was created by this run step.
|
||||
*/
|
||||
message_id: string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Represents a step in execution of a run.
|
||||
*/
|
||||
export interface RunStep {
|
||||
/**
|
||||
* The identifier of the run step, which can be referenced in API endpoints.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The ID of the
|
||||
* [assistant](https://platform.openai.com/docs/api-reference/assistants)
|
||||
* associated with the run step.
|
||||
*/
|
||||
assistant_id: string;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run step was cancelled.
|
||||
*/
|
||||
cancelled_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run step completed.
|
||||
*/
|
||||
completed_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run step was created.
|
||||
*/
|
||||
created_at: number;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run step expired. A step is
|
||||
* considered expired if the parent run is expired.
|
||||
*/
|
||||
expired_at: number | null;
|
||||
/**
|
||||
* The Unix timestamp (in seconds) for when the run step failed.
|
||||
*/
|
||||
failed_at: number | null;
|
||||
/**
|
||||
* The last error associated with this run step. Will be `null` if there are no
|
||||
* errors.
|
||||
*/
|
||||
last_error: RunStep.LastError | null;
|
||||
/**
|
||||
* Set of 16 key-value pairs that can be attached to an object. This can be useful
|
||||
* for storing additional information about the object in a structured format, and
|
||||
* querying for objects via API or the dashboard.
|
||||
*
|
||||
* Keys are strings with a maximum length of 64 characters. Values are strings with
|
||||
* a maximum length of 512 characters.
|
||||
*/
|
||||
metadata: Shared.Metadata | null;
|
||||
/**
|
||||
* The object type, which is always `thread.run.step`.
|
||||
*/
|
||||
object: 'thread.run.step';
|
||||
/**
|
||||
* The ID of the [run](https://platform.openai.com/docs/api-reference/runs) that
|
||||
* this run step is a part of.
|
||||
*/
|
||||
run_id: string;
|
||||
/**
|
||||
* The status of the run step, which can be either `in_progress`, `cancelled`,
|
||||
* `failed`, `completed`, or `expired`.
|
||||
*/
|
||||
status: 'in_progress' | 'cancelled' | 'failed' | 'completed' | 'expired';
|
||||
/**
|
||||
* The details of the run step.
|
||||
*/
|
||||
step_details: MessageCreationStepDetails | ToolCallsStepDetails;
|
||||
/**
|
||||
* The ID of the [thread](https://platform.openai.com/docs/api-reference/threads)
|
||||
* that was run.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* The type of run step, which can be either `message_creation` or `tool_calls`.
|
||||
*/
|
||||
type: 'message_creation' | 'tool_calls';
|
||||
/**
|
||||
* Usage statistics related to the run step. This value will be `null` while the
|
||||
* run step's status is `in_progress`.
|
||||
*/
|
||||
usage: RunStep.Usage | null;
|
||||
}
|
||||
export declare namespace RunStep {
|
||||
/**
|
||||
* The last error associated with this run step. Will be `null` if there are no
|
||||
* errors.
|
||||
*/
|
||||
interface LastError {
|
||||
/**
|
||||
* One of `server_error` or `rate_limit_exceeded`.
|
||||
*/
|
||||
code: 'server_error' | 'rate_limit_exceeded';
|
||||
/**
|
||||
* A human-readable description of the error.
|
||||
*/
|
||||
message: string;
|
||||
}
|
||||
/**
|
||||
* Usage statistics related to the run step. This value will be `null` while the
|
||||
* run step's status is `in_progress`.
|
||||
*/
|
||||
interface Usage {
|
||||
/**
|
||||
* Number of completion tokens used over the course of the run step.
|
||||
*/
|
||||
completion_tokens: number;
|
||||
/**
|
||||
* Number of prompt tokens used over the course of the run step.
|
||||
*/
|
||||
prompt_tokens: number;
|
||||
/**
|
||||
* Total number of tokens used (prompt + completion).
|
||||
*/
|
||||
total_tokens: number;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The delta containing the fields that have changed on the run step.
|
||||
*/
|
||||
export interface RunStepDelta {
|
||||
/**
|
||||
* The details of the run step.
|
||||
*/
|
||||
step_details?: RunStepDeltaMessageDelta | ToolCallDeltaObject;
|
||||
}
|
||||
/**
|
||||
* Represents a run step delta i.e. any changed fields on a run step during
|
||||
* streaming.
|
||||
*/
|
||||
export interface RunStepDeltaEvent {
|
||||
/**
|
||||
* The identifier of the run step, which can be referenced in API endpoints.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The delta containing the fields that have changed on the run step.
|
||||
*/
|
||||
delta: RunStepDelta;
|
||||
/**
|
||||
* The object type, which is always `thread.run.step.delta`.
|
||||
*/
|
||||
object: 'thread.run.step.delta';
|
||||
}
|
||||
/**
|
||||
* Details of the message creation by the run step.
|
||||
*/
|
||||
export interface RunStepDeltaMessageDelta {
|
||||
/**
|
||||
* Always `message_creation`.
|
||||
*/
|
||||
type: 'message_creation';
|
||||
message_creation?: RunStepDeltaMessageDelta.MessageCreation;
|
||||
}
|
||||
export declare namespace RunStepDeltaMessageDelta {
|
||||
interface MessageCreation {
|
||||
/**
|
||||
* The ID of the message that was created by this run step.
|
||||
*/
|
||||
message_id?: string;
|
||||
}
|
||||
}
|
||||
export type RunStepInclude = 'step_details.tool_calls[*].file_search.results[*].content';
|
||||
/**
|
||||
* Details of the Code Interpreter tool call the run step was involved in.
|
||||
*/
|
||||
export type ToolCall = CodeInterpreterToolCall | FileSearchToolCall | FunctionToolCall;
|
||||
/**
|
||||
* Details of the Code Interpreter tool call the run step was involved in.
|
||||
*/
|
||||
export type ToolCallDelta = CodeInterpreterToolCallDelta | FileSearchToolCallDelta | FunctionToolCallDelta;
|
||||
/**
|
||||
* Details of the tool call.
|
||||
*/
|
||||
export interface ToolCallDeltaObject {
|
||||
/**
|
||||
* Always `tool_calls`.
|
||||
*/
|
||||
type: 'tool_calls';
|
||||
/**
|
||||
* An array of tool calls the run step was involved in. These can be associated
|
||||
* with one of three types of tools: `code_interpreter`, `file_search`, or
|
||||
* `function`.
|
||||
*/
|
||||
tool_calls?: Array<ToolCallDelta>;
|
||||
}
|
||||
/**
|
||||
* Details of the tool call.
|
||||
*/
|
||||
export interface ToolCallsStepDetails {
|
||||
/**
|
||||
* An array of tool calls the run step was involved in. These can be associated
|
||||
* with one of three types of tools: `code_interpreter`, `file_search`, or
|
||||
* `function`.
|
||||
*/
|
||||
tool_calls: Array<ToolCall>;
|
||||
/**
|
||||
* Always `tool_calls`.
|
||||
*/
|
||||
type: 'tool_calls';
|
||||
}
|
||||
export interface StepRetrieveParams {
|
||||
/**
|
||||
* Path param: The ID of the thread to which the run and run step belongs.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Path param: The ID of the run to which the run step belongs.
|
||||
*/
|
||||
run_id: string;
|
||||
/**
|
||||
* Query param: A list of additional fields to include in the response. Currently
|
||||
* the only supported value is
|
||||
* `step_details.tool_calls[*].file_search.results[*].content` to fetch the file
|
||||
* search result content.
|
||||
*
|
||||
* See the
|
||||
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
|
||||
* for more information.
|
||||
*/
|
||||
include?: Array<RunStepInclude>;
|
||||
}
|
||||
export interface StepListParams extends CursorPageParams {
|
||||
/**
|
||||
* Path param: The ID of the thread the run and run steps belong to.
|
||||
*/
|
||||
thread_id: string;
|
||||
/**
|
||||
* Query param: A cursor for use in pagination. `before` is an object ID that
|
||||
* defines your place in the list. For instance, if you make a list request and
|
||||
* receive 100 objects, starting with obj_foo, your subsequent call can include
|
||||
* before=obj_foo in order to fetch the previous page of the list.
|
||||
*/
|
||||
before?: string;
|
||||
/**
|
||||
* Query param: A list of additional fields to include in the response. Currently
|
||||
* the only supported value is
|
||||
* `step_details.tool_calls[*].file_search.results[*].content` to fetch the file
|
||||
* search result content.
|
||||
*
|
||||
* See the
|
||||
* [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings)
|
||||
* for more information.
|
||||
*/
|
||||
include?: Array<RunStepInclude>;
|
||||
/**
|
||||
* Query param: Sort order by the `created_at` timestamp of the objects. `asc` for
|
||||
* ascending order and `desc` for descending order.
|
||||
*/
|
||||
order?: 'asc' | 'desc';
|
||||
}
|
||||
export declare namespace Steps {
|
||||
export { type CodeInterpreterLogs as CodeInterpreterLogs, type CodeInterpreterOutputImage as CodeInterpreterOutputImage, type CodeInterpreterToolCall as CodeInterpreterToolCall, type CodeInterpreterToolCallDelta as CodeInterpreterToolCallDelta, type FileSearchToolCall as FileSearchToolCall, type FileSearchToolCallDelta as FileSearchToolCallDelta, type FunctionToolCall as FunctionToolCall, type FunctionToolCallDelta as FunctionToolCallDelta, type MessageCreationStepDetails as MessageCreationStepDetails, type RunStep as RunStep, type RunStepDelta as RunStepDelta, type RunStepDeltaEvent as RunStepDeltaEvent, type RunStepDeltaMessageDelta as RunStepDeltaMessageDelta, type RunStepInclude as RunStepInclude, type ToolCall as ToolCall, type ToolCallDelta as ToolCallDelta, type ToolCallDeltaObject as ToolCallDeltaObject, type ToolCallsStepDetails as ToolCallsStepDetails, type RunStepsPage as RunStepsPage, type StepRetrieveParams as StepRetrieveParams, type StepListParams as StepListParams, };
|
||||
}
|
||||
//# sourceMappingURL=steps.d.ts.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/steps.d.ts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/steps.d.ts.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
41
node_modules/openai/resources/beta/threads/runs/steps.js
generated
vendored
Normal file
41
node_modules/openai/resources/beta/threads/runs/steps.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Steps = void 0;
|
||||
const resource_1 = require("../../../../core/resource.js");
|
||||
const pagination_1 = require("../../../../core/pagination.js");
|
||||
const headers_1 = require("../../../../internal/headers.js");
|
||||
const path_1 = require("../../../../internal/utils/path.js");
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
class Steps extends resource_1.APIResource {
|
||||
/**
|
||||
* Retrieves a run step.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(stepID, params, options) {
|
||||
const { thread_id, run_id, ...query } = params;
|
||||
return this._client.get((0, path_1.path) `/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, {
|
||||
query,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of run steps belonging to a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(runID, params, options) {
|
||||
const { thread_id, ...query } = params;
|
||||
return this._client.getAPIList((0, path_1.path) `/threads/${thread_id}/runs/${runID}/steps`, (pagination_1.CursorPage), {
|
||||
query,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Steps = Steps;
|
||||
//# sourceMappingURL=steps.js.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/steps.js.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/steps.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../../../src/resources/beta/threads/runs/steps.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2DAAwD;AAIxD,+DAA6F;AAC7F,6DAA4D;AAE5D,6DAAuD;AAEvD;;GAEG;AACH,MAAa,KAAM,SAAQ,sBAAW;IACpC;;;;OAIG;IACH,QAAQ,CAAC,MAAc,EAAE,MAA0B,EAAE,OAAwB;QAC3E,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,YAAY,SAAS,SAAS,MAAM,UAAU,MAAM,EAAE,EAAE;YAClF,KAAK;YACL,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,KAAa,EAAE,MAAsB,EAAE,OAAwB;QAClE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAA,WAAI,EAAA,YAAY,SAAS,SAAS,KAAK,QAAQ,EAAE,CAAA,uBAAmB,CAAA,EAAE;YACnG,KAAK;YACL,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;CACF;AA5BD,sBA4BC"}
|
||||
37
node_modules/openai/resources/beta/threads/runs/steps.mjs
generated
vendored
Normal file
37
node_modules/openai/resources/beta/threads/runs/steps.mjs
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
import { APIResource } from "../../../../core/resource.mjs";
|
||||
import { CursorPage } from "../../../../core/pagination.mjs";
|
||||
import { buildHeaders } from "../../../../internal/headers.mjs";
|
||||
import { path } from "../../../../internal/utils/path.mjs";
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
export class Steps extends APIResource {
|
||||
/**
|
||||
* Retrieves a run step.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(stepID, params, options) {
|
||||
const { thread_id, run_id, ...query } = params;
|
||||
return this._client.get(path `/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, {
|
||||
query,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns a list of run steps belonging to a run.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
list(runID, params, options) {
|
||||
const { thread_id, ...query } = params;
|
||||
return this._client.getAPIList(path `/threads/${thread_id}/runs/${runID}/steps`, (CursorPage), {
|
||||
query,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=steps.mjs.map
|
||||
1
node_modules/openai/resources/beta/threads/runs/steps.mjs.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/runs/steps.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"steps.mjs","sourceRoot":"","sources":["../../../../src/resources/beta/threads/runs/steps.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,UAAU,EAAsC;OAClD,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;;;OAIG;IACH,QAAQ,CAAC,MAAc,EAAE,MAA0B,EAAE,OAAwB;QAC3E,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,YAAY,SAAS,SAAS,MAAM,UAAU,MAAM,EAAE,EAAE;YAClF,KAAK;YACL,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,KAAa,EAAE,MAAsB,EAAE,OAAwB;QAClE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAA,YAAY,SAAS,SAAS,KAAK,QAAQ,EAAE,CAAA,UAAmB,CAAA,EAAE;YACnG,KAAK;YACL,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;CACF"}
|
||||
1044
node_modules/openai/resources/beta/threads/threads.d.mts
generated
vendored
Normal file
1044
node_modules/openai/resources/beta/threads/threads.d.mts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/openai/resources/beta/threads/threads.d.mts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/threads.d.mts.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1044
node_modules/openai/resources/beta/threads/threads.d.ts
generated
vendored
Normal file
1044
node_modules/openai/resources/beta/threads/threads.d.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/openai/resources/beta/threads/threads.d.ts.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/threads.d.ts.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
96
node_modules/openai/resources/beta/threads/threads.js
generated
vendored
Normal file
96
node_modules/openai/resources/beta/threads/threads.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Threads = void 0;
|
||||
const tslib_1 = require("../../../internal/tslib.js");
|
||||
const resource_1 = require("../../../core/resource.js");
|
||||
const MessagesAPI = tslib_1.__importStar(require("./messages.js"));
|
||||
const messages_1 = require("./messages.js");
|
||||
const RunsAPI = tslib_1.__importStar(require("./runs/runs.js"));
|
||||
const runs_1 = require("./runs/runs.js");
|
||||
const headers_1 = require("../../../internal/headers.js");
|
||||
const AssistantStream_1 = require("../../../lib/AssistantStream.js");
|
||||
const path_1 = require("../../../internal/utils/path.js");
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
class Threads extends resource_1.APIResource {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.runs = new RunsAPI.Runs(this._client);
|
||||
this.messages = new MessagesAPI.Messages(this._client);
|
||||
}
|
||||
/**
|
||||
* Create a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
create(body = {}, options) {
|
||||
return this._client.post('/threads', {
|
||||
body,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Retrieves a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(threadID, options) {
|
||||
return this._client.get((0, path_1.path) `/threads/${threadID}`, {
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Modifies a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
update(threadID, body, options) {
|
||||
return this._client.post((0, path_1.path) `/threads/${threadID}`, {
|
||||
body,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Delete a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
delete(threadID, options) {
|
||||
return this._client.delete((0, path_1.path) `/threads/${threadID}`, {
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
createAndRun(body, options) {
|
||||
return this._client.post('/threads/runs', {
|
||||
body,
|
||||
...options,
|
||||
headers: (0, headers_1.buildHeaders)([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
stream: body.stream ?? false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* A helper to create a thread, start a run and then poll for a terminal state.
|
||||
* More information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
async createAndRunPoll(body, options) {
|
||||
const run = await this.createAndRun(body, options);
|
||||
return await this.runs.poll(run.id, { thread_id: run.thread_id }, options);
|
||||
}
|
||||
/**
|
||||
* Create a thread and stream the run back
|
||||
*/
|
||||
createAndRunStream(body, options) {
|
||||
return AssistantStream_1.AssistantStream.createThreadAssistantStream(body, this._client.beta.threads, options);
|
||||
}
|
||||
}
|
||||
exports.Threads = Threads;
|
||||
Threads.Runs = runs_1.Runs;
|
||||
Threads.Messages = messages_1.Messages;
|
||||
//# sourceMappingURL=threads.js.map
|
||||
1
node_modules/openai/resources/beta/threads/threads.js.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/threads.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"threads.js","sourceRoot":"","sources":["../../../src/resources/beta/threads/threads.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AAIrD,mEAA0C;AAC1C,4CAoCoB;AACpB,gEAAuC;AACvC,yCAqBqB;AAGrB,0DAAyD;AAEzD,qEAAmG;AACnG,0DAAoD;AAEpD;;GAEG;AACH,MAAa,OAAQ,SAAQ,sBAAW;IAAxC;;QACE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpD,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAiG1E,CAAC;IA/FC;;;;OAIG;IACH,MAAM,CAAC,OAA8C,EAAE,EAAE,OAAwB;QAC/E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE;YACnC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,YAAY,QAAQ,EAAE,EAAE;YAClD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,aAAa,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC9E,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAgB,EAAE,IAAwB,EAAE,OAAwB;QACzE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAA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AAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/F,CAAC;CACF;AAnGD,0BAmGC;AAknCD,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC;AACpB,OAAO,CAAC,QAAQ,GAAG,mBAAQ,CAAC"}
|
||||
91
node_modules/openai/resources/beta/threads/threads.mjs
generated
vendored
Normal file
91
node_modules/openai/resources/beta/threads/threads.mjs
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||||
import { APIResource } from "../../../core/resource.mjs";
|
||||
import * as MessagesAPI from "./messages.mjs";
|
||||
import { Messages, } from "./messages.mjs";
|
||||
import * as RunsAPI from "./runs/runs.mjs";
|
||||
import { Runs, } from "./runs/runs.mjs";
|
||||
import { buildHeaders } from "../../../internal/headers.mjs";
|
||||
import { AssistantStream } from "../../../lib/AssistantStream.mjs";
|
||||
import { path } from "../../../internal/utils/path.mjs";
|
||||
/**
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
export class Threads extends APIResource {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.runs = new RunsAPI.Runs(this._client);
|
||||
this.messages = new MessagesAPI.Messages(this._client);
|
||||
}
|
||||
/**
|
||||
* Create a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
create(body = {}, options) {
|
||||
return this._client.post('/threads', {
|
||||
body,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Retrieves a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
retrieve(threadID, options) {
|
||||
return this._client.get(path `/threads/${threadID}`, {
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Modifies a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
update(threadID, body, options) {
|
||||
return this._client.post(path `/threads/${threadID}`, {
|
||||
body,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Delete a thread.
|
||||
*
|
||||
* @deprecated The Assistants API is deprecated in favor of the Responses API
|
||||
*/
|
||||
delete(threadID, options) {
|
||||
return this._client.delete(path `/threads/${threadID}`, {
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
});
|
||||
}
|
||||
createAndRun(body, options) {
|
||||
return this._client.post('/threads/runs', {
|
||||
body,
|
||||
...options,
|
||||
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
||||
stream: body.stream ?? false,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* A helper to create a thread, start a run and then poll for a terminal state.
|
||||
* More information on Run lifecycles can be found here:
|
||||
* https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps
|
||||
*/
|
||||
async createAndRunPoll(body, options) {
|
||||
const run = await this.createAndRun(body, options);
|
||||
return await this.runs.poll(run.id, { thread_id: run.thread_id }, options);
|
||||
}
|
||||
/**
|
||||
* Create a thread and stream the run back
|
||||
*/
|
||||
createAndRunStream(body, options) {
|
||||
return AssistantStream.createThreadAssistantStream(body, this._client.beta.threads, options);
|
||||
}
|
||||
}
|
||||
Threads.Runs = Runs;
|
||||
Threads.Messages = Messages;
|
||||
//# sourceMappingURL=threads.mjs.map
|
||||
1
node_modules/openai/resources/beta/threads/threads.mjs.map
generated
vendored
Normal file
1
node_modules/openai/resources/beta/threads/threads.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"threads.mjs","source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