Skip to content
Snippets Groups Projects
Commit 7055d6fc authored by Marcus Schiesser's avatar Marcus Schiesser
Browse files

docs: add OpenAIEmbedding to examples

parent e9c2366b
No related branches found
No related tags found
No related merge requests found
import { OpenAI } from "llamaindex";
import { OpenAI, OpenAIEmbedding } from "llamaindex";
(async () => {
const llm = new OpenAI({ model: "gpt-4-1106-preview", temperature: 0.1 });
......@@ -12,4 +12,10 @@ import { OpenAI } from "llamaindex";
messages: [{ content: "Tell me a joke.", role: "user" }],
});
console.log(response2.message.content);
// embeddings
const embedModel = new OpenAIEmbedding();
const texts = ["hello", "world"];
const embeddings = await embedModel.getTextEmbeddingsBatch(texts);
console.log(`\nWe have ${embeddings.length} embeddings`);
})();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment