Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Agent Framework sets ``gen_ai.input.messages`` / ``gen_ai.output.messages`` as span
tags containing JSON arrays of ``{role, parts[{type, content}], finish_reason?}``.
This mapper converts them to :class:`InputMessages` / :class:`OutputMessages`.
This mapper converts them to ``InputMessages`` / ``OutputMessages``.
"""

from __future__ import annotations
Expand Down Expand Up @@ -49,7 +49,7 @@ def map_input_messages(messages_json: str) -> str | None:
messages_json: The raw JSON string from the span attribute.

Returns:
Serialized :class:`InputMessages` JSON string, or ``None`` if the
Serialized ``InputMessages`` JSON string, or ``None`` if the
input is empty or cannot be parsed.
"""
try:
Expand Down Expand Up @@ -83,7 +83,7 @@ def map_output_messages(messages_json: str) -> str | None:
messages_json: The raw JSON string from the span attribute.

Returns:
Serialized :class:`OutputMessages` JSON string, or ``None`` if the
Serialized ``OutputMessages`` JSON string, or ``None`` if the
input is empty or cannot be parsed.
"""
try:
Expand Down Expand Up @@ -119,7 +119,7 @@ def map_output_messages(messages_json: str) -> str | None:


def _map_role(role: str | None, default: MessageRole) -> MessageRole:
"""Map a raw role string to a :class:`MessageRole` enum."""
"""Map a raw role string to a ``MessageRole`` enum."""
if not role:
return default
return _ROLE_MAP.get(role.lower(), default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def map_input_messages(messages_json: str) -> str | None:
messages_json: The raw JSON string from the span attribute.

Returns:
Serialized :class:`InputMessages` JSON string, or ``None`` if the
Serialized ``InputMessages`` JSON string, or ``None`` if the
input is empty or cannot be parsed.
"""
if not messages_json:
Expand All @@ -82,7 +82,7 @@ def map_output_messages(messages_json: str) -> str | None:
messages_json: The raw JSON string from the span attribute.

Returns:
Serialized :class:`OutputMessages` JSON string, or ``None`` if the
Serialized ``OutputMessages`` JSON string, or ``None`` if the
input is empty or cannot be parsed.
"""
if not messages_json:
Expand Down
Loading