Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added stop sequence parameter to ChatBedrock model #290

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion libs/aws/langchain_aws/chat_models/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from langchain_core.runnables import Runnable, RunnableMap, RunnablePassthrough
from langchain_core.tools import BaseTool
from langchain_core.utils.pydantic import TypeBaseModel, is_basemodel_subclass
from pydantic import BaseModel, ConfigDict, model_validator
from pydantic import BaseModel, ConfigDict, Field, model_validator

from langchain_aws.chat_models.bedrock_converse import ChatBedrockConverse
from langchain_aws.function_calling import (
Expand Down Expand Up @@ -392,6 +392,12 @@ class ChatBedrock(BaseChatModel, BedrockBase):
"""Use the new Bedrock ``converse`` API which provides a standardized interface to
all Bedrock models. Support still in beta. See ChatBedrockConverse docs for more."""

stop_sequences: Optional[List[str]] = Field(default=None, alias="stop")
"""Stop sequence inference parameter from new Bedrock ``converse`` API providing
a sequence of characters that causes a model to stop generating a response. See
https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_InferenceConfiguration.html
for more."""

@property
def _llm_type(self) -> str:
"""Return type of chat model."""
Expand Down