Repository navigation
feat(api): update API spec from langfuse/langfuse 832e97a - #2102
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.
| rule_ids: typing_extensions.Annotated[ | ||
| typing.List[str], FieldMetadata(alias="ruleIds") | ||
| ] = pydantic.Field() | ||
| """ | ||
| The rules that run the facet. | ||
| """ |
There was a problem hiding this comment.
🔴 With this SDK, list_facets and get_facet raise a pydantic ValidationError against any Langfuse server that does not yet send ruleIds; on the base branch they parse fine. TopicFacet.rule_ids is declared required with pydantic.Field() and no default. parse_obj_as validates responses strictly, so a facet without that key fails. Fix: make rule_ids optional (typing.Optional[typing.List[str]] = None) or default it to an empty list. Do the same in the API spec, so self-hosted or older servers still parse.
Why this was flagged
This applies only when the server runs a Langfuse build older than spec 832e97a, which omits ruleIds from facets. Examples are self-hosted deployments and closed-beta instances not yet upgraded. TopicFacet.rule_ids at langfuse/api/unstable/topics/types/topic_facet.py:22-24 has no default. TopicFacetList.data is typing.List[TopicFacet]. RawTopicsClient.list_facets and get_facet call parse_obj_as(type_=TopicFacetList / TopicFacet), which runs pydantic.TypeAdapter(type_).validate_python (langfuse/api/core/pydantic_utilities.py:58-59). That raises ValidationError for the missing field. The surrounding try in raw_client.py catches only JSONDecodeError, so the error reaches the caller. On the base branch the same response parses, because rule_ids did not exist. Every other field added in this diff (Topic.rule_id, TopicFacetCounts.rule_id, ObservationsV2Meta.comment) is Optional with a default. extra="allow" tolerates unknown keys, not missing required ones.
Verification: This diff adds rule_ids with pydantic.Field() in langfuse/api/unstable/topics/types/topic_facet.py at lines 22-24, so the field is required. In raw_client.py, list_facets (lines 110-114) and get_facet (lines 289-293) parse with parse_obj_as, which raises a ValidationError on a missing required field. On the base commit the same response parsed fine.
Generated from langfuse/langfuse
mainat 832e97a.

Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Updates the generated API client from the upstream API definition.
No actionable issues were found. Review was based on source inspection; no runtime tests were run.
Reviews (1) · Last reviewed commit: "feat(api): update API spec from langfuse..." · Reviewed by Greptile