Skip to content

Commit

Permalink
docs: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Anush008 committed Sep 19, 2023
1 parent 2c196c2 commit f02c422
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ const embeddingModel = await FlagEmbedding.init({

let documents = [
"passage: Hello, World!",
"query: Hello, World!", // these are two different embedding
"query: Hello, World!",
"passage: This is an example passage.",
//# You can leave out the prefix but it's recommended
// You can leave out the prefix but it's recommended
"fastembed-js is licensed under MIT"
];

const embeddings = embeddingModel.embed(documents, 2); //Optional batch size. Defaults to 256

for await (const batch of embeddings) {
// batch is list of Float32 embeddings(number[][])
// batch is list of Float32 embeddings(number[][]) with length 2
console.log(batch);
}

```

#### Supports passage and query embeddings for more accurate results
```ts
const embeddings = embeddingModel.passageEmbed(listOfLongTexts, 2); //Optional batch size. Defaults to 256
const embeddings = embeddingModel.passageEmbed(listOfLongTexts, 10); //Optional batch size. Defaults to 256

for await (const batch of embeddings) {
// batch is list of Float32 passage embeddings(number[][])
// batch is list of Float32 passage embeddings(number[][]) with length 10
console.log(batch);
}

Expand Down

0 comments on commit f02c422

Please sign in to comment.