Adding debug Flag

This commit is contained in:
Josh Knapp 2025-03-18 10:50:35 -07:00
parent 90b7aa64ce
commit 3f81b437b0

View File

@ -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 '</thinking>\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: