From 76bcac5bb3c9a08cad62c1059ee9460e23f0d55d Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Fri, 3 Nov 2023 10:54:16 -0700 Subject: [PATCH] Remove admin prefix/suffix from docs for anthropic (#12849) --- docs/docs/integrations/platforms/anthropic.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/integrations/platforms/anthropic.mdx b/docs/docs/integrations/platforms/anthropic.mdx index a2ff69b836d..50c31148c45 100644 --- a/docs/docs/integrations/platforms/anthropic.mdx +++ b/docs/docs/integrations/platforms/anthropic.mdx @@ -85,11 +85,11 @@ model.convert_prompt(prompt_value) This produces the following formatted string: ``` -'\n\nHuman: You are a helpful chatbot\n\nHuman: Tell me a joke about bears\n\nAssistant:' +'\n\nYou are a helpful chatbot\n\nHuman: Tell me a joke about bears\n\nAssistant:' ``` -We can see that under the hood LangChain is representing `SystemMessage`s with `Human: ...`, -and is appending an assistant message to the end IF the last message is NOT already an assistant message. +We can see that under the hood LangChain is not appending any prefix/suffix to `SystemMessage`'s. This is because Anthropic has no concept of `SystemMessage`. +Anthropic requires all prompts to end with assistant messages. This means if the last message is not an assistant message, the suffix `Assistant:` will automatically be inserted. If you decide instead to use a normal PromptTemplate (one that just works on a single string) let's take a look at what happens: