Skip to content

Commit cf70dea

Browse files
feat(api): add embeddings encoding_format (#390)
1 parent ecabebc commit cf70dea

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/resources/embeddings.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ export interface EmbeddingCreateParams {
9797
*/
9898
model: (string & {}) | 'text-embedding-ada-002';
9999

100+
/**
101+
* The format to return the embeddings in. Can be either `float` or
102+
* [`base64`](https://pypi.org/project/pybase64/).
103+
*/
104+
encoding_format?: 'float' | 'base64';
105+
100106
/**
101107
* A unique identifier representing your end-user, which can help OpenAI to monitor
102108
* and detect abuse.

tests/api-resources/embeddings.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('resource embeddings', () => {
2727
const response = await openai.embeddings.create({
2828
input: 'The quick brown fox jumped over the lazy dog',
2929
model: 'text-embedding-ada-002',
30+
encoding_format: 'float',
3031
user: 'user-1234',
3132
});
3233
});

0 commit comments

Comments
 (0)