-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom dimension support for OpenAI embeddings.
- Loading branch information
Showing
4 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
examples/basic/src/model-provider/openai/openai-embed-many-custom-dimensions-example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import dotenv from "dotenv"; | ||
import { embedMany, openai } from "modelfusion"; | ||
|
||
dotenv.config(); | ||
|
||
async function main() { | ||
const embeddings = await embedMany({ | ||
model: openai.TextEmbedder({ | ||
model: "text-embedding-3-large", | ||
dimensions: 256, | ||
}), | ||
values: [ | ||
"At first, Nox didn't know what to do with the pup.", | ||
"He keenly observed and absorbed everything around him, from the birds in the sky to the trees in the forest.", | ||
], | ||
}); | ||
|
||
console.log(embeddings); | ||
} | ||
|
||
main().catch(console.error); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters