Skip to content
Discussion options

You must be logged in to vote

🤖

Hello,

Thank you for your detailed question. It seems like you're looking for a way to more accurately calculate the prompt size in the LangChain framework, especially when using the stuff_chain method.

The StuffDocumentsChain class in LangChain combines documents by stuffing them into context. It formats each document into a string with the document_prompt and then joins them together with document_separator. This new string is added to the inputs with the variable name set by document_variable_name. These inputs are then passed to the llm_chain.

To calculate the prompt size more precisely, you can modify the prompt_length method in the StuffDocumentsChain class. This method currently …

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dosubot
Comment options

Comment options

You must be logged in to vote
1 reply
@dosubot
Comment options

Answer selected by RERobbins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant