Skip to content

Commit

Permalink
Update openai dependency to version 4.71.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rileytomasek committed Nov 11, 2024
1 parent 532d8c7 commit dcd9cd3
Show file tree
Hide file tree
Showing 51 changed files with 446 additions and 695 deletions.
8 changes: 4 additions & 4 deletions openai-types/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export declare class APIPromise<T> extends Promise<WithRequestID<T>> {
private parseResponse;
private parsedPromise;
constructor(responsePromise: Promise<APIResponseProps>, parseResponse?: (props: APIResponseProps) => PromiseOrValue<WithRequestID<T>>);
_thenUnwrap<U>(transform: (data: T) => U): APIPromise<U>;
_thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U>;
/**
* Gets the raw `Response` instance instead of parsing the response
* data.
Expand Down Expand Up @@ -159,8 +159,8 @@ export declare abstract class AbstractPage<Item> implements AsyncIterable<Item>
abstract getPaginatedItems(): Item[];
hasNextPage(): boolean;
getNextPage(): Promise<this>;
iterPages(): AsyncGenerator<AbstractPage<Item>, void, unknown>;
[Symbol.asyncIterator](): AsyncGenerator<Awaited<Item>, void, unknown>;
iterPages(): AsyncGenerator<this>;
[Symbol.asyncIterator](): AsyncGenerator<Item>;
}
/**
* This subclass of Promise will resolve to an instantiated Page once the request completes.
Expand All @@ -180,7 +180,7 @@ export declare class PagePromise<PageClass extends AbstractPage<Item>, Item = Re
* console.log(item)
* }
*/
[Symbol.asyncIterator](): AsyncGenerator<Awaited<Item>, void, unknown>;
[Symbol.asyncIterator](): AsyncGenerator<Item>;
}
export declare const createResponseHeaders: (headers: Awaited<ReturnType<Fetch>>['headers']) => Record<string, string>;
type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
Expand Down
132 changes: 38 additions & 94 deletions openai-types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import * as Errors from "./error.js";
import * as Uploads from "./uploads.js";
import { type Agent, type RequestInit } from "./_shims/index.js";
import * as Core from "./core.js";
import * as Errors from "./error.js";
import * as Pagination from "./pagination.js";
import { type CursorPageParams, CursorPageResponse, PageResponse } from "./pagination.js";
import * as Uploads from "./uploads.js";
import * as API from "./resources/index.js";
import { Batch, BatchCreateParams, BatchError, BatchListParams, BatchRequestCounts, Batches, BatchesPage } from "./resources/batches.js";
import { Completion, CompletionChoice, CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, CompletionUsage, Completions } from "./resources/completions.js";
import { CreateEmbeddingResponse, Embedding, EmbeddingCreateParams, EmbeddingModel, Embeddings } from "./resources/embeddings.js";
import { FileContent, FileCreateParams, FileDeleted, FileListParams, FileObject, FileObjectsPage, FilePurpose, Files } from "./resources/files.js";
import { Image, ImageCreateVariationParams, ImageEditParams, ImageGenerateParams, ImageModel, Images, ImagesResponse } from "./resources/images.js";
import { Model, ModelDeleted, Models, ModelsPage } from "./resources/models.js";
import { Moderation, ModerationCreateParams, ModerationCreateResponse, ModerationImageURLInput, ModerationModel, ModerationMultiModalInput, ModerationTextInput, Moderations } from "./resources/moderations.js";
import { Audio, AudioModel, AudioResponseFormat } from "./resources/audio/audio.js";
import { Beta } from "./resources/beta/beta.js";
import { Chat, ChatModel } from "./resources/chat/chat.js";
import { ChatCompletion, ChatCompletionAssistantMessageParam, ChatCompletionAudio, ChatCompletionAudioParam, ChatCompletionChunk, ChatCompletionContentPart, ChatCompletionContentPartImage, ChatCompletionContentPartInputAudio, ChatCompletionContentPartRefusal, ChatCompletionContentPartText, ChatCompletionCreateParams, ChatCompletionCreateParamsNonStreaming, ChatCompletionCreateParamsStreaming, ChatCompletionFunctionCallOption, ChatCompletionFunctionMessageParam, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, ChatCompletionModality, ChatCompletionNamedToolChoice, ChatCompletionPredictionContent, ChatCompletionRole, ChatCompletionStreamOptions, ChatCompletionSystemMessageParam, ChatCompletionTokenLogprob, ChatCompletionTool, ChatCompletionToolChoiceOption, ChatCompletionToolMessageParam, ChatCompletionUserMessageParam } from "./resources/chat/completions.js";
import { FineTuning } from "./resources/fine-tuning/fine-tuning.js";
import { Upload, UploadCompleteParams, UploadCreateParams, Uploads as UploadsAPIUploads } from "./resources/uploads/uploads.js";
export interface ClientOptions {
/**
* Defaults to process.env['OPENAI_API_KEY'].
Expand Down Expand Up @@ -130,103 +144,33 @@ export declare class OpenAI extends Core.APIClient {
static toFile: typeof Uploads.toFile;
static fileFromPath: typeof Uploads.fileFromPath;
}
export declare const OpenAIError: typeof Errors.OpenAIError, APIError: typeof Errors.APIError, APIConnectionError: typeof Errors.APIConnectionError, APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError, APIUserAbortError: typeof Errors.APIUserAbortError, NotFoundError: typeof Errors.NotFoundError, ConflictError: typeof Errors.ConflictError, RateLimitError: typeof Errors.RateLimitError, BadRequestError: typeof Errors.BadRequestError, AuthenticationError: typeof Errors.AuthenticationError, InternalServerError: typeof Errors.InternalServerError, PermissionDeniedError: typeof Errors.PermissionDeniedError, UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
export { OpenAIError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.js";
export import toFile = Uploads.toFile;
export import fileFromPath = Uploads.fileFromPath;
export declare namespace OpenAI {
export import RequestOptions = Core.RequestOptions;
export type RequestOptions = Core.RequestOptions;
export import Page = Pagination.Page;
export import PageResponse = Pagination.PageResponse;
export { type PageResponse as PageResponse };
export import CursorPage = Pagination.CursorPage;
export import CursorPageParams = Pagination.CursorPageParams;
export import CursorPageResponse = Pagination.CursorPageResponse;
export import Completions = API.Completions;
export import Completion = API.Completion;
export import CompletionChoice = API.CompletionChoice;
export import CompletionUsage = API.CompletionUsage;
export import CompletionCreateParams = API.CompletionCreateParams;
export import CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
export import CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
export import Chat = API.Chat;
export import ChatModel = API.ChatModel;
export import ChatCompletion = API.ChatCompletion;
export import ChatCompletionAssistantMessageParam = API.ChatCompletionAssistantMessageParam;
export import ChatCompletionChunk = API.ChatCompletionChunk;
export import ChatCompletionContentPart = API.ChatCompletionContentPart;
export import ChatCompletionContentPartImage = API.ChatCompletionContentPartImage;
export import ChatCompletionContentPartRefusal = API.ChatCompletionContentPartRefusal;
export import ChatCompletionContentPartText = API.ChatCompletionContentPartText;
export import ChatCompletionFunctionCallOption = API.ChatCompletionFunctionCallOption;
export import ChatCompletionFunctionMessageParam = API.ChatCompletionFunctionMessageParam;
export import ChatCompletionMessage = API.ChatCompletionMessage;
export import ChatCompletionMessageParam = API.ChatCompletionMessageParam;
export import ChatCompletionMessageToolCall = API.ChatCompletionMessageToolCall;
export import ChatCompletionNamedToolChoice = API.ChatCompletionNamedToolChoice;
export import ChatCompletionRole = API.ChatCompletionRole;
export import ChatCompletionStreamOptions = API.ChatCompletionStreamOptions;
export import ChatCompletionSystemMessageParam = API.ChatCompletionSystemMessageParam;
export import ChatCompletionTokenLogprob = API.ChatCompletionTokenLogprob;
export import ChatCompletionTool = API.ChatCompletionTool;
export import ChatCompletionToolChoiceOption = API.ChatCompletionToolChoiceOption;
export import ChatCompletionToolMessageParam = API.ChatCompletionToolMessageParam;
export import ChatCompletionUserMessageParam = API.ChatCompletionUserMessageParam;
export import ChatCompletionCreateParams = API.ChatCompletionCreateParams;
export import ChatCompletionCreateParamsNonStreaming = API.ChatCompletionCreateParamsNonStreaming;
export import ChatCompletionCreateParamsStreaming = API.ChatCompletionCreateParamsStreaming;
export import Embeddings = API.Embeddings;
export import CreateEmbeddingResponse = API.CreateEmbeddingResponse;
export import Embedding = API.Embedding;
export import EmbeddingModel = API.EmbeddingModel;
export import EmbeddingCreateParams = API.EmbeddingCreateParams;
export import Files = API.Files;
export import FileContent = API.FileContent;
export import FileDeleted = API.FileDeleted;
export import FileObject = API.FileObject;
export import FilePurpose = API.FilePurpose;
export import FileObjectsPage = API.FileObjectsPage;
export import FileCreateParams = API.FileCreateParams;
export import FileListParams = API.FileListParams;
export import Images = API.Images;
export import Image = API.Image;
export import ImageModel = API.ImageModel;
export import ImagesResponse = API.ImagesResponse;
export import ImageCreateVariationParams = API.ImageCreateVariationParams;
export import ImageEditParams = API.ImageEditParams;
export import ImageGenerateParams = API.ImageGenerateParams;
export import Audio = API.Audio;
export import AudioModel = API.AudioModel;
export import AudioResponseFormat = API.AudioResponseFormat;
export import Moderations = API.Moderations;
export import Moderation = API.Moderation;
export import ModerationImageURLInput = API.ModerationImageURLInput;
export import ModerationModel = API.ModerationModel;
export import ModerationMultiModalInput = API.ModerationMultiModalInput;
export import ModerationTextInput = API.ModerationTextInput;
export import ModerationCreateResponse = API.ModerationCreateResponse;
export import ModerationCreateParams = API.ModerationCreateParams;
export import Models = API.Models;
export import Model = API.Model;
export import ModelDeleted = API.ModelDeleted;
export import ModelsPage = API.ModelsPage;
export import FineTuning = API.FineTuning;
export import Beta = API.Beta;
export import Batches = API.Batches;
export import Batch = API.Batch;
export import BatchError = API.BatchError;
export import BatchRequestCounts = API.BatchRequestCounts;
export import BatchesPage = API.BatchesPage;
export import BatchCreateParams = API.BatchCreateParams;
export import BatchListParams = API.BatchListParams;
export import Uploads = API.Uploads;
export import Upload = API.Upload;
export import UploadCreateParams = API.UploadCreateParams;
export import UploadCompleteParams = API.UploadCompleteParams;
export import ErrorObject = API.ErrorObject;
export import FunctionDefinition = API.FunctionDefinition;
export import FunctionParameters = API.FunctionParameters;
export import ResponseFormatJSONObject = API.ResponseFormatJSONObject;
export import ResponseFormatJSONSchema = API.ResponseFormatJSONSchema;
export import ResponseFormatText = API.ResponseFormatText;
export { type CursorPageParams as CursorPageParams, type CursorPageResponse as CursorPageResponse };
export { Completions as Completions, type Completion as Completion, type CompletionChoice as CompletionChoice, type CompletionUsage as CompletionUsage, type CompletionCreateParams as CompletionCreateParams, type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, };
export { Chat as Chat, type ChatModel as ChatModel, type ChatCompletion as ChatCompletion, type ChatCompletionAssistantMessageParam as ChatCompletionAssistantMessageParam, type ChatCompletionAudio as ChatCompletionAudio, type ChatCompletionAudioParam as ChatCompletionAudioParam, type ChatCompletionChunk as ChatCompletionChunk, type ChatCompletionContentPart as ChatCompletionContentPart, type ChatCompletionContentPartImage as ChatCompletionContentPartImage, type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, type ChatCompletionContentPartText as ChatCompletionContentPartText, type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, type ChatCompletionMessage as ChatCompletionMessage, type ChatCompletionMessageParam as ChatCompletionMessageParam, type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall, type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent as ChatCompletionPredictionContent, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, type ChatCompletionTool as ChatCompletionTool, type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, type ChatCompletionCreateParams as ChatCompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, };
export { Embeddings as Embeddings, type CreateEmbeddingResponse as CreateEmbeddingResponse, type Embedding as Embedding, type EmbeddingModel as EmbeddingModel, type EmbeddingCreateParams as EmbeddingCreateParams, };
export { Files as Files, type FileContent as FileContent, type FileDeleted as FileDeleted, type FileObject as FileObject, type FilePurpose as FilePurpose, FileObjectsPage as FileObjectsPage, type FileCreateParams as FileCreateParams, type FileListParams as FileListParams, };
export { Images as Images, type Image as Image, type ImageModel as ImageModel, type ImagesResponse as ImagesResponse, type ImageCreateVariationParams as ImageCreateVariationParams, type ImageEditParams as ImageEditParams, type ImageGenerateParams as ImageGenerateParams, };
export { Audio as Audio, type AudioModel as AudioModel, type AudioResponseFormat as AudioResponseFormat };
export { Moderations as Moderations, type Moderation as Moderation, type ModerationImageURLInput as ModerationImageURLInput, type ModerationModel as ModerationModel, type ModerationMultiModalInput as ModerationMultiModalInput, type ModerationTextInput as ModerationTextInput, type ModerationCreateResponse as ModerationCreateResponse, type ModerationCreateParams as ModerationCreateParams, };
export { Models as Models, type Model as Model, type ModelDeleted as ModelDeleted, ModelsPage as ModelsPage, };
export { FineTuning as FineTuning };
export { Beta as Beta };
export { Batches as Batches, type Batch as Batch, type BatchError as BatchError, type BatchRequestCounts as BatchRequestCounts, BatchesPage as BatchesPage, type BatchCreateParams as BatchCreateParams, type BatchListParams as BatchListParams, };
export { UploadsAPIUploads as Uploads, type Upload as Upload, type UploadCreateParams as UploadCreateParams, type UploadCompleteParams as UploadCompleteParams, };
export type ErrorObject = API.ErrorObject;
export type FunctionDefinition = API.FunctionDefinition;
export type FunctionParameters = API.FunctionParameters;
export type ResponseFormatJSONObject = API.ResponseFormatJSONObject;
export type ResponseFormatJSONSchema = API.ResponseFormatJSONSchema;
export type ResponseFormatText = API.ResponseFormatText;
}
/** API Client for interfacing with the Azure OpenAI API. */
export interface AzureClientOptions extends ClientOptions {
Expand Down
21 changes: 21 additions & 0 deletions openai-types/internal/decoders/line.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined;
/**
* A re-implementation of httpx's `LineDecoder` in Python that handles incrementally
* reading lines from text.
*
* https://github.com/encode/httpx/blob/920333ea98118e9cf617f246905d7b202510941c/httpx/_decoders.py#L258
*/
export declare class LineDecoder {
static NEWLINE_CHARS: Set<string>;
static NEWLINE_REGEXP: RegExp;
buffer: string[];
trailingCR: boolean;
textDecoder: any;
constructor();
decode(chunk: Bytes): string[];
decodeText(bytes: Bytes): string;
flush(): string[];
}
export {};
//# sourceMappingURL=line.d.ts.map
6 changes: 3 additions & 3 deletions openai-types/lib/AbstractChatCompletionRunner.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Core from '../core.js';
import { type CompletionUsage } from '../resources/completions.js';
import { type ChatCompletion, type ChatCompletionMessage, type ChatCompletionMessageParam, type ChatCompletionCreateParams } from '../resources/chat/completions.js';
import * as Core from "../core.js";
import { type CompletionUsage } from "../resources/completions.js";
import { type ChatCompletion, type ChatCompletionMessage, type ChatCompletionMessageParam, type ChatCompletionCreateParams } from "../resources/chat/completions.js";
import { type BaseFunctionsArgs } from "./RunnableFunction.js";
import { ChatCompletionFunctionRunnerParams, ChatCompletionToolRunnerParams } from "./ChatCompletionRunner.js";
import { ChatCompletionStreamingFunctionRunnerParams, ChatCompletionStreamingToolRunnerParams } from "./ChatCompletionStreamingRunner.js";
Expand Down
17 changes: 8 additions & 9 deletions openai-types/lib/AssistantStream.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { Message, Text, ImageFile, TextDelta, Messages } from '../resources/beta/threads/messages.js';
import * as Core from '../core.js';
import { RequestOptions } from '../core.js';
import { Run, RunCreateParamsBase, Runs, RunSubmitToolOutputsParamsBase } from '../resources/beta/threads/runs/runs.js';
import { type ReadableStream } from '../_shims/index.js';
import { AssistantStreamEvent } from '../resources/beta/assistants.js';
import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from '../resources/beta/threads/runs/steps.js';
import { ThreadCreateAndRunParamsBase, Threads } from '../resources/beta/threads/threads.js';
import { Message, Text, ImageFile, TextDelta, MessageDelta } from "../resources/beta/threads/messages.js";
import * as Core from "../core.js";
import { RequestOptions } from "../core.js";
import { Run, RunCreateParamsBase, Runs, RunSubmitToolOutputsParamsBase } from "../resources/beta/threads/runs/runs.js";
import { type ReadableStream } from "../_shims/index.js";
import { AssistantStreamEvent } from "../resources/beta/assistants.js";
import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from "../resources/beta/threads/runs/steps.js";
import { ThreadCreateAndRunParamsBase, Threads } from "../resources/beta/threads/threads.js";
import { BaseEvents, EventStream } from "./EventStream.js";
import MessageDelta = Messages.MessageDelta;
export interface AssistantStreamEvents extends BaseEvents {
run: (run: Run) => void;
messageCreated: (message: Message) => void;
Expand Down
Loading

0 comments on commit dcd9cd3

Please sign in to comment.