Skip to content

feat(api): update API spec from langfuse/langfuse 5b9cc48 - #1982

Closed
langfuse-bot wants to merge 1 commit into
mainfrom
api-spec-bot-5b9cc48-38282477962-1
Closed

langfuse-bot wants to merge 1 commit into
mainfrom
api-spec-bot-5b9cc48-38282477962-1

Conversation

@langfuse-bot

@langfuse-bot langfuse-bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

RetriggerConfidence Score: 4/5

Fix the score-call compatibility break before merging.

Summary

Updates the generated API clients from the latest server specification.

  • Callers can manage skill versions through the unstable API client.
  • Score creation accepts one score or a batch.
  • Prompt lists accept a JSON filter across prompt fields.
  • API keys accept a name and optional expiration date.
  • Blob storage setup accepts Google Cloud Storage options.
  • Ingestion docs and responses describe the endpoint's sunset.
  • The sdk-log event is removed from ingestion types.
  • API docs identify the real-time read and write paths.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Existing score keywords] --> B[ScoresClient.create]
  L[Legacy score alias] -->|Old keywords| B
  B -->|TypeError| E[No score sent]
  N[Single score or batch request] --> C[Raw scores client]
  C --> D[POST scores]
  D --> R[Single ID, accepted batch, or partial results]
Loading

Reviews (1) · Last reviewed commit: "feat(api): update API spec from langfuse..." · Reviewed by Greptile

@github-actions

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.

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

Beyond the inline finding, I checked the rest of the SDK for callers of the removed SdkLog types and the changed scores.create signature. Nothing outside langfuse/api references either one. I also checked the new unstable.skills lazy wiring and re-exports, and they are consistent.

Extended reasoning...

Searching the repo outside langfuse/api found no use of SdkLog or sdk_log, and no scores.create( calls. The skills sub-client is registered in unstable/init.py's TYPE_CHECKING imports, _dynamic_imports and all, and has a lazy property on UnstableClient.

Comment on lines 36 to +41
def create(
self,
*,
name: str,
value: CreateScoreValue,
id: typing.Optional[str] = OMIT,
trace_id: typing.Optional[str] = OMIT,
session_id: typing.Optional[str] = OMIT,
observation_id: typing.Optional[str] = OMIT,
dataset_run_id: typing.Optional[str] = OMIT,
comment: typing.Optional[str] = OMIT,
metadata: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
environment: typing.Optional[str] = OMIT,
queue_id: typing.Optional[str] = OMIT,
data_type: typing.Optional[ScoreDataType] = OMIT,
config_id: typing.Optional[str] = OMIT,
source: typing.Optional[CreateScoreSource] = OMIT,
request: CreateScoresRequest,
request_options: typing.Optional[RequestOptions] = None,
) -> CreateScoreResponse:
) -> CreateScoresResponse:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 After this merges, every call to the deprecated api.legacy.score_v1.create(...) raises TypeError, both sync and async. The legacy alias still forwards keyword fields such as name= and value= to scores.create. That method now accepts only request: CreateScoresRequest (client.py:39). Fix: have both legacy aliases build CreateScoreRequest(name=..., value=..., ...) and call create(request=..., request_options=...). Then narrow the CreateScoresResponse union back to CreateScoreResponse. Update the templates in scripts/patch_generated_score_compat.py the same way, so the next regeneration does not bring the bug back.

Why this was flagged

Callers reach the deprecated alias through LangfuseAPI(...).legacy.score_v1.create(name=..., value=..., trace_id=...) or its async version. That file was not regenerated: langfuse/api/legacy/score_v1/client.py:54-72 (sync) and :147-165 (async) still call CanonicalScoresClient(...).create(name=name, value=value, id=id, ...). After this diff, ScoresClient.create at langfuse/api/scores/client.py:36-41 and AsyncScoresClient.create at :285-290 take only keyword-only request and request_options. The call therefore fails with TypeError: create() got an unexpected keyword argument 'name' before any HTTP request is sent. On the base branch it created the score. The postprocessor does not catch this. In scripts/patch_generated_score_compat.py patch_generated_api, the legacy client already has create and LEGACY_ALIAS_MARKER, so the function returns False ('No patch needed').

Verification: Severity: normal. The sync create in langfuse/api/legacy/score_v1/client.py (lines 54-72) and the async create (lines 147-165) still pass name=name, value=value. ScoresClient.create (langfuse/api/scores/client.py:36-41) now takes only request and request_options. Python therefore raises TypeError: create() got an unexpected keyword argument 'name'. On the base commit, the alias worked.

data_type: typing.Optional[ScoreDataType] = OMIT,
config_id: typing.Optional[str] = OMIT,
source: typing.Optional[CreateScoreSource] = OMIT,
request: CreateScoresRequest,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Existing score calls fail

ScoresClient.create now accepts only request, so existing calls such as client.scores.create(name="quality", value=0.9) raise TypeError before sending anything. The unchanged sync and async legacy.score_v1.create methods also pass those removed keywords, so the compatibility alias is broken.

Preserve the old keyword form alongside batch support, or update both legacy delegates and their generation patch to build CreateScoreRequest objects.

Knowledge Base Used:

Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/api/scores/client.py
Line: 39

Comment:
**Existing score calls fail**

`ScoresClient.create` now accepts only `request`, so existing calls such as `client.scores.create(name="quality", value=0.9)` raise `TypeError` before sending anything. The unchanged sync and async `legacy.score_v1.create` methods also pass those removed keywords, so the compatibility alias is broken.

Preserve the old keyword form alongside batch support, or update both legacy delegates and their generation patch to build `CreateScoreRequest` objects.

**Knowledge Base Used:**
- [API compatibility and transport](https://app.greptile.com/personal-org-4986/-/custom-context/knowledge-base/langfuse/langfuse-python/-/docs/api-compatiblity-and-transport.md)
- [API client and service surface](https://app.greptile.com/personal-org-4986/-/custom-context/knowledge-base/langfuse/langfuse-python/-/docs/api-client-and-service-surface.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Examples
--------
from langfuse import LangfuseAPI
from langfuse.scores import CreateScoreRequest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 New examples cannot import models

The new examples import from langfuse.scores and langfuse.unstable.skills, but neither package exists. Copying these imports raises ModuleNotFoundError.

Use langfuse.api.scores and langfuse.api.unstable.skills instead. Fix the sync and async examples, including the new batch example's langfuse.commons import.

Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/api/scores/client.py
Line: 59

Comment:
**New examples cannot import models**

The new examples import from `langfuse.scores` and `langfuse.unstable.skills`, but neither package exists. Copying these imports raises `ModuleNotFoundError`.

Use `langfuse.api.scores` and `langfuse.api.unstable.skills` instead. Fix the sync and async examples, including the new batch example's `langfuse.commons` import.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Parameters
----------
sha256hashes : str
Comma-separated list of one to 50 canonical base64-encoded SHA-256 hashes from skill file manifests. URL-encode the value, including +, /, and = characters.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Hash instructions escape values twice

get_file_contents tells callers to URL-encode sha256hashes, but it passes the string through HTTPX's query parameters, which already encode it. Following this advice turns %2B into %252B, for example, so the server receives an escaped string rather than the required base64 hash.

Tell callers to pass the raw comma-separated hashes. Update the sync, async, and raw method descriptions.

Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/api/unstable/skills/client.py
Line: 262

Comment:
**Hash instructions escape values twice**

`get_file_contents` tells callers to URL-encode `sha256hashes`, but it passes the string through HTTPX's query parameters, which already encode it. Following this advice turns `%2B` into `%252B`, for example, so the server receives an escaped string rather than the required base64 hash.

Tell callers to pass the raw comma-separated hashes. Update the sync, async, and raw method descriptions.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

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