0% found this document useful (0 votes)
11 views4 pages

Langchain Fundamentals

The document discusses Langchain's capabilities for handling static and dynamic prompts, allowing users to generate structured outputs using Typed Dictionaries, Pydantic, or JSON Schemas. It emphasizes that while Langchain does not enforce types or constraints before LLM output generation, Pydantic is used for validation post-generation. Additionally, it covers the functionality of Runnable components and various text splitting and retrieval strategies to enhance data processing and diversity in outputs.

Uploaded by

nipun.yadav.ug23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

Langchain Fundamentals

The document discusses Langchain's capabilities for handling static and dynamic prompts, allowing users to generate structured outputs using Typed Dictionaries, Pydantic, or JSON Schemas. It emphasizes that while Langchain does not enforce types or constraints before LLM output generation, Pydantic is used for validation post-generation. Additionally, it covers the functionality of Runnable components and various text splitting and retrieval strategies to enhance data processing and diversity in outputs.

Uploaded by

nipun.yadav.ug23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Langchain

You have static prompts, ki jo user ne diya wow sidha send kar diya apni
application ko

Summarise the research paper named Attention is all you need

Or what the user can do is just specify the name and you can complete the rest
of the prompt(prompt templating?)- Dynamic Prompting

Structured Output
There are some LLMS that are capable of generating structured outputs, while
at the same time some aren’t

Langchain allows for the generation of structured output by both

You can used Typed Dictionaries, Pydantic or JSON Schemas as your default
structured output types

Typed Dictionaries aren’t zod, they just enforce or maybe give coding hints
during development.
It’s not raising type errors when i don’t align the data in concordance with the
types

Sirf representation ke liye hai typed dictionary, koi validation nahi hoti hai yahan
pe….

Use Pydantic for validation

When combingin pydantic with langchain, pydantic not only helps in specifiying
the description and defaults for attributes, it specifies constraints…. the llm
may disobey the constraints, but then langchain feeds the input into your
pydantic model and the validation kicks in, raising errors if any

LangChain doesn't enforce types or constraints before the LLM generates


output. It only validates them after — via Pydantic.

The llm is informed about the constraints but they aren’t strictly enforced

Runnables, all component classes inherit from an abstract runnable class,


abstraction, emthods same, definition alag alag and compulsory, be it template
components, llm components etc

Isliye they share functions like invoke and stuff, unko fir chain karna aasan hota
hai

Runnable Primitives: RunnableLambda, RunnableParallel, RunnablePassthrough


TextSplitters
Dekh CharacterTextSplitter jo hai it will break down based on a seperator
provided, it won’t break stuff down further, instead you’ll get messages like:
RecursiveTextSplitter let’s you specify a priority list to break down and even
recombine(if you’ve made them too atomic) text based on paragraphs, then on
lines, oh w

ait a minute too much? Let’s recombine some of these lines

Retrievers
Kabhi kabhi retrievers same documents ya redundant data fetch karte hain, ek
certain level of diversity incorporate karne ke liye we use this retrieval startegy:
MMR

MQR(Multi Query Retriever)


Ek query aint’ capturing in what the user really wants, create spinoff queries in
an attempt to introduce more diversity in fetched docs and expand onn that one
vague query

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy