Check if all requirements for Anthropic count_tokens() are met.
Helper function to validate AWS credentials and create an AWS client.
Get the number of tokens in a string of text.
Get the token IDs for a string of text.
Check if the thinking parameter is enabled in the request.
Trim trailing whitespace from final AIMessage content.
Convert a list of messages to a prompt for llama.
Convert a list of messages to a prompt for Llama 3.
Convert a list of messages to a prompt for Llama 4.
Format a list of messages into a full prompt for the Anthropic model Args: messages (List[BaseMessage]): List of BaseMessage to combine. human_prompt (str, optional): Human prompt tag. Defaults to "
Human:". ai_prompt (str, optional): AI prompt tag. Defaults to "
Assistant:". Returns: str: Combined string with necessary human_prompt and ai_prompt tags.
Convert a list of messages to a prompt for mistral.
Convert a list of messages to a prompt for DeepSeek-R1.
Convert a list of messages to a prompt for Writer.
Convert a list of messages to a Harmony format prompt for OpenAI API.
Bedrock chat model integration built on the Bedrock converse API.
This implementation will eventually replace the existing ChatBedrock implementation once the Bedrock converse API has feature parity with older Bedrock API. Specifically the converse API does not yet support custom Bedrock models.
Base class for Bedrock models.
Adapter class to prepare the inputs from Langchain to prompt format that Chat model expects.
A chat model that uses the Bedrock API.