/claim #2456

This PR implements support for emitting OpenTelemetry-compliant events for prompt and completion logging.

✅ Adds:

  • use_legacy_attributes config (default: true)
  • emit_prompt_events and emit_completion_events (default: true)
  • record_prompt_and_completion() utility function
  • Integrated into: completion_wrappers.py, chat_wrappers.py, embeddings_wrappers.py

Fully backward compatible with legacy attributes.


[!IMPORTANT] Add OpenTelemetry-compliant prompt and completion event logging with configurable options and backward compatibility.

  • Behavior:
    • Adds OpenTelemetry-compliant event logging for prompt and completion events via record_prompt_and_completion() in utils.py.
    • Configurable via use_legacy_attributes, emit_prompt_events, and emit_completion_events in config.py.
    • Integrated into completion_wrappers.py, chat_wrappers.py, embeddings_wrappers.py.
  • Config:
    • Adds use_legacy_attributes, emit_prompt_events, emit_completion_events to Config class in config.py.
  • Utility Function:
    • Adds record_prompt_and_completion() in utils.py to emit events or set attributes based on config.

This description was created by Ellipsis for 502f1ab2d9e6d9f45d1471812ed3e693fdd1386c. It will automatically update as commits are pushed.

Claim

Total prize pool $1,500
Total paid $0
Status Pending
Submitted April 09, 2025
Last updated April 09, 2025

Contributors

MR

MrKrishnabhagat

@MrKrishnabhagat

100%

Sponsors

TR

Traceloop (YC W23)

@traceloop

$1,500