Skip to content

Commit

Permalink
Baseline streaming and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterbryant committed Mar 1, 2024
1 parent 0ae3c8a commit 03329f5
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions src/lib/utilities/context.ts
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);
// };

0 comments on commit 03329f5

Please sign in to comment.