diff --git a/claude_sonnet-3-7-bedrock.py b/claude_sonnet-3-7-bedrock.py index fc2543d..e49252f 100644 --- a/claude_sonnet-3-7-bedrock.py +++ b/claude_sonnet-3-7-bedrock.py @@ -39,6 +39,7 @@ class Pipeline: AWS_SECRET_KEY: str = "" AWS_REGION_NAME: str = "us-east-1" MODEL_ID: str = "us.anthropic.claude-3-7-sonnet-20250219-v1:0" + DEBUG: bool = False def __init__(self): self.type = "manifold" @@ -55,7 +56,8 @@ class Pipeline: "AWS_ACCESS_KEY": os.getenv("AWS_ACCESS_KEY", "your-aws-access-key-here"), "AWS_SECRET_KEY": os.getenv("AWS_SECRET_KEY", "your-aws-secret-key-here"), "AWS_REGION_NAME": os.getenv("AWS_REGION_NAME", "your-aws-region-name-here"), - "MODEL_ID": os.getenv("MODEL_ID", "us.anthropic.claude-3-7-sonnet-20250219-v1:0") + "MODEL_ID": os.getenv("MODEL_ID", "us.anthropic.claude-3-7-sonnet-20250219-v1:0"), + "DEBUG": os.getenv("DEBUG", "false").lower() == "true" } ) if (self.valves.USE_AWS_CREDS is True): @@ -204,6 +206,8 @@ class Pipeline: streaming_response = self.bedrock_runtime.converse_stream(**payload) thinking_block = None for chunk in streaming_response["stream"]: + if self.valves.DEBUG: + print(chunk) if "contentBlockStop" in chunk and chunk["contentBlockStop"]["contentBlockIndex"] == thinking_block: print("Thinking End") yield '\n\n' @@ -231,6 +235,8 @@ class Pipeline: # Process each content block to find reasoning and response text for block in content_blocks: + if self.valves.DEBUG: + print(block) if "reasoningContent" in block: reasoning = block["reasoningContent"]["reasoningText"]["text"] if "text" in block: