Langchain Fundamentals
Langchain Fundamentals
You have static prompts, ki jo user ne diya wow sidha send kar diya apni
application ko
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
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….
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
The llm is informed about the constraints but they aren’t strictly enforced
Isliye they share functions like invoke and stuff, unko fir chain karna aasan hota
hai
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