Skip to content

Conversation

@maxdeichmann
Copy link
Member

@maxdeichmann maxdeichmann commented Sep 17, 2025

Important

Add blob storage integration management to Langfuse Python SDK, including creation, update, and deletion functionalities.

  • Blob Storage Integrations:
    • Add BlobStorageIntegrationsClient and AsyncBlobStorageIntegrationsClient in client.py to manage blob storage integrations.
    • Implement methods get_blob_storage_integrations(), upsert_blob_storage_integration(), and delete_blob_storage_integration().
    • Add types for blob storage integration requests and responses in types/.
  • Organization Memberships:
    • Add delete_organization_membership() and delete_project_membership() in organizations/client.py.
    • Add DeleteMembershipRequest and MembershipDeletionResponse types.
  • API Documentation:
    • Update reference.md with new blob storage integration endpoints and examples.
    • Modify descriptions for existing endpoints to reflect changes.
  • Miscellaneous:
    • Fix typo in README.md.
    • Update test_http_client.py and test_query_encoding.py to reflect changes in core imports.

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

Disclaimer: Experimental PR review

Greptile Summary

Updated On: 2025-09-17 15:31:05 UTC

This PR is a comprehensive auto-generated API specification update that adds significant new functionality to the Langfuse Python SDK. The changes introduce a complete blob storage integrations feature with support for S3, S3-compatible, and Azure Blob Storage providers, enabling automated data exports with configurable frequencies (hourly, daily, weekly) and file formats (JSON, CSV, JSONL). The PR also adds organization membership deletion capabilities through new request/response models and client methods.

Key additions include:

  • Blob Storage Integration API: Complete CRUD operations (get, upsert, delete) with proper request/response models and configuration enums
  • Membership Deletion: New endpoints for deleting organization and project memberships with proper request/response handling
  • API Improvements: Added session_id parameter to ScoreV2 filtering and marked the ingestion endpoint as legacy in favor of OpenTelemetry
  • Documentation Updates: Enhanced field parameter documentation for trace listings and updated references from "API" to "APIs"

The changes follow established patterns throughout the codebase, using Pydantic v1 for validation, consistent serialization methods, and proper field aliasing for camelCase/snake_case conversion. All new functionality is properly integrated into the main API client with both synchronous and asynchronous implementations.

Confidence score: 2/5

  • This PR contains several concerning implementation issues that need attention before merging
  • Score lowered due to critical bugs in visitor pattern methods that could return None and incorrect import path changes that will break tests
  • Pay close attention to enum visitor methods in blob storage types and import paths in test files

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 +20 to +25
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 fallback case in visitor pattern - if an unknown enum value exists, the method returns None implicitly instead of raising an error

Suggested change
if self is BlobStorageExportFrequency.HOURLY:
return hourly()
if self is BlobStorageExportFrequency.DAILY:
return daily()
if self is BlobStorageExportFrequency.WEEKLY:
return weekly()
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: {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 fallback case - if an unexpected enum value exists, this method will return None instead of T_Result, violating the return type annotation

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"Unknown BlobStorageIntegrationType: {self}")

Comment on lines +19 to +25
) -> 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: The visit method is missing a fallback case - if self doesn't match any of the defined enum values, the method will return None instead of T_Result, violating the type contract. This is a critical logical error that could cause runtime issues.

Suggested change
) -> 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()
) -> 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"Unknown BlobStorageExportMode: {self}")

Comment on lines +14 to +25
def visit(
self,
json: typing.Callable[[], T_Result],
csv: typing.Callable[[], T_Result],
jsonl: typing.Callable[[], T_Result],
) -> 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 in visit method - if an invalid enum value exists, this will return None instead of T_Result, violating the return type annotation

Suggested change
def visit(
self,
json: typing.Callable[[], T_Result],
csv: typing.Callable[[], T_Result],
jsonl: typing.Callable[[], T_Result],
) -> T_Result:
if self is BlobStorageIntegrationFileType.JSON:
return json()
if self is BlobStorageIntegrationFileType.CSV:
return csv()
if self is BlobStorageIntegrationFileType.JSONL:
return jsonl()
def visit(
self,
json: typing.Callable[[], T_Result],
csv: typing.Callable[[], T_Result],
jsonl: typing.Callable[[], T_Result],
) -> 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 +3 to +4
from langfuse.core.http_client import get_request_body
from langfuse.core.request_options import RequestOptions
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 paths changed from langfuse.api.core to langfuse.core, but based on repository structure, these modules don't exist at the new location. This will cause ImportError when tests run.

@hassiebp hassiebp closed this Sep 17, 2025
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.

3 participants