Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(types): improve type name for embedding models #1089

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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