Search

Tuesday 26 September 2023

LLMs vs chat models in LangChain

LLMs are models string as input and returns a string.

chat models are models which takes a list of messages as input and returns a message.

You will find this generic answer on langchain website.

Let's see what it actually means in code.

In this first example, both of these behave in the exact same way:

LLM:









Chat Model:











































Now to explain how chat models are different, look at the below example: