Skip to content

Commit

Permalink
✨ Add metadatas to embeddings
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-btc committed Jul 19, 2024
1 parent d5019a5 commit 04f450a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/embeddings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async function searchEmbeddings(
id: string,
input: string,
clientOptions: InputClientOptions = {},
): Promise<{ id: string; content: string; similarity: number }[]> {
): Promise<{ id: string; content: string; similarity: number; metadatas: Record<string, any> }[]> {
const { token, endpoint } = await defaultOptions(clientOptions);

try {
Expand Down Expand Up @@ -166,7 +166,11 @@ class Embeddings {
return this.memoryId;
}

async search(input: string): Promise<{ id: string; content: string; similarity: number }[]> {
async search(
input: string,
): Promise<
{ id: string; content: string; similarity: number; metadatas: Record<string, any> }[]
> {
const id = await this.memoryId;
return searchEmbeddings(id, input, await this.clientOptions);
}
Expand Down

0 comments on commit 04f450a

Please sign in to comment.