Replies: 1 comment
-
Answer generated by a 🤖 AnswerHello, Yes, the question needs to be embedded in the Similarity Search, Retriever, and this process does consume tokens. In the LangChain framework, the async _getRelevantDocuments(
query: string,
runManager?: CallbackManagerForRetrieverRun
): Promise<Document[]> {
const searchResults = await this.hybridSearch(
query,
this.similarityK,
this.keywordK,
runManager?.getChild("hybrid_search")
);
return searchResults.map(([doc]) => doc);
} In this code, the question is converted into a query that can be used to retrieve documents. This process of converting the question into a query consumes tokens. The As for the number of tokens consumed in the process of embedding a question, in the context shared, the number of tokens consumed is 768. This is evident from the test case for HuggingFaceInferenceEmbeddings where the length of the queryEmbedding is checked to be 768. const queryEmbedding = await embeddings.embedQuery(documents[0]);
expect(queryEmbedding).toHaveLength(768); I hope this answers your question. If you have any more questions, feel free to ask. Best, Sources
This response is meant to be useful, save you time, and share context. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Beta Was this translation helpful? Give feedback.
All reactions