enricher_utils Module
Shared utilities for A365 span enrichers.
Provides content extraction helpers used by framework-specific enrichers (Agent Framework, Semantic Kernel, LangChain) to convert structured OTel messages to plain content arrays before A365 export.
Functions
extract_content_as_string_list
Extract content values from messages JSON and return as JSON string list.
Handles the OTel structured message format with "parts" arrays.
Only extracts text content, ignoring tool_call and tool_call_response parts.
extract_content_as_string_list(messages_json: str, role_filter: str | None = None) -> str
Parameters
| Name | Description |
|---|---|
|
messages_json
Required
|
JSON string of messages. |
|
role_filter
|
If provided, only extract content from messages with this role. Default value: None
|
Returns
| Type | Description |
|---|---|
|
JSON string containing only the text content values as an array, or the original string if parsing fails. |
extract_input_content
Extract text content from user messages only.
extract_input_content(messages_json: str) -> str
Parameters
| Name | Description |
|---|---|
|
messages_json
Required
|
|
extract_output_content
Extract only assistant text content from output messages.
extract_output_content(messages_json: str) -> str
Parameters
| Name | Description |
|---|---|
|
messages_json
Required
|
|