Skip to content

Commit

Permalink
Merge pull request #357 from openai/release-please--branches--master-…
Browse files Browse the repository at this point in the history
…-changes--next--components--openai

release: 4.12.0
  • Loading branch information
schnerd authored Oct 11, 2023
2 parents 656cdf1 + 946fa89 commit 1d0456c
Show file tree
Hide file tree
Showing 28 changed files with 254 additions and 218 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.11.1"
".": "4.12.0"
}
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 4.12.0 (2023-10-11)

Full Changelog: [v4.11.1...v4.12.0](https://github.com/openai/openai-node/compare/v4.11.1...v4.12.0)

### Features

* **api:** remove `content_filter` stop_reason and update documentation ([#352](https://github.com/openai/openai-node/issues/352)) ([a4b401e](https://github.com/openai/openai-node/commit/a4b401e91a0b3fbf55aedfb6ed6d93396377bf27))
* re-export chat completion types at the top level, and work around webpack limitations ([#365](https://github.com/openai/openai-node/issues/365)) ([bb815d0](https://github.com/openai/openai-node/commit/bb815d0373ae33f58329e34e8983f5b3881db22d))


### Bug Fixes

* prevent ReferenceError, update compatibility to ES2020 and Node 18+ ([#356](https://github.com/openai/openai-node/issues/356)) ([fc71a4b](https://github.com/openai/openai-node/commit/fc71a4b6b73208ff3e8f0c8792a9a03e3790d26b))


### Chores

* **internal:** minor formatting improvement ([#354](https://github.com/openai/openai-node/issues/354)) ([3799863](https://github.com/openai/openai-node/commit/3799863da4ff2a27940ef0b7e57360c72e44d986))

## 4.11.1 (2023-10-03)

Full Changelog: [v4.11.0...v4.11.1](https://github.com/openai/openai-node/compare/v4.11.0...v4.11.1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ TypeScript >= 4.5 is supported.

The following runtimes are supported:

- Node.js 16 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
- Deno v1.28.0 or higher, using `import OpenAI from "npm:openai"`.
- Bun 1.0 or later.
- Cloudflare Workers.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openai",
"version": "4.11.1",
"version": "4.12.0",
"description": "Client library for the OpenAI API",
"author": "OpenAI <support@openai.com>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -82,6 +82,7 @@
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "eslint --ext ts,js .",
"fix": "eslint --fix --ext ts,js ."
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/_shims/node-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ async function getMultipartRequestOptions<T extends {} = Record<string, unknown>
export function getRuntime(): Shims {
// Polyfill global object if needed.
if (typeof AbortController === 'undefined') {
// @ts-ignore
AbortController = AbortControllerPolyfill;
// @ts-expect-error (the types are subtly different, but compatible in practice)
globalThis.AbortController = AbortControllerPolyfill;
}
return {
kind: 'node',
Expand Down
74 changes: 41 additions & 33 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import * as Core from './core';
import * as Pagination from './pagination';
import * as API from './resources/index';
import * as Errors from './error';
import { type Agent } from './_shims/index';
import * as Uploads from './uploads';
import * as API from 'openai/resources/index';

export interface ClientOptions {
/**
Expand Down Expand Up @@ -213,61 +213,69 @@ export namespace OpenAI {
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 type Completion = API.Completion;
export type CompletionChoice = API.CompletionChoice;
export type CompletionUsage = API.CompletionUsage;
export type CompletionCreateParams = API.CompletionCreateParams;
export type CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
export type CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;

export import Chat = API.Chat;
export type ChatCompletion = API.ChatCompletion;
export type ChatCompletionChunk = API.ChatCompletionChunk;
export type ChatCompletionMessage = API.ChatCompletionMessage;
export type ChatCompletionMessageParam = API.ChatCompletionMessageParam;
export type ChatCompletionRole = API.ChatCompletionRole;
export type ChatCompletionCreateParams = API.ChatCompletionCreateParams;
export type ChatCompletionCreateParamsNonStreaming = API.ChatCompletionCreateParamsNonStreaming;
export type ChatCompletionCreateParamsStreaming = API.ChatCompletionCreateParamsStreaming;

export import Edits = API.Edits;
export import Edit = API.Edit;
export import EditCreateParams = API.EditCreateParams;
export type Edit = API.Edit;
export type EditCreateParams = API.EditCreateParams;

export import Embeddings = API.Embeddings;
export import CreateEmbeddingResponse = API.CreateEmbeddingResponse;
export import Embedding = API.Embedding;
export import EmbeddingCreateParams = API.EmbeddingCreateParams;
export type CreateEmbeddingResponse = API.CreateEmbeddingResponse;
export type Embedding = API.Embedding;
export type EmbeddingCreateParams = API.EmbeddingCreateParams;

export import Files = API.Files;
export import FileContent = API.FileContent;
export import FileDeleted = API.FileDeleted;
export import FileObject = API.FileObject;
export type FileContent = API.FileContent;
export type FileDeleted = API.FileDeleted;
export type FileObject = API.FileObject;
export import FileObjectsPage = API.FileObjectsPage;
export import FileCreateParams = API.FileCreateParams;
export type FileCreateParams = API.FileCreateParams;

export import Images = API.Images;
export import Image = API.Image;
export import ImagesResponse = API.ImagesResponse;
export import ImageCreateVariationParams = API.ImageCreateVariationParams;
export import ImageEditParams = API.ImageEditParams;
export import ImageGenerateParams = API.ImageGenerateParams;
export type Image = API.Image;
export type ImagesResponse = API.ImagesResponse;
export type ImageCreateVariationParams = API.ImageCreateVariationParams;
export type ImageEditParams = API.ImageEditParams;
export type ImageGenerateParams = API.ImageGenerateParams;

export import Audio = API.Audio;

export import Moderations = API.Moderations;
export import Moderation = API.Moderation;
export import ModerationCreateResponse = API.ModerationCreateResponse;
export import ModerationCreateParams = API.ModerationCreateParams;
export type Moderation = API.Moderation;
export type ModerationCreateResponse = API.ModerationCreateResponse;
export type ModerationCreateParams = API.ModerationCreateParams;

export import Models = API.Models;
export import Model = API.Model;
export import ModelDeleted = API.ModelDeleted;
export type Model = API.Model;
export type ModelDeleted = API.ModelDeleted;
export import ModelsPage = API.ModelsPage;

export import FineTuning = API.FineTuning;

export import FineTunes = API.FineTunes;
export import FineTune = API.FineTune;
export import FineTuneEvent = API.FineTuneEvent;
export import FineTuneEventsListResponse = API.FineTuneEventsListResponse;
export type FineTune = API.FineTune;
export type FineTuneEvent = API.FineTuneEvent;
export type FineTuneEventsListResponse = API.FineTuneEventsListResponse;
export import FineTunesPage = API.FineTunesPage;
export import FineTuneCreateParams = API.FineTuneCreateParams;
export import FineTuneListEventsParams = API.FineTuneListEventsParams;
export import FineTuneListEventsParamsNonStreaming = API.FineTuneListEventsParamsNonStreaming;
export import FineTuneListEventsParamsStreaming = API.FineTuneListEventsParamsStreaming;
export type FineTuneCreateParams = API.FineTuneCreateParams;
export type FineTuneListEventsParams = API.FineTuneListEventsParams;
export type FineTuneListEventsParamsNonStreaming = API.FineTuneListEventsParamsNonStreaming;
export type FineTuneListEventsParamsStreaming = API.FineTuneListEventsParamsStreaming;
}

export default OpenAI;
6 changes: 3 additions & 3 deletions src/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ export interface PageResponse<Item> {
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
*/
export class Page<Item> extends AbstractPage<Item> implements PageResponse<Item> {
object: string;

data: Array<Item>;

object: string;

constructor(client: APIClient, response: Response, body: PageResponse<Item>, options: FinalRequestOptions) {
super(client, response, body, options);

this.object = body.object;
this.data = body.data;
this.object = body.object;
}

getPaginatedItems(): Item[] {
Expand Down
22 changes: 10 additions & 12 deletions src/resources/audio/audio.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
// File generated from our OpenAPI spec by Stainless.

import { APIResource } from 'openai/resource';
import { Transcriptions } from './transcriptions';
import { Translations } from './translations';
import * as API from './index';
import * as TranscriptionsAPI from 'openai/resources/audio/transcriptions';
import * as TranslationsAPI from 'openai/resources/audio/translations';

export class Audio extends APIResource {
transcriptions: Transcriptions = new Transcriptions(this.client);
translations: Translations = new Translations(this.client);
transcriptions: TranscriptionsAPI.Transcriptions = new TranscriptionsAPI.Transcriptions(this.client);
translations: TranslationsAPI.Translations = new TranslationsAPI.Translations(this.client);
}

export namespace Audio {
export import Transcriptions = API.Transcriptions;
export import Transcription = API.Transcription;
export import TranscriptionCreateParams = API.TranscriptionCreateParams;

export import Translations = API.Translations;
export import Translation = API.Translation;
export import TranslationCreateParams = API.TranslationCreateParams;
export import Transcriptions = TranscriptionsAPI.Transcriptions;
export type Transcription = TranscriptionsAPI.Transcription;
export type TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
export import Translations = TranslationsAPI.Translations;
export type Translation = TranslationsAPI.Translation;
export type TranslationCreateParams = TranslationsAPI.TranslationCreateParams;
}
6 changes: 3 additions & 3 deletions src/resources/audio/transcriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as Core from 'openai/core';
import { APIResource } from 'openai/resource';
import * as API from './index';
import * as TranscriptionsAPI from 'openai/resources/audio/transcriptions';
import { type Uploadable, multipartFormRequestOptions } from 'openai/core';

export class Transcriptions extends APIResource {
Expand Down Expand Up @@ -62,6 +62,6 @@ export interface TranscriptionCreateParams {
}

export namespace Transcriptions {
export import Transcription = API.Transcription;
export import TranscriptionCreateParams = API.TranscriptionCreateParams;
export type Transcription = TranscriptionsAPI.Transcription;
export type TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
}
6 changes: 3 additions & 3 deletions src/resources/audio/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as Core from 'openai/core';
import { APIResource } from 'openai/resource';
import * as API from './index';
import * as TranslationsAPI from 'openai/resources/audio/translations';
import { type Uploadable, multipartFormRequestOptions } from 'openai/core';

export class Translations extends APIResource {
Expand Down Expand Up @@ -55,6 +55,6 @@ export interface TranslationCreateParams {
}

export namespace Translations {
export import Translation = API.Translation;
export import TranslationCreateParams = API.TranslationCreateParams;
export type Translation = TranslationsAPI.Translation;
export type TranslationCreateParams = TranslationsAPI.TranslationCreateParams;
}
31 changes: 15 additions & 16 deletions src/resources/chat/chat.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
// File generated from our OpenAPI spec by Stainless.

import { APIResource } from 'openai/resource';
import { Completions } from './completions';
import * as API from './index';
import * as CompletionsAPI from 'openai/resources/chat/completions';

export class Chat extends APIResource {
completions: Completions = new Completions(this.client);
completions: CompletionsAPI.Completions = new CompletionsAPI.Completions(this.client);
}

export namespace Chat {
export import Completions = API.Completions;
export import ChatCompletion = API.ChatCompletion;
export import ChatCompletionChunk = API.ChatCompletionChunk;
export import ChatCompletionMessage = API.ChatCompletionMessage;
export import ChatCompletionMessageParam = API.ChatCompletionMessageParam;
export import ChatCompletionRole = API.ChatCompletionRole;
export import CreateChatCompletionRequestMessage = API.CreateChatCompletionRequestMessage;
export import ChatCompletionCreateParams = API.ChatCompletionCreateParams;
export import CompletionCreateParams = API.CompletionCreateParams;
export import ChatCompletionCreateParamsNonStreaming = API.ChatCompletionCreateParamsNonStreaming;
export import CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
export import ChatCompletionCreateParamsStreaming = API.ChatCompletionCreateParamsStreaming;
export import CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
export import Completions = CompletionsAPI.Completions;
export type ChatCompletion = CompletionsAPI.ChatCompletion;
export type ChatCompletionChunk = CompletionsAPI.ChatCompletionChunk;
export type ChatCompletionMessage = CompletionsAPI.ChatCompletionMessage;
export type ChatCompletionMessageParam = CompletionsAPI.ChatCompletionMessageParam;
export type ChatCompletionRole = CompletionsAPI.ChatCompletionRole;
export type CreateChatCompletionRequestMessage = CompletionsAPI.CreateChatCompletionRequestMessage;
export type ChatCompletionCreateParams = CompletionsAPI.ChatCompletionCreateParams;
export type CompletionCreateParams = CompletionsAPI.CompletionCreateParams;
export type ChatCompletionCreateParamsNonStreaming = CompletionsAPI.ChatCompletionCreateParamsNonStreaming;
export type CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming;
export type ChatCompletionCreateParamsStreaming = CompletionsAPI.ChatCompletionCreateParamsStreaming;
export type CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming;
}
Loading

0 comments on commit 1d0456c

Please sign in to comment.