Skip to content

Commit

Permalink
feat: update openai-types and descriptions for ChatMessage type
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Aug 20, 2024
1 parent 47ac95f commit b8adb63
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 73 deletions.
8 changes: 4 additions & 4 deletions openai-types/_vendor/zod-to-json-schema/Options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ export type DateStrategy = 'format:date-time' | 'format:date' | 'string' | 'inte
export declare const ignoreOverride: unique symbol;
export type Options<Target extends Targets = 'jsonSchema7'> = {
name: string | undefined;
$refStrategy: 'root' | 'relative' | 'none' | 'seen';
$refStrategy: 'root' | 'relative' | 'none' | 'seen' | 'extract-to-root';
basePath: string[];
effectStrategy: 'input' | 'any';
pipeStrategy: 'input' | 'output' | 'all';
dateStrategy: DateStrategy | DateStrategy[];
mapStrategy: 'entries' | 'record';
removeAdditionalStrategy: 'passthrough' | 'strict';
nullableStrategy: 'from-target' | 'property';
target: Target;
strictUnions: boolean;
definitionPath: string;
definitions: Record<string, ZodSchema>;
definitions: Record<string, ZodSchema | ZodTypeDef>;
errorMessages: boolean;
markdownDescription: boolean;
patternStrategy: 'escape' | 'preserve';
applyRegexFlags: boolean;
emailStrategy: 'format:email' | 'format:idn-email' | 'pattern:zod';
base64Strategy: 'format:binary' | 'contentEncoding:base64' | 'pattern:zod';
nameStrategy: 'ref' | 'title';
nameStrategy: 'ref' | 'duplicate-ref' | 'title';
override?: (def: ZodTypeDef, refs: Refs, seen: Seen | undefined, forceResolution?: boolean) => JsonSchema7Type | undefined | typeof ignoreOverride;
openaiStrictMode?: boolean;
};
export declare const defaultOptions: Options;
export declare const getDefaultOptions: <Target extends Targets>(options: string | Partial<Options<Target>> | undefined) => Options<Target>;
//# sourceMappingURL=Options.d.ts.map
8 changes: 7 additions & 1 deletion openai-types/_vendor/zod-to-json-schema/Refs.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import { ZodTypeDef } from 'zod';
import type { ZodTypeDef } from 'zod';
import { Options, Targets } from "./Options.js";
import { JsonSchema7Type } from "./parseDef.js";
export type Refs = {
seen: Map<ZodTypeDef, Seen>;
/**
* Set of all the `$ref`s we created, e.g. `Set(['#/$defs/ui'])`
* this notable does not include any `definitions` that were
* explicitly given as an option.
*/
seenRefs: Set<string>;
currentPath: string[];
propertyPath: string[] | undefined;
} & Options<Targets>;
Expand Down
4 changes: 4 additions & 0 deletions openai-types/_vendor/zod-to-json-schema/util.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { ZodSchema, ZodTypeDef } from 'zod';
export declare const zodDef: (zodSchema: ZodSchema | ZodTypeDef) => ZodTypeDef;
export declare function isEmptyObj(obj: Object | null | undefined): boolean;
//# sourceMappingURL=util.d.ts.map
1 change: 1 addition & 0 deletions openai-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ export declare namespace OpenAI {
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;
Expand Down
12 changes: 0 additions & 12 deletions openai-types/resources/beta/threads/threads.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,6 @@ export declare class Threads extends APIResource {
*/
createAndRunStream(body: ThreadCreateAndRunParamsBaseStream, options?: Core.RequestOptions): AssistantStream;
}
/**
<<<<<<< HEAD
* An object describing the expected output of the model. If `json_object` or
* `json_schema`, only `function` type `tools` are allowed to be passed to the Run.
* If `text` the model can return text or any value needed.
*/
export interface AssistantResponseFormat {
/**
* Must be one of `text`, `json_object` or `json_schema`.
*/
type?: 'text' | 'json_object' | 'json_schema';
}
/**
* Specifies the format that the model must output. Compatible with
* [GPT-4o](https://platform.openai.com/docs/models/gpt-4o),
Expand Down
2 changes: 1 addition & 1 deletion openai-types/resources/chat/chat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as CompletionsAPI from "./completions.js";
export declare class Chat extends APIResource {
completions: CompletionsAPI.Completions;
}
export type ChatModel = 'gpt-4o' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-05-13' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-0125-preview' | 'gpt-4-turbo-preview' | 'gpt-4-1106-preview' | 'gpt-4-vision-preview' | 'gpt-4' | 'gpt-4-0314' | 'gpt-4-0613' | 'gpt-4-32k' | 'gpt-4-32k-0314' | 'gpt-4-32k-0613' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-16k' | 'gpt-3.5-turbo-0301' | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-16k-0613';
export type ChatModel = 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-0125-preview' | 'gpt-4-turbo-preview' | 'gpt-4-1106-preview' | 'gpt-4-vision-preview' | 'gpt-4' | 'gpt-4-0314' | 'gpt-4-0613' | 'gpt-4-32k' | 'gpt-4-32k-0314' | 'gpt-4-32k-0613' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-16k' | 'gpt-3.5-turbo-0301' | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-16k-0613';
export declare namespace Chat {
export import ChatModel = ChatAPI.ChatModel;
export import Completions = CompletionsAPI.Completions;
Expand Down
7 changes: 6 additions & 1 deletion openai-types/resources/chat/completions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export interface ChatCompletionMessage {
* @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of
* a function that should be called, as generated by the model.
*/
function_call?: ChatCompletionMessage.FunctionCall;
function_call?: ChatCompletionMessage.FunctionCall | null;
/**
* The tool calls generated by the model, such as function calls.
*/
Expand Down Expand Up @@ -689,6 +689,11 @@ export interface ChatCompletionCreateParamsBase {
* [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and
* all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`.
*
* Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured
* Outputs which guarantees 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 guarantees the
* message the model generates is valid JSON.
*
Expand Down
14 changes: 13 additions & 1 deletion openai-types/resources/files.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ export interface FileObject {
*/
status_details?: string;
}
/**
* The intended purpose of the uploaded file.
*
* Use "assistants" for
* [Assistants](https://platform.openai.com/docs/api-reference/assistants) and
* [Message](https://platform.openai.com/docs/api-reference/messages) files,
* "vision" for Assistants image file inputs, "batch" for
* [Batch API](https://platform.openai.com/docs/guides/batch), and "fine-tune" for
* [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning).
*/
export type FilePurpose = 'assistants' | 'batch' | 'fine-tune' | 'vision';
export interface FileCreateParams {
/**
* The File object (not file name) to be uploaded.
Expand All @@ -126,7 +137,7 @@ export interface FileCreateParams {
* [Batch API](https://platform.openai.com/docs/guides/batch), and "fine-tune" for
* [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning).
*/
purpose: 'assistants' | 'batch' | 'fine-tune' | 'vision';
purpose: FilePurpose;
}
export interface FileListParams {
/**
Expand All @@ -138,6 +149,7 @@ export declare namespace Files {
export import FileContent = FilesAPI.FileContent;
export import FileDeleted = FilesAPI.FileDeleted;
export import FileObject = FilesAPI.FileObject;
export import FilePurpose = FilesAPI.FilePurpose;
export import FileObjectsPage = FilesAPI.FileObjectsPage;
export import FileCreateParams = FilesAPI.FileCreateParams;
export import FileListParams = FilesAPI.FileListParams;
Expand Down
2 changes: 1 addition & 1 deletion openai-types/resources/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export { Batch, BatchError, BatchRequestCounts, BatchCreateParams, BatchListPara
export { Beta } from "./beta/beta.js";
export { Completion, CompletionChoice, CompletionUsage, CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, Completions, } from "./completions.js";
export { CreateEmbeddingResponse, Embedding, EmbeddingCreateParams, Embeddings } from "./embeddings.js";
export { FileContent, FileDeleted, FileObject, FileCreateParams, FileListParams, FileObjectsPage, Files, } from "./files.js";
export { FileContent, FileDeleted, FileObject, FilePurpose, FileCreateParams, FileListParams, FileObjectsPage, Files, } from "./files.js";
export { FineTuning } from "./fine-tuning/fine-tuning.js";
export { Image, ImageModel, ImagesResponse, ImageCreateVariationParams, ImageEditParams, ImageGenerateParams, Images, } from "./images.js";
export { Model, ModelDeleted, ModelsPage, Models } from "./models.js";
Expand Down
2 changes: 1 addition & 1 deletion openai-types/resources/uploads/uploads.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export interface UploadCreateParams {
* See the
* [documentation on File purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose).
*/
purpose: 'assistants' | 'batch' | 'fine-tune' | 'vision';
purpose: FilesAPI.FilePurpose;
}
export interface UploadCompleteParams {
/**
Expand Down
2 changes: 1 addition & 1 deletion openai-types/version.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export declare const VERSION = "4.55.0";
export declare const VERSION = "4.56.0";
//# sourceMappingURL=version.d.ts.map
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
"@dexaai/eslint-config": "^1.3.0",
"eslint": "^8.57.0",
"np": "^10.0.7",
"openai": "^4.55.0",
"openai": "^4.56.0",
"prettier": "^3.3.3",
"rimraf": "^5.0.7",
"rimraf": "^6.0.1",
"typescript": "^5.5.3"
}
}
Loading

0 comments on commit b8adb63

Please sign in to comment.