Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented May 22, 2025

Important

Adds support for Langfuse observation events by introducing LangfuseEvent class and create_event() method.

  • Behavior:
    • Adds create_event() method in client.py to create Langfuse observation events.
    • Introduces LangfuseEvent class in span.py for handling event-specific spans.
    • Events are created as children of the current span, with attributes like name, input, output, metadata, etc.
  • Classes:
    • LangfuseSpanWrapper now supports as_type="event".
    • LangfuseEvent class extends LangfuseSpanWrapper for event-specific functionality.
  • Misc:
    • Removes abstractmethod decorator from update() in LangfuseSpanWrapper.
    • Adds time_ns import in both client.py and span.py.

This description was created by Ellipsis for 4c72a6f. You can customize this summary. It will automatically update as commits are pushed.

Greptile Summary

Disclaimer: Experimental PR review

This PR adds support for observation events in the Langfuse Python SDK, enabling the creation of event-type observations with automatic timestamp handling and OpenTelemetry integration.

  • Added new create_event method in langfuse/_client/client.py for creating event-type observations
  • Created new LangfuseEvent class in langfuse/_client/span.py for handling event-specific functionality
  • Removed abstract class requirements from LangfuseSpanWrapper to support event implementation
  • Added proper event type support in span type definitions and attribute handling
  • Maintained consistency with existing tracing patterns and OpenTelemetry integration

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@hassiebp hassiebp enabled auto-merge (squash) May 22, 2025 12:15
@hassiebp hassiebp disabled auto-merge May 22, 2025 12:40
@hassiebp hassiebp merged commit 7af5dbc into main May 22, 2025
7 of 10 checks passed
@hassiebp hassiebp deleted the otel-handle-event-type branch May 22, 2025 12:40
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.

2 participants