@@ -73,25 +73,29 @@ def add(a: float, b: float) -> float:
73
73
assert actual_event == IsPartialDict (expected_event )
74
74
75
75
assert [
76
- (span ['name' ], len (span ['attributes' ].get ('all_messages_events' , [])))
76
+ (
77
+ span ['name' ],
78
+ len (span ['attributes' ].get ('all_messages_events' , [])),
79
+ 'gen_ai.usage.input_tokens' in span ['attributes' ],
80
+ )
77
81
for span in sorted (spans , key = lambda s : s ['start_time' ])
78
82
] == snapshot (
79
83
[
80
- ('LangGraph' , 4 ),
81
- ('agent' , 2 ),
82
- ('call_model' , 2 ),
83
- ('RunnableSequence' , 2 ),
84
- ('Prompt' , 1 ),
85
- ('ChatOpenAI' , 2 ),
86
- ('should_continue' , 2 ),
87
- ('tools' , 0 ),
88
- ('add' , 0 ),
89
- ('agent' , 4 ),
90
- ('call_model' , 4 ),
91
- ('RunnableSequence' , 4 ),
92
- ('Prompt' , 3 ),
93
- ('ChatOpenAI' , 4 ),
94
- ('should_continue' , 4 ),
84
+ ('LangGraph' , 4 , False ),
85
+ ('agent' , 2 , False ),
86
+ ('call_model' , 2 , False ),
87
+ ('RunnableSequence' , 2 , False ),
88
+ ('Prompt' , 1 , False ),
89
+ ('ChatOpenAI' , 2 , True ),
90
+ ('should_continue' , 2 , False ),
91
+ ('tools' , 0 , False ),
92
+ ('add' , 0 , False ),
93
+ ('agent' , 4 , False ),
94
+ ('call_model' , 4 , False ),
95
+ ('RunnableSequence' , 4 , False ),
96
+ ('Prompt' , 3 , False ),
97
+ ('ChatOpenAI' , 4 , True ),
98
+ ('should_continue' , 4 , False ),
95
99
]
96
100
)
97
101
0 commit comments