File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed
models/spring-ai-anthropic/src/main/java/org/springframework/ai/anthropic/api Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 5353 */
5454public class StreamHelper {
5555
56- public boolean isToolUseStart (StreamEvent event ) {
57- if (isInvalidEvent (event , EventType .CONTENT_BLOCK_START )) {
58- return false ;
56+ public boolean isToolUseStart (StreamEvent event ) {
57+ if (isInvalidEvent (event , EventType .CONTENT_BLOCK_START )) {
58+ return false ;
59+ }
60+ ContentBlockStartEvent contentBlockStartEvent = (ContentBlockStartEvent ) event ;
61+ return ContentBlock .Type .TOOL_USE .getValue ().equals (contentBlockStartEvent .contentBlock ().type ());
5962 }
60- ContentBlockStartEvent contentBlockStartEvent = (ContentBlockStartEvent ) event ;
61- return ContentBlock .Type .TOOL_USE .getValue ().equals (contentBlockStartEvent .contentBlock ().type ());
62- }
6363
64- public boolean isToolUseFinish (StreamEvent event ) {
65- return !isInvalidEvent (event , EventType .CONTENT_BLOCK_STOP );
66- }
64+ public boolean isToolUseFinish (StreamEvent event ) {
65+ return !isInvalidEvent (event , EventType .CONTENT_BLOCK_STOP );
66+ }
6767
68- private boolean isInvalidEvent (StreamEvent event , EventType expectedType ) {
69- return event == null || event .type () == null || event .type () != expectedType ;
70- }
68+ private boolean isInvalidEvent (StreamEvent event , EventType expectedType ) {
69+ return event == null || event .type () == null || event .type () != expectedType ;
70+ }
7171
7272 public StreamEvent mergeToolUseEvents (StreamEvent previousEvent , StreamEvent event ) {
7373
You can’t perform that action at this time.
0 commit comments