Skip to content

Add a helper to remove citation markers from response output text #310

Description

@jbeckwith-oai

Carried over from #126 and originally requested by @nicolascian.

When Responses use the file search tool, callers currently have to clean citation markers from output text themselves. The SDK already exposes structured annotation data, so this should be handled without asking users to maintain fragile regular expressions.

Desired behavior

  • Provide a convenience helper that returns output text with file-citation markers removed.
  • Use structured annotation positions/types rather than parsing natural language with a regex.
  • Preserve the existing raw output_text behavior.
  • Define behavior for multiple, adjacent, overlapping, and Unicode-indexed annotations.
  • Clarify whether the helper handles only file_citation annotations or all visible citation types.
  • Add documentation and tests.

Source: #126.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions