From bf374b89179781cc923a34ac0c4f4b6926ec27d8 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 19 Sep 2024 16:21:05 +0000
Subject: [PATCH] chore(types): improve type name for embedding models (#1089)
---
.stats.yml | 2 +-
api.md | 1 +
src/index.ts | 1 +
src/resources/embeddings.ts | 5 ++++-
src/resources/index.ts | 8 +++++++-
5 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 2fc39385e..0151c5a10 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 68
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-ff407aa10917e62f2b0c12d1ad2c4f1258ed083bd45753c70eaaf5b1cf8356ae.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-de1981b64ac229493473670d618500c6362c195f1057eb7de00bd1bc9184fbd5.yml
diff --git a/api.md b/api.md
index 7d8861b26..22aeb23e1 100644
--- a/api.md
+++ b/api.md
@@ -64,6 +64,7 @@ Types:
- CreateEmbeddingResponse
- Embedding
+- EmbeddingModel
Methods:
diff --git a/src/index.ts b/src/index.ts
index f19f8e6d3..9d8427d94 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -276,6 +276,7 @@ export namespace OpenAI {
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;
diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts
index f72b9308a..6d8e670a7 100644
--- a/src/resources/embeddings.ts
+++ b/src/resources/embeddings.ts
@@ -77,6 +77,8 @@ export interface Embedding {
object: 'embedding';
}
+export type EmbeddingModel = 'text-embedding-ada-002' | 'text-embedding-3-small' | 'text-embedding-3-large';
+
export interface EmbeddingCreateParams {
/**
* Input text to embed, encoded as a string or array of tokens. To embed multiple
@@ -96,7 +98,7 @@ export interface EmbeddingCreateParams {
* [Model overview](https://platform.openai.com/docs/models/overview) for
* descriptions of them.
*/
- model: (string & {}) | 'text-embedding-ada-002' | 'text-embedding-3-small' | 'text-embedding-3-large';
+ model: (string & {}) | EmbeddingModel;
/**
* The number of dimensions the resulting output embeddings should have. Only
@@ -121,5 +123,6 @@ export interface EmbeddingCreateParams {
export namespace Embeddings {
export import CreateEmbeddingResponse = EmbeddingsAPI.CreateEmbeddingResponse;
export import Embedding = EmbeddingsAPI.Embedding;
+ export import EmbeddingModel = EmbeddingsAPI.EmbeddingModel;
export import EmbeddingCreateParams = EmbeddingsAPI.EmbeddingCreateParams;
}
diff --git a/src/resources/index.ts b/src/resources/index.ts
index a78808584..68bd88a31 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -22,7 +22,13 @@ export {
CompletionCreateParamsStreaming,
Completions,
} from './completions';
-export { CreateEmbeddingResponse, Embedding, EmbeddingCreateParams, Embeddings } from './embeddings';
+export {
+ CreateEmbeddingResponse,
+ Embedding,
+ EmbeddingModel,
+ EmbeddingCreateParams,
+ Embeddings,
+} from './embeddings';
export {
FileContent,
FileDeleted,