Adding debug Flag
This commit is contained in:
parent
90b7aa64ce
commit
3f81b437b0
@ -39,6 +39,7 @@ class Pipeline:
|
|||||||
AWS_SECRET_KEY: str = ""
|
AWS_SECRET_KEY: str = ""
|
||||||
AWS_REGION_NAME: str = "us-east-1"
|
AWS_REGION_NAME: str = "us-east-1"
|
||||||
MODEL_ID: str = "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
|
MODEL_ID: str = "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
|
||||||
|
DEBUG: bool = False
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.type = "manifold"
|
self.type = "manifold"
|
||||||
@ -55,7 +56,8 @@ class Pipeline:
|
|||||||
"AWS_ACCESS_KEY": os.getenv("AWS_ACCESS_KEY", "your-aws-access-key-here"),
|
"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_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"),
|
"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):
|
if (self.valves.USE_AWS_CREDS is True):
|
||||||
@ -204,6 +206,8 @@ class Pipeline:
|
|||||||
streaming_response = self.bedrock_runtime.converse_stream(**payload)
|
streaming_response = self.bedrock_runtime.converse_stream(**payload)
|
||||||
thinking_block = None
|
thinking_block = None
|
||||||
for chunk in streaming_response["stream"]:
|
for chunk in streaming_response["stream"]:
|
||||||
|
if self.valves.DEBUG:
|
||||||
|
print(chunk)
|
||||||
if "contentBlockStop" in chunk and chunk["contentBlockStop"]["contentBlockIndex"] == thinking_block:
|
if "contentBlockStop" in chunk and chunk["contentBlockStop"]["contentBlockIndex"] == thinking_block:
|
||||||
print("Thinking End")
|
print("Thinking End")
|
||||||
yield '</thinking>\n\n'
|
yield '</thinking>\n\n'
|
||||||
@ -231,6 +235,8 @@ class Pipeline:
|
|||||||
|
|
||||||
# Process each content block to find reasoning and response text
|
# Process each content block to find reasoning and response text
|
||||||
for block in content_blocks:
|
for block in content_blocks:
|
||||||
|
if self.valves.DEBUG:
|
||||||
|
print(block)
|
||||||
if "reasoningContent" in block:
|
if "reasoningContent" in block:
|
||||||
reasoning = block["reasoningContent"]["reasoningText"]["text"]
|
reasoning = block["reasoningContent"]["reasoningText"]["text"]
|
||||||
if "text" in block:
|
if "text" in block:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user