6868 GEN_AI_MEMORY_PAGE ,
6969 GEN_AI_MEMORY_PAGE_SIZE ,
7070 GEN_AI_MEMORY_RERANK ,
71- GEN_AI_MEMORY_RESULT_COUNT ,
7271 GEN_AI_MEMORY_RUN_ID ,
7372 GEN_AI_MEMORY_THRESHOLD ,
7473 GEN_AI_MEMORY_TOP_K ,
8382)
8483
8584
86- def patch_env_vars (
87- stability_mode , content_capturing = None , emit_event = None
88- ):
85+ def patch_env_vars (stability_mode , content_capturing = None , emit_event = None ):
8986 def decorator (test_case ):
9087 env_vars = {
9188 OTEL_SEMCONV_STABILITY_OPT_IN : stability_mode ,
@@ -202,7 +199,6 @@ def test_memory_search_with_parameters(self):
202199 invocation .threshold = 0.7
203200 invocation .rerank = True
204201 invocation .top_k = 5
205- invocation .result_count = 3
206202
207203 span = _get_single_span (self .span_exporter )
208204 self .assertEqual (span .name , "memory_operation search" )
@@ -217,7 +213,6 @@ def test_memory_search_with_parameters(self):
217213 GEN_AI_MEMORY_THRESHOLD : 0.7 ,
218214 GEN_AI_MEMORY_RERANK : True ,
219215 GEN_AI_MEMORY_TOP_K : 5 ,
220- GEN_AI_MEMORY_RESULT_COUNT : 3 ,
221216 },
222217 )
223218
@@ -338,7 +333,6 @@ def test_memory_manual_start_and_stop(self):
338333
339334 self .telemetry_handler .start_memory (invocation )
340335 assert invocation .span is not None
341- invocation .result_count = 5
342336 self .telemetry_handler .stop_memory (invocation )
343337
344338 span = _get_single_span (self .span_exporter )
@@ -350,27 +344,26 @@ def test_memory_manual_start_and_stop(self):
350344 GEN_AI_MEMORY_OPERATION : "search" ,
351345 GEN_AI_MEMORY_USER_ID : "user_123" ,
352346 GEN_AI_MEMORY_LIMIT : 20 ,
353- GEN_AI_MEMORY_RESULT_COUNT : 5 ,
354347 },
355348 )
356349
357350 def test_memory_error_handling (self ):
358- class MemoryError (RuntimeError ):
351+ class MemoryOperationError (RuntimeError ):
359352 pass
360353
361- with self .assertRaises (MemoryError ):
354+ with self .assertRaises (MemoryOperationError ):
362355 invocation = MemoryInvocation (operation = "add" )
363356 with self .telemetry_handler .memory (invocation ) as invocation :
364357 invocation .user_id = "user_123"
365- raise MemoryError ("Memory operation failed" )
358+ raise MemoryOperationError ("Memory operation failed" )
366359
367360 span = _get_single_span (self .span_exporter )
368361 self .assertEqual (span .status .status_code , StatusCode .ERROR )
369362 span_attrs = _get_span_attributes (span )
370363 _assert_span_attributes (
371364 span_attrs ,
372365 {
373- ErrorAttributes .ERROR_TYPE : MemoryError .__qualname__ ,
366+ ErrorAttributes .ERROR_TYPE : MemoryOperationError .__qualname__ ,
374367 },
375368 )
376369
@@ -385,7 +378,6 @@ def test_memory_with_content_capturing(self):
385378 invocation .user_id = "user_123"
386379 invocation .input_messages = "What does the user like?"
387380 invocation .output_messages = "The user likes apples"
388- invocation .result_count = 1
389381
390382 span = _get_single_span (self .span_exporter )
391383 span_attrs = _get_span_attributes (span )
@@ -394,7 +386,8 @@ def test_memory_with_content_capturing(self):
394386 self .assertIn (GEN_AI_MEMORY_INPUT_MESSAGES , span_attrs )
395387 self .assertIn (GEN_AI_MEMORY_OUTPUT_MESSAGES , span_attrs )
396388 self .assertEqual (
397- span_attrs [GEN_AI_MEMORY_INPUT_MESSAGES ], "What does the user like?"
389+ span_attrs [GEN_AI_MEMORY_INPUT_MESSAGES ],
390+ "What does the user like?" ,
398391 )
399392 self .assertEqual (
400393 span_attrs [GEN_AI_MEMORY_OUTPUT_MESSAGES ], "The user likes apples"
@@ -428,7 +421,6 @@ def test_memory_emits_event(self):
428421 invocation .agent_id = "agent_456"
429422 invocation .input_messages = "What does the user like?"
430423 invocation .output_messages = "The user likes apples"
431- invocation .result_count = 1
432424
433425 # Check that event was emitted
434426 logs = self .log_exporter .get_finished_logs ()
@@ -444,7 +436,9 @@ def test_memory_emits_event(self):
444436 # Verify event attributes
445437 attrs = log_record .attributes
446438 self .assertIsNotNone (attrs )
447- self .assertEqual (attrs [GenAI .GEN_AI_OPERATION_NAME ], "memory_operation" )
439+ self .assertEqual (
440+ attrs [GenAI .GEN_AI_OPERATION_NAME ], "memory_operation"
441+ )
448442 self .assertEqual (attrs [GEN_AI_MEMORY_OPERATION ], "search" )
449443 self .assertEqual (attrs [GEN_AI_MEMORY_USER_ID ], "user_123" )
450444 self .assertEqual (attrs [GEN_AI_MEMORY_AGENT_ID ], "agent_456" )
@@ -462,7 +456,6 @@ def test_memory_emits_event_and_span(self):
462456 with self .telemetry_handler .memory (invocation ) as invocation :
463457 invocation .user_id = "user_123"
464458 invocation .input_messages = "User likes apples"
465- invocation .result_count = 1
466459
467460 # Check span was created
468461 span = _get_single_span (self .span_exporter )
@@ -487,15 +480,15 @@ def test_memory_emits_event_and_span(self):
487480 def test_memory_emits_event_with_error (self ):
488481 """Test that memory operation emits event with error when operation fails."""
489482
490- class MemoryError (RuntimeError ):
483+ class MemoryOperationError (RuntimeError ):
491484 pass
492485
493- with self .assertRaises (MemoryError ):
486+ with self .assertRaises (MemoryOperationError ):
494487 invocation = MemoryInvocation (operation = "add" )
495488 with self .telemetry_handler .memory (invocation ) as invocation :
496489 invocation .user_id = "user_123"
497490 invocation .input_messages = "Test memory"
498- raise MemoryError ("Memory operation failed" )
491+ raise MemoryOperationError ("Memory operation failed" )
499492
500493 # Check event was emitted
501494 logs = self .log_exporter .get_finished_logs ()
@@ -506,9 +499,11 @@ class MemoryError(RuntimeError):
506499 # Verify error attribute is present
507500 self .assertEqual (
508501 attrs [ErrorAttributes .ERROR_TYPE ],
509- MemoryError .__qualname__ ,
502+ MemoryOperationError .__qualname__ ,
503+ )
504+ self .assertEqual (
505+ attrs [GenAI .GEN_AI_OPERATION_NAME ], "memory_operation"
510506 )
511- self .assertEqual (attrs [GenAI .GEN_AI_OPERATION_NAME ], "memory_operation" )
512507
513508 def test_memory_does_not_emit_event_when_disabled (self ):
514509 """Test that memory operation does not emit event when emit_event is disabled."""
@@ -526,7 +521,6 @@ def test_memory_batch_update_operation(self):
526521 with self .telemetry_handler .memory (invocation ) as invocation :
527522 invocation .user_id = "user_123"
528523 invocation .agent_id = "agent_456"
529- invocation .result_count = 5
530524
531525 span = _get_single_span (self .span_exporter )
532526 span_attrs = _get_span_attributes (span )
@@ -536,7 +530,6 @@ def test_memory_batch_update_operation(self):
536530 GEN_AI_MEMORY_OPERATION : "batch_update" ,
537531 GEN_AI_MEMORY_USER_ID : "user_123" ,
538532 GEN_AI_MEMORY_AGENT_ID : "agent_456" ,
539- GEN_AI_MEMORY_RESULT_COUNT : 5 ,
540533 },
541534 )
542535
@@ -561,7 +554,6 @@ def test_memory_batch_delete_operation(self):
561554 invocation = MemoryInvocation (operation = "batch_delete" )
562555 with self .telemetry_handler .memory (invocation ) as invocation :
563556 invocation .user_id = "user_123"
564- invocation .result_count = 3
565557
566558 span = _get_single_span (self .span_exporter )
567559 span_attrs = _get_span_attributes (span )
@@ -570,7 +562,6 @@ def test_memory_batch_delete_operation(self):
570562 {
571563 GEN_AI_MEMORY_OPERATION : "batch_delete" ,
572564 GEN_AI_MEMORY_USER_ID : "user_123" ,
573- GEN_AI_MEMORY_RESULT_COUNT : 3 ,
574565 },
575566 )
576567
@@ -618,4 +609,3 @@ def test_memory_with_json_input_output(self):
618609 # Should be JSON strings
619610 self .assertIsInstance (span_attrs [GEN_AI_MEMORY_INPUT_MESSAGES ], str )
620611 self .assertIsInstance (span_attrs [GEN_AI_MEMORY_OUTPUT_MESSAGES ], str )
621-
0 commit comments