@@ -126,6 +126,46 @@ def test_on_chain_start_end(self, callback: GalileoCallback, galileo_logger: Gal
126
126
assert traces [0 ].spans [0 ].input == '{"query": "test question"}'
127
127
assert traces [0 ].spans [0 ].output == '{"result": "test answer"}'
128
128
129
+ def test_on_chain_start_with_kwargs_serialised_none (self , callback : GalileoCallback , galileo_logger : GalileoLogger ):
130
+ run_id = uuid .uuid4 ()
131
+
132
+ # Start chain
133
+ callback .on_chain_start (
134
+ serialized = None ,
135
+ inputs = {
136
+ "messages" : [
137
+ HumanMessage (
138
+ content = "What does Lilian Weng say about the types of agent memory?" ,
139
+ additional_kwargs = {},
140
+ response_metadata = {},
141
+ )
142
+ ]
143
+ },
144
+ run_id = run_id ,
145
+ name = "LangGraph" ,
146
+ )
147
+
148
+ assert str (run_id ) in callback ._nodes
149
+ assert callback ._nodes [str (run_id )].node_type == "agent"
150
+ assert (
151
+ callback ._nodes [str (run_id )].span_params ["input" ]
152
+ == '{"messages": [{"content": "What does Lilian Weng say about the types of agent memory?"}]}'
153
+ )
154
+
155
+ # End chain
156
+ callback .on_chain_end (outputs = '{"result": "test answer"}' , run_id = run_id )
157
+
158
+ traces = galileo_logger .traces
159
+ assert len (traces ) == 1
160
+ assert len (traces [0 ].spans ) == 1
161
+ assert traces [0 ].spans [0 ].name == "Agent"
162
+ assert traces [0 ].spans [0 ].type == "workflow"
163
+ assert (
164
+ traces [0 ].spans [0 ].input
165
+ == '{"messages": [{"content": "What does Lilian Weng say about the types of agent memory?"}]}'
166
+ )
167
+ assert traces [0 ].spans [0 ].output == '{"result": "test answer"}'
168
+
129
169
def test_on_agent_chain (self , callback : GalileoCallback , galileo_logger : GalileoLogger ):
130
170
"""Test agent chain handling"""
131
171
run_id = uuid .uuid4 ()
0 commit comments