Skip to content

Add LP/v1 logprobs trace payload deserialization (FIR-21499)#452

Merged
SunnySoldier357 merged 4 commits into
mainfrom
sandeep/logprobs
May 29, 2026
Merged

Add LP/v1 logprobs trace payload deserialization (FIR-21499)#452
SunnySoldier357 merged 4 commits into
mainfrom
sandeep/logprobs

Conversation

@SunnySoldier357
Copy link
Copy Markdown
Collaborator

@SunnySoldier357 SunnySoldier357 commented May 22, 2026

Summary

  • Add lp_deserializer (LP/v1) and wire into fireworks_tracing for payloads.logprobs.
  • Populate execution_metadata.extra.completion_logprobs and last-assistant Message.logprobs["content"] (cookbook path).
  • Pop base_url from completion params in tracing_utils so it is encoded into gateway URLs only (fixes dev API routing).

Test plan

  • pytest tests/adapters/test_lp_deserializer.py tests/adapters/test_fireworks_tracing_logprobs.py -q
  • Manual e2e on dev (local only; not committed)
  • Merge after mono gateway PR deploys to dev

Depends on gateway publishing logprobs payloads (fw-ai/fireworks).

Made with Cursor


Note

Medium Risk
Changes trace-to-row shape and remote completion kwargs; logprobs only appear once the gateway publishes payloads, but bad LP data is isolated via warnings.

Overview
Adds LP/v1 support so Fireworks traces that include payloads.logprobs can be turned into eval rows with per-token completion logprobs, mirroring the existing R3 router-replay path.

A new lp_deserializer decodes base64 + zstd LP01 blobs into logprob scalars and optional token IDs (token IDs are dropped when any wire id is missing). convert_trace_dict_to_evaluation_row uses that data to fill execution_metadata.extra (completion_logprobs, optional completion_token_ids, logprobs_metadata) and attaches Message.logprobs["content"] on the last assistant message. Failures are logged and do not fail the whole conversion.

The test remote server no longer forwards base_url inside completion_params to the OpenAI client—routing stays on model_base_url / gateway URL encoding—aligning with how build_init_request treats base_url for tracing URLs (comment-only tweak in tracing_utils).

Reviewed by Cursor Bugbot for commit e901c69. Bugbot is set up for automated code reviews on this repo. Configure here.

…21499).

Decode logprobs payloads into completion_logprobs and Message.logprobs on
EvaluationRow. Pop base_url from completion_params before OpenAI SDK calls
so dev inference API can be encoded in gateway tracing URLs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@SunnySoldier357 SunnySoldier357 self-assigned this May 22, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac3db7b2b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread eval_protocol/pytest/tracing_utils.py Outdated
…cing.

Co-authored-by: Cursor <cursoragent@cursor.com>
@SunnySoldier357 SunnySoldier357 requested a review from xiaoyifan May 28, 2026 20:25
Comment thread eval_protocol/adapters/lp_deserializer.py Outdated
SunnySoldier357 and others added 2 commits May 28, 2026 23:00
Use get() in build_init_request so base_url remains available for gateway
URL encoding, and filter it out in remote_server when calling the SDK.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e901c69. Configure here.

Comment thread eval_protocol/pytest/tracing_utils.py
@SunnySoldier357 SunnySoldier357 merged commit 7c82b28 into main May 29, 2026
17 checks passed
@SunnySoldier357 SunnySoldier357 deleted the sandeep/logprobs branch May 29, 2026 17:10
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.

3 participants