Sahas Profile picture
A definite pessimist. Makes software during the day. Secretly training at night with AI to become a superhero.
Jun 9, 2023 7 tweets 3 min read
Wrote my first custom chain in @LangChainAI as part of improving our AI search in stockinsights.ai

ModifyDocumentsChain adds additional context to docs retrieved from vectorstore based on the metadata and runs before StuffDocumentChain. This helps us #buildinpublic Image In many use cases, we would want to add more context to retrieved chunks from vectorstore such as @pinecone before passing to OpenAI to improve the GPT's accuracy.

ModifyDocumentsChain contains chunkModifier method that modifies the doc's content based on the metadata.