-
Notifications
You must be signed in to change notification settings - Fork 308
feat(api): update API spec from langfuse/langfuse 7c46d98 #1744
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,19 +8,27 @@ | |
|
|
||
|
|
||
| class BlobStorageIntegrationFileType(enum.StrEnum): | ||
| """ | ||
| File format for exported data. `PARQUET` is a columnar binary format encoded and compressed by the storage engine; gzip compression does not apply to it. Note that the model-price columns (`input_price`, `output_price`, `total_price`) are not included in Parquet observation exports. | ||
| """ | ||
|
|
||
| JSON = "JSON" | ||
| CSV = "CSV" | ||
| JSONL = "JSONL" | ||
| PARQUET = "PARQUET" | ||
|
|
||
| def visit( | ||
| self, | ||
| json: typing.Callable[[], T_Result], | ||
| csv: typing.Callable[[], T_Result], | ||
| jsonl: typing.Callable[[], T_Result], | ||
| parquet: 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() | ||
| if self is BlobStorageIntegrationFileType.PARQUET: | ||
| return parquet() | ||
|
Comment on lines
26
to
+34
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The method has no final Prompt To Fix With AIThis is a comment left during a code review.
Path: langfuse/api/blob_storage_integrations/types/blob_storage_integration_file_type.py
Line: 26-34
Comment:
**`visit()` returns `None` implicitly when no branch matches**
The method has no final `else`/`raise` clause. If `self` ever holds a value not covered by the `if` checks — e.g. a future enum member added to the spec before the `visit` signature is updated — the function falls through and implicitly returns `None`, silently violating the `T_Result` return type. Adding `raise ValueError(f"Unknown BlobStorageIntegrationFileType: {self}")` as a trailing guard would surface this immediately instead of propagating a `None` into caller logic.
How can I resolve this? If you propose a fix, please make it concise. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parquetis now a required parameter invisit()Adding
parquetas a required positional argument means any existing caller ofBlobStorageIntegrationFileType.visit()that passes onlyjson,csv, andjsonlwill now raise aTypeErrorat runtime. SincePARQUETdid not previously exist in this enum (only inBlobStorageIntegrationFileTypeResponse), all current callers of this method will be broken by this change without a corresponding update on their side.Prompt To Fix With AI