Skip to content

feat(api): update API spec from langfuse/langfuse 832e97a - #2102

Closed
langfuse-bot wants to merge 1 commit into
mainfrom
api-spec-bot-832e97a-42004644295-1
Closed

langfuse-bot wants to merge 1 commit into
mainfrom
api-spec-bot-832e97a-42004644295-1

Conversation

@langfuse-bot

@langfuse-bot langfuse-bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Generated from langfuse/langfuse main at 832e97a.

RetriggerView in GreptileConfidence 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.

  • Python callers can list Topics rules and fetch one by ID.
  • Python callers can query the latest Topics summary for each trace and facet.
  • Python callers can query current topic assignments for traces and facets.
  • Topics responses identify linked rules and describe current-map topics.
  • Observation v2 explains when callers must keep fetching cursor pages.

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

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment on lines +22 to 27
rule_ids: typing_extensions.Annotated[
typing.List[str], FieldMetadata(alias="ruleIds")
] = pydantic.Field()
"""
The rules that run the facet.
"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 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.

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.

1 participant