Expose formatter route traces
This commit is contained in:
@@ -395,3 +395,32 @@ def naturalize_caption(
|
||||
),
|
||||
_caption_format_dependencies(),
|
||||
)
|
||||
|
||||
|
||||
def naturalize_caption_with_trace(
|
||||
source_text: str,
|
||||
metadata_json: str = "",
|
||||
input_hint: str = "auto",
|
||||
target: str = "auto",
|
||||
trigger: str = DEFAULT_TRIGGER,
|
||||
include_trigger: bool = True,
|
||||
detail_level: str = "balanced",
|
||||
style_policy: str = "drop_style_tail",
|
||||
caption_profile: str = caption_policy.CAPTION_PROFILE_DEFAULT,
|
||||
) -> tuple[str, str, str]:
|
||||
"""Rewrite text like naturalize_caption and include formatter route trace JSON."""
|
||||
result = caption_format_route.naturalize_caption_result(
|
||||
caption_format_route.CaptionFormatRequest(
|
||||
source_text=source_text,
|
||||
metadata_json=metadata_json,
|
||||
input_hint=input_hint,
|
||||
target=target,
|
||||
trigger=trigger,
|
||||
include_trigger=include_trigger,
|
||||
detail_level=detail_level,
|
||||
style_policy=style_policy,
|
||||
caption_profile=caption_profile,
|
||||
),
|
||||
_caption_format_dependencies(),
|
||||
)
|
||||
return result.as_trace_tuple()
|
||||
|
||||
Reference in New Issue
Block a user