-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ae3c8a
commit 03329f5
Showing
1 changed file
with
0 additions
and
36 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,36 +0,0 @@ | ||
// import { ScoredVector } from '@pinecone-database/pinecone'; | ||
// import { getEmbeddings } from './embeddings'; | ||
// import { getMatchesFromEmbeddings } from './pinecone'; | ||
|
||
// export type Metadata = { | ||
// url: string; | ||
// text: string; | ||
// chunk: string; | ||
// }; | ||
|
||
// // The function `getContext` is used to retrieve the context of a given message | ||
// export const getContext = async ( | ||
// message: string, | ||
// namespace: string, | ||
// maxTokens = 3000, | ||
// minScore = 0.7, | ||
// getOnlyText = true | ||
// ): Promise<string | ScoredVector[]> => { | ||
// // Get the embeddings of the input message | ||
// const embedding = await getEmbeddings(message); | ||
|
||
// // Retrieve the matches for the embeddings from the specified namespace | ||
// const matches = await getMatchesFromEmbeddings(embedding, 3, namespace); | ||
|
||
// // Filter out the matches that have a score lower than the minimum score | ||
// const qualifyingDocs = matches.filter((m) => m.score && m.score > minScore); | ||
|
||
// if (!getOnlyText) { | ||
// // Use a map to deduplicate matches by URL | ||
// return qualifyingDocs; | ||
// } | ||
|
||
// let docs = matches ? qualifyingDocs.map((match) => (match.metadata as Metadata).chunk) : []; | ||
// // Join all the chunks of text together, truncate to the maximum number of tokens, and return the result | ||
// return docs.join('\n').substring(0, maxTokens); | ||
// }; | ||