Skip to content

Conversation

@langfuse-bot
Copy link
Collaborator

@langfuse-bot langfuse-bot commented Sep 18, 2025

Important

This pull request adds new functionalities for managing blob storage integrations and organization memberships, including new client methods and types, along with updates to API documentation and minor fixes.

  • Blob Storage Integrations:
    • Added BlobStorageIntegrationsClient and AsyncBlobStorageIntegrationsClient in client.py to manage blob storage integrations.
    • Introduced methods get_blob_storage_integrations, upsert_blob_storage_integration, and delete_blob_storage_integration.
    • Added types for blob storage integration requests and responses in types/.
  • Organization Memberships:
    • Added methods delete_organization_membership and delete_project_membership in organizations/client.py.
    • Introduced DeleteMembershipRequest and MembershipDeletionResponse types.
  • API Documentation:
    • Updated API documentation to reflect new endpoints and methods.
    • Added examples for new methods in client.py files.
  • Miscellaneous:
    • Updated README.md to correct a typo.
    • Minor changes in test_http_client.py and test_query_encoding.py for testing utilities.

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

Disclaimer: Experimental PR review

Greptile Summary

Updated On: 2025-09-18 08:19:40 UTC

This PR is an automated API specification update that adds comprehensive blob storage integration functionality to the Langfuse Python SDK while making several other improvements. The changes include:

New Blob Storage Integration Features:

  • Complete blob storage integrations API with support for S3, S3-compatible storage, and Azure Blob Storage
  • New client methods for creating, reading, updating, and deleting blob storage configurations
  • Comprehensive request/response models with proper validation for storage credentials, export settings (frequencies: hourly/daily/weekly, modes: full history/from today/custom date), and file types (JSON/CSV/JSONL)
  • Organization-scoped API key requirements for blob storage operations with test upload validation

Enhanced API Capabilities:

  • Added session-based scoring support in ScoreV2 API with new session_id parameter for filtering scores by sessionId
  • New organization and project membership deletion endpoints with proper request/response models
  • Improved trace listing API documentation with clearer field exclusion behavior (excluded observations/scores return empty arrays, excluded metrics return -1 values)

Documentation and Migration Updates:

  • Marked batch ingestion endpoints as legacy with migration guidance to OpenTelemetry endpoint
  • Updated terminology from 'Tracing' to 'Observability' and corrected data model documentation URLs
  • Minor documentation improvement changing 'API' to 'APIs' in README for accuracy

Infrastructure Changes:

  • Import path restructuring moving some core utilities from langfuse.api.core to langfuse.core
  • Auto-generated comprehensive API reference documentation updates

All changes follow established patterns in the codebase with consistent Pydantic model structures, proper field aliasing, and datetime serialization. The blob storage integration represents a significant new feature enabling automated data export capabilities for enterprise use cases.

Confidence score: 2/5

  • This PR has several critical issues that could break functionality and should not be merged without fixes
  • Score lowered due to broken import paths in test files and incomplete visitor pattern implementations in enum classes
  • Pay close attention to langfuse/api/tests/utils/test_query_encoding.py, langfuse/api/tests/utils/test_http_client.py, and all blob storage enum files with visitor patterns

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.

26 files reviewed, 5 comments

Edit Code Review Bot Settings | Greptile

Comment on lines +19 to +25
) -> T_Result:
if self is BlobStorageIntegrationFileType.JSON:
return json()
if self is BlobStorageIntegrationFileType.CSV:
return csv()
if self is BlobStorageIntegrationFileType.JSONL:
return jsonl()
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Missing fallback case - if self doesn't match any enum value, method returns None instead of T_Result, breaking type contract

Suggested change
) -> T_Result:
if self is BlobStorageIntegrationFileType.JSON:
return json()
if self is BlobStorageIntegrationFileType.CSV:
return csv()
if self is BlobStorageIntegrationFileType.JSONL:
return jsonl()
) -> T_Result:
if self is BlobStorageIntegrationFileType.JSON:
return json()
if self is BlobStorageIntegrationFileType.CSV:
return csv()
if self is BlobStorageIntegrationFileType.JSONL:
return jsonl()
raise ValueError(f"Unknown BlobStorageIntegrationFileType: {self}")

Comment on lines +19 to +25
) -> T_Result:
if self is BlobStorageIntegrationType.S_3:
return s_3()
if self is BlobStorageIntegrationType.S_3_COMPATIBLE:
return s_3_compatible()
if self is BlobStorageIntegrationType.AZURE_BLOB_STORAGE:
return azure_blob_storage()
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Missing return statement or exception handling for unmatched cases. If a new enum value is added later or an invalid state occurs, this method will return None instead of T_Result, breaking the type contract.

Suggested change
) -> T_Result:
if self is BlobStorageIntegrationType.S_3:
return s_3()
if self is BlobStorageIntegrationType.S_3_COMPATIBLE:
return s_3_compatible()
if self is BlobStorageIntegrationType.AZURE_BLOB_STORAGE:
return azure_blob_storage()
) -> T_Result:
if self is BlobStorageIntegrationType.S_3:
return s_3()
if self is BlobStorageIntegrationType.S_3_COMPATIBLE:
return s_3_compatible()
if self is BlobStorageIntegrationType.AZURE_BLOB_STORAGE:
return azure_blob_storage()
raise ValueError(f"Unhandled BlobStorageIntegrationType: {self}")

Comment on lines +14 to +25
def visit(
self,
hourly: typing.Callable[[], T_Result],
daily: typing.Callable[[], T_Result],
weekly: typing.Callable[[], T_Result],
) -> T_Result:
if self is BlobStorageExportFrequency.HOURLY:
return hourly()
if self is BlobStorageExportFrequency.DAILY:
return daily()
if self is BlobStorageExportFrequency.WEEKLY:
return weekly()
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Missing return statement or exception handling for unexpected enum values. If an enum instance doesn't match any of the three conditions, the method will return None instead of T_Result, violating the return type annotation.

Suggested change
def visit(
self,
hourly: typing.Callable[[], T_Result],
daily: typing.Callable[[], T_Result],
weekly: typing.Callable[[], T_Result],
) -> T_Result:
if self is BlobStorageExportFrequency.HOURLY:
return hourly()
if self is BlobStorageExportFrequency.DAILY:
return daily()
if self is BlobStorageExportFrequency.WEEKLY:
return weekly()
def visit(
self,
hourly: typing.Callable[[], T_Result],
daily: typing.Callable[[], T_Result],
weekly: typing.Callable[[], T_Result],
) -> T_Result:
if self is BlobStorageExportFrequency.HOURLY:
return hourly()
if self is BlobStorageExportFrequency.DAILY:
return daily()
if self is BlobStorageExportFrequency.WEEKLY:
return weekly()
raise ValueError(f"Unknown BlobStorageExportFrequency value: {self}")

Comment on lines +14 to +25
def visit(
self,
full_history: typing.Callable[[], T_Result],
from_today: typing.Callable[[], T_Result],
from_custom_date: typing.Callable[[], T_Result],
) -> T_Result:
if self is BlobStorageExportMode.FULL_HISTORY:
return full_history()
if self is BlobStorageExportMode.FROM_TODAY:
return from_today()
if self is BlobStorageExportMode.FROM_CUSTOM_DATE:
return from_custom_date()
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Missing return statement or error handling for unrecognized enum values. If self doesn't match any of the three conditions, the method will return None instead of T_Result, violating the type contract.

Suggested change
def visit(
self,
full_history: typing.Callable[[], T_Result],
from_today: typing.Callable[[], T_Result],
from_custom_date: typing.Callable[[], T_Result],
) -> T_Result:
if self is BlobStorageExportMode.FULL_HISTORY:
return full_history()
if self is BlobStorageExportMode.FROM_TODAY:
return from_today()
if self is BlobStorageExportMode.FROM_CUSTOM_DATE:
return from_custom_date()
def visit(
self,
full_history: typing.Callable[[], T_Result],
from_today: typing.Callable[[], T_Result],
from_custom_date: typing.Callable[[], T_Result],
) -> T_Result:
if self is BlobStorageExportMode.FULL_HISTORY:
return full_history()
if self is BlobStorageExportMode.FROM_TODAY:
return from_today()
if self is BlobStorageExportMode.FROM_CUSTOM_DATE:
return from_custom_date()
raise ValueError(f"Unhandled BlobStorageExportMode: {self}")

# This file was auto-generated by Fern from our API Definition.

from langfuse.api.core.query_encoder import encode_query
from langfuse.core.query_encoder import encode_query
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Import path appears incorrect - 'langfuse.core.query_encoder' module doesn't exist in the repository structure. Should likely remain 'langfuse.api.core.query_encoder'.

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