Repository navigation
feat(api): update API spec from langfuse/langfuse 306cdfb - #2143
langfuse-bot wants to merge 1 commit into
Conversation
|
@claude review |
There was a problem hiding this comment.
Claude Code Review
No review was started: this request came from a bot account. Manual reviews can only be requested by someone with write access to this repository. Ask a maintainer to comment @claude review, or have your automation post the comment from a user account with write access.
Tip: disable this comment in your organization's Code Review settings.
| @property | ||
| def billable_units(self): | ||
| if self._billable_units is None: | ||
| from .billable_units.client import BillableUnitsClient # noqa: E402 |
There was a problem hiding this comment.
Imports break the repository rule
Both new billable_units properties import their clients inside the methods. The repository requires imports at the top of the module. Move BillableUnitsClient and AsyncBillableUnitsClient to module-level imports before merging.
Rule Used: Move imports to the top of the module instead of placing them within functions or methods. (source)
Learned From
langfuse/langfuse-python#1387
Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/api/unstable/client.py
Line: 43
Comment:
**Imports break the repository rule**
Both new `billable_units` properties import their clients inside the methods. The repository requires imports at the top of the module. Move `BillableUnitsClient` and `AsyncBillableUnitsClient` to module-level imports before merging.
**Rule Used:** Move imports to the top of the module instead of placing them within functions or methods. ([source](https://app.greptile.com/-/switch-tenant?tenant=personal-org-4986&next=%2Fcustom-context%3Fmemory%3Dc960fc07-9928-409f-a18b-a780cbdded12))
**Learned From**
[langfuse/langfuse-python#1387](https://github.com/langfuse/langfuse-python/pull/1387)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| to_timestamp=datetime.datetime.fromisoformat( | ||
| "2024-01-15 09:30:00+00:00", | ||
| ), |
There was a problem hiding this comment.
Examples request an empty interval
Both get examples pass identical from_timestamp and to_timestamp values. The documented range excludes its end, so users copying either example request no time span rather than a useful usage report. Set to_timestamp later than from_timestamp in both examples.
Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/api/unstable/billable_units/client.py
Line: 91-93
Comment:
**Examples request an empty interval**
Both `get` examples pass identical `from_timestamp` and `to_timestamp` values. The documented range excludes its end, so users copying either example request no time span rather than a useful usage report. Set `to_timestamp` later than `from_timestamp` in both examples.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
LGTM. This is a purely additive regeneration of the Fern client that adds the unstable billable_units endpoint and follows the same patterns as the sibling sub-clients.
What was reviewed:
UnstableClientandAsyncUnstableClientget lazybillable_unitsproperties. The new names appear in_dynamic_imports, theTYPE_CHECKINGimports and__all__, and the sync and async code match.- The raw clients send GET
api/public/unstable/organizations/billable-units. Both timestamps go throughserialize_datetime, and errors are mapped to exceptions the same waytopics/raw_client.pydoes it. - The
BillableUnitsRowandBillableUnitsResponsealiases (projectId,topicFacetSummaries,usageRecordedFrom) and the frozenextra="allow"config match the generated topics types. - Not done: AGENTS.md asks for request and response serialization tests on generated client changes, but none were added and none were run in this review.
Extended reasoning...
The change adds 9 generated files under langfuse/api/unstable/: a new billable_units module with sync and async clients, raw clients and three types, plus the wiring in unstable/__init__.py and unstable/client.py. It is a read-only GET endpoint that uses the existing client wrapper and error types. It touches no auth, crypto, permissions or hand-written SDK code. Existing public names are unchanged and the code matches the existing Fern patterns for topics and dashboards. CODEOWNERS only covers .github/, and the PR timeline shows no open reviewer objections.
Generated from langfuse/langfuse
mainat 306cdfb.Meet the repository's import-placement requirement before merging; the example timestamp fix is non-blocking.
Summary
Adds organization-level billable usage queries under
unstable.billable_units.Reviews (1) · Last reviewed commit: "feat(api): update API spec from langfuse..." · Reviewed by Greptile