File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
tests/integrations/langchain Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -554,7 +554,8 @@ def on_llm_end(
554554 finish_reason = generation .generation_info .get ("finish_reason" )
555555 if finish_reason is not None :
556556 span .set_data (
557- SPANDATA .GEN_AI_RESPONSE_FINISH_REASONS , finish_reason
557+ SPANDATA .GEN_AI_RESPONSE_FINISH_REASONS ,
558+ [finish_reason ],
558559 )
559560 except AttributeError :
560561 pass
Original file line number Diff line number Diff line change @@ -297,6 +297,12 @@ def test_langchain_agent(
297297 f"and include_prompts={ include_prompts } "
298298 )
299299
300+ # Verify finish_reasons is always an array of strings
301+ assert chat_spans [0 ]["data" ][SPANDATA .GEN_AI_RESPONSE_FINISH_REASONS ] == [
302+ "function_call"
303+ ]
304+ assert chat_spans [1 ]["data" ][SPANDATA .GEN_AI_RESPONSE_FINISH_REASONS ] == ["stop" ]
305+
300306 # Verify that available tools are always recorded regardless of PII settings
301307 for chat_span in chat_spans :
302308 span_data = chat_span .get ("data" , {})
You can’t perform that action at this time.
0 commit comments