testing thinking
This commit is contained in:
		@@ -178,6 +178,9 @@ 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 "contentBlockStop" in chunk and chunk["contentBlockStop"]["contentBlockIndex"] == thinking_block:
 | 
				
			||||||
 | 
					                print("Thinking End")
 | 
				
			||||||
 | 
					                yield '</thinking>\n\n' 
 | 
				
			||||||
            if "contentBlockDelta" in chunk:
 | 
					            if "contentBlockDelta" in chunk:
 | 
				
			||||||
                delta = chunk["contentBlockDelta"]["delta"]
 | 
					                delta = chunk["contentBlockDelta"]["delta"]
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
@@ -188,10 +191,6 @@ class Pipeline:
 | 
				
			|||||||
                    yield '<thinking>\n' 
 | 
					                    yield '<thinking>\n' 
 | 
				
			||||||
                  yield delta["reasoningContent"]["text"]
 | 
					                  yield delta["reasoningContent"]["text"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if "contentBlockStop" in chunk: # and chunk["contentBlockStop"]["contentBlockIndex"] == thinking_block:
 | 
					 | 
				
			||||||
                print("Thinking End")
 | 
					 | 
				
			||||||
                yield '</thinking>\n\n' 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                # Handle regular response text
 | 
					                # Handle regular response text
 | 
				
			||||||
                if "text" in delta:
 | 
					                if "text" in delta:
 | 
				
			||||||
                  yield delta["text"]
 | 
					                  yield delta["text"]
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user