Skip to content

feat(observability): Refactor content observation mechanism to support both logging and tracing #3612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

traburiss
Copy link

This commit refactors the content observation mechanism by adding support for trace recording without altering the original logging functionality. The motivation for this change is to ensure complete context availability in scenarios such as integration with Langfuse, which is essential for proper functionality.

Main changes:

  1. New configuration options:
    1. trace-prompt: Enables recording prompts to trace
    2. trace-completion : Enables recording completions to trace
    3. trace-prompt-size : Limits the length of prompt context
    4. content-formatter : Handles content formatting, currently supporting both 'text' and 'langfuse' modes
  2. Added two handlers, ChatModelCompletionObservationTraceHandler and ChatModelPromptContentObservationTraceHandler, to support recording context to trace.
  3. Introduced the MessageFormatter interface and its subclasses to support formatting for prompt and completion content.
  4. Rolled back parts of the code and dependencies from commit ca843e8.

@traburiss traburiss force-pushed the feature/content-trace branch from b212a6f to c485721 Compare June 19, 2025 13:12
…t both logging and tracing

This commit refactors the content observation mechanism by adding support for trace recording without altering the original logging functionality. The motivation for this change is to ensure complete context availability in scenarios such as integration with Langfuse, which is essential for proper functionality.

Main changes:

1. New configuration options:
   1. `trace-prompt`: Enables recording prompts to trace
   2. `trace-completion` : Enables recording completions to trace
   3. `trace-prompt-size` : Limits the length of prompt context
   4. `content-formatter` : Handles content formatting, currently supporting both 'text' and 'langfuse' modes
2. Added two handlers, ChatModelCompletionObservationTraceHandler and ChatModelPromptContentObservationTraceHandler, to support recording context to trace.
3. Introduced the MessageFormatter interface and its subclasses to support formatting for prompt and completion content.
4. Rolled back parts of the code and dependencies from commit ca843e8.

Signed-off-by: tingchuan.li <[email protected]>
@traburiss traburiss force-pushed the feature/content-trace branch from c485721 to ef2ad4d Compare June 19, 2025 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant