/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 functioncompletion_wrappers.py, chat_wrappers.py, embeddings_wrappers.pyFully 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()inutils.py.- Configurable via
use_legacy_attributes,emit_prompt_events, andemit_completion_eventsinconfig.py.- Integrated into
completion_wrappers.py,chat_wrappers.py,embeddings_wrappers.py.- Config:
- Adds
use_legacy_attributes,emit_prompt_events,emit_completion_eventstoConfigclass inconfig.py.- Utility Function:
- Adds
record_prompt_and_completion()inutils.pyto emit events or set attributes based on config.This description was created by
for 502f1ab2d9e6d9f45d1471812ed3e693fdd1386c. It will automatically update as commits are pushed.
Krishna Bhagat
@MrKrishnabhagat
Traceloop (YC W23)
@traceloop