Skip to content

ChatBedrockConverse._converse_params() Rejects strict Parameter #775

@bharath-arcot-babu

Description

Package

langchain-aws

Checked other resources

  • I added a descriptive title to this issue
  • I searched the LangChain documentation with the integrated search
  • I used the GitHub search to find a similar issue and didn't find it
  • I am sure this is a bug and not a question or request for help

Example Code

from langchain_aws import ChatBedrockConverse
from langgraph.prebuilt import create_react_agent
from langchain.tools import tool

@tool
def example_tool(query: str) -> str:
    """Example tool."""
    return f"Result for {query}"

model = ChatBedrockConverse(
    model_id="anthropic.claude-3-5-sonnet-20240620-v1:0",
    region_name="us-east-1"
)

agent = create_react_agent(model, [example_tool])

# Trigger the error with streaming
async def test():
    async for event in agent.astream_events(
        {"messages": [{"role": "user", "content": "test"}]},
        config={"run_name": "test"}
    ):
        print(event)

# Run and get: TypeError: ChatBedrockConverse._converse_params() got an unexpected keyword argument 'strict'

Error Message and Stack Trace (if applicable)

Description

Summary
ChatBedrockConverse from langchain-aws 1.0.3 fails during agent streaming with a TypeError when LangChain-core attempts to pass the strict parameter for structured output support.

Error
TypeError: ChatBedrockConverse._converse_params() got an unexpected keyword argument 'strict'
Full Traceback Context:

Triggered during: astream_events() on an agent with ChatBedrockConverse as the LLM
Call path: langchain_aws/chat_models/bedrock_converse.py, line 923 in _stream() → _converse_params()
Root cause: _converse_params() method signature doesn't include **kwargs to accept strict parameter
Affected Versions
Package: langchain-aws 1.0.3 (and likely earlier 1.0.x versions)
Triggered by: langchain-core ≥ 0.3.0 with structured output support
Environment: Python 3.12, async streaming context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions