Skip to content

Commit

Permalink
chore(types): improve type name for embedding models (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Sep 19, 2024
1 parent 9ac1170 commit bf374b8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Types:

- <code><a href="./src/resources/embeddings.ts">CreateEmbeddingResponse</a></code>
- <code><a href="./src/resources/embeddings.ts">Embedding</a></code>
- <code><a href="./src/resources/embeddings.ts">EmbeddingModel</a></code>

Methods:

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion src/resources/embeddings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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;
}
8 changes: 7 additions & 1 deletion src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bf374b8

Please sign in to comment.