Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryCallbacksChat loadersProvidersAnthropicOn this pageAnthropicAll functionality related to Anthropic models.Anthropic is an AI safety and research company, and is the creator of Claude.
This page covers all integrations between Anthropic models and LangChain.Prompting Overview‚ÄãClaude is chat-based model, meaning it is trained on conversation data.
However, it is a text based API, meaning it takes in single string.
It expects this string to be in a particular format.
This means that it is up the user to ensure that is the case.
LangChain provides several utilities and helper functions to make sure prompts that you write -
whether formatted as a string or as a list of messages - end up formatted correctly.Specifically, Claude is trained to fill in text for the Assistant role as part of an ongoing dialogue
between a human user (Human:) and an AI assistant (Assistant:). Prompts sent via the API must contain
\n\nHuman: and \n\nAssistant: as the signals of who's speaking.
The final turn must always be \n\nAssistant: - the input string cannot have \n\nHuman: as the final role.Because Claude is chat-based but accepts a string as input, it can be treated as either a LangChain ChatModel or LLM.
This means there are two wrappers in LangChain - ChatAnthropic and Anthropic.
It is generally recommended to use the ChatAnthropic wrapper, and format your prompts as ChatMessages (we will show examples of this below).
This is because it keeps your prompt in a general format that you can easily then also use with other models (should you want to).
All functionality related to Anthropic models.
All functionality related to Anthropic models. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAgents and toolkitsMemoryCallbacksChat loadersProvidersAnthropicOn this pageAnthropicAll functionality related to Anthropic models.Anthropic is an AI safety and research company, and is the creator of Claude.
This page covers all integrations between Anthropic models and LangChain.Prompting Overview‚ÄãClaude is chat-based model, meaning it is trained on conversation data.
However, it is a text based API, meaning it takes in single string.
It expects this string to be in a particular format.
This means that it is up the user to ensure that is the case.
LangChain provides several utilities and helper functions to make sure prompts that you write -
whether formatted as a string or as a list of messages - end up formatted correctly.Specifically, Claude is trained to fill in text for the Assistant role as part of an ongoing dialogue
between a human user (Human:) and an AI assistant (Assistant:). Prompts sent via the API must contain
\n\nHuman: and \n\nAssistant: as the signals of who's speaking.
The final turn must always be \n\nAssistant: - the input string cannot have \n\nHuman: as the final role.Because Claude is chat-based but accepts a string as input, it can be treated as either a LangChain ChatModel or LLM.
This means there are two wrappers in LangChain - ChatAnthropic and Anthropic.
It is generally recommended to use the ChatAnthropic wrapper, and format your prompts as ChatMessages (we will show examples of this below).
This is because it keeps your prompt in a general format that you can easily then also use with other models (should you want to).