Skip to content

Add hosted datasets API client and eval bridge#136

Merged
petyosi merged 5 commits into
mainfrom
petyo/pyd-3528-add-hosted-datasets-api-client-support-to-logfire-js
Jun 2, 2026
Merged

Add hosted datasets API client and eval bridge#136
petyosi merged 5 commits into
mainfrom
petyo/pyd-3528-add-hosted-datasets-api-client-support-to-logfire-js

Conversation

@petyosi

@petyosi petyosi commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a trusted/server-side hosted datasets API client through logfire/datasets and @pydantic/logfire-node/datasets, including dataset/case CRUD, bulk import, metadata/export retrieval, API key auth, base URL inference, and platform error mapping.
  • Add the high-level evaluation dataset bridge with pushEvaluationDataset() and getEvaluationDataset() so local logfire/evals datasets can round-trip through hosted datasets with evaluator specs, JSON normalization, and serializer/parser hooks.
  • Move managed variables JSON platform calls onto the shared internal PlatformAPIClient while keeping SSE stream requests on their event-stream fetch path.

Linear

  • PYD-3528: Add hosted datasets API client support to logfire-js.
  • PYD-3896: Integrate hosted datasets with logfire-js evals.
  • PYD-3897: Refactor managed variables onto shared platform API transport.

Validation

  • pnpm run check

@linear

linear Bot commented Jun 2, 2026

Copy link
Copy Markdown

PYD-3528

Copilot AI left a comment

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.

Pull request overview

This PR introduces a hosted datasets Platform API client (logfire/datasets + @pydantic/logfire-node/datasets) and a high-level bridge to round-trip logfire/evals datasets to/from hosted datasets, while also refactoring managed variables’ JSON requests to use a shared internal Platform HTTP transport.

Changes:

  • Add LogfireAPIClient hosted datasets CRUD/import client (API key auth, base URL inference, typed error mapping) and Node helper createLogfireAPIClient().
  • Add eval bridge APIs pushEvaluationDataset() / getEvaluationDataset() with evaluator spec round-tripping and JSON normalization + serializer/parser hooks.
  • Introduce internal PlatformAPIClient transport and migrate managed variables’ JSON calls onto it (keeping SSE on the existing event-stream path).

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Documents the new hosted datasets client entrypoints and server-side API key guidance.
plans/017-hosted-evaluation-dataset-bridge.md Design plan/spec for the eval bridge APIs and behavior.
plans/016-hosted-datasets-api-client.md Design plan/spec for the hosted datasets client and Node helper.
packages/logfire-node/vite.config.ts Adds datasets build entry and ensures it’s not bundled.
packages/logfire-node/src/datasets.ts Implements Node helper that reads LOGFIRE_API_KEY / LOGFIRE_BASE_URL and re-exports core client.
packages/logfire-node/src/test/datasets.test.ts Tests Node helper env handling and method availability.
packages/logfire-node/README.md Documents hosted datasets usage from the Node package.
packages/logfire-node/package.json Exports the new ./datasets entrypoint.
packages/logfire-api/vite.config.ts Adds datasets entry to build outputs.
packages/logfire-api/src/vars/index.ts Migrates managed variables JSON calls to shared PlatformAPIClient transport.
packages/logfire-api/src/vars.test.ts Adds coverage for 204 delete handling, timeout behavior, and SSE staying on event-stream fetch path.
packages/logfire-api/src/platform/http.ts Adds shared internal HTTP transport (requestJson, auth, timeout, JSON/error parsing).
packages/logfire-api/src/platform/errors.ts Adds shared transport error types used by datasets/vars.
packages/logfire-api/src/logfireApiConfig.ts Extends base URL inference for org-ID API keys and staging regions.
packages/logfire-api/src/logfireApiConfig.test.ts Adds tests for trimming, org-ID token parsing, and staging regions.
packages/logfire-api/src/datasets/json.ts Implements hosted JSON normalization + serializeValue escape hatch for eval pushes.
packages/logfire-api/src/datasets/index.ts Implements hosted datasets client + pushEvaluationDataset / getEvaluationDataset APIs.
packages/logfire-api/src/datasets/evaluation.ts Implements conversion between hosted exports and local eval Dataset/Case objects and evaluator spec mapping.
packages/logfire-api/src/datasets.test.ts Tests hosted datasets client transport behavior, endpoints, and error mapping.
packages/logfire-api/src/datasets.evaluation.test.ts Tests eval bridge push/fetch flows, evaluator handling, and JSON normalization behavior.
packages/logfire-api/README.md Documents hosted datasets usage from the core package.
packages/logfire-api/package.json Exports the new ./datasets entrypoint.
docs/evals.md Documents high-level eval workflow via hosted datasets and distinguishes raw hosted JSON APIs.
.changeset/hosted-evaluation-datasets.md Release note for the eval bridge addition (minor bumps).
.changeset/hosted-datasets-client.md Release note for the hosted datasets client and Node helper (minor bumps).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/logfire-api/src/datasets/json.ts
Comment thread packages/logfire-api/src/datasets/evaluation.ts
@petyosi
petyosi merged commit b0661cd into main Jun 2, 2026
2 checks passed
@petyosi
petyosi deleted the petyo/pyd-3528-add-hosted-datasets-api-client-support-to-logfire-js branch June 2, 2026 15:48
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.

2 participants