Skip to content

feat: add agentic evaluator - #274

Merged
Yunnglin merged 6 commits into
mainfrom
feat/agentic-evaluator
Sep 8, 2026
Merged

feat: add agentic evaluator#274
Yunnglin merged 6 commits into
mainfrom
feat/agentic-evaluator

Conversation

@Yunnglin

Copy link
Copy Markdown
Collaborator

Summary

  • add a single-use EvalScope Native evaluator for Twinkle Agentic protocol APIs and structural samplers
  • preserve text, reasoning, tool calls, stops, multiple choices, and supported generation settings at the model boundary
  • add sampler micro-batching, DP tail padding, and HTTP sampler SamplingParams serialization
  • document installation, API/sampler usage, capability boundaries, and non-goals in Chinese and English

Validation

  • python -m pytest tests/twinkle_agentic/evaluator tests/twinkle_agentic tests/twinkle_client/test_client_multi_turn_rollout.py -q
    • 208 passed, 4 skipped
  • real offline EvalScope Native general_qa evaluation passes with both a fake protocol API and fake sampler
  • python -m pip wheel --no-deps .
  • git diff --check

Scope

No GPU model or external endpoint is required for the included validation. EvalScope benchmark-specific extras and real sampler/API smoke tests remain caller-provided runtime configuration.

Passing a local model path as model_id let EvalScope join it verbatim onto
the reports/predictions/reviews directories, so artifacts escaped work_dir
(e.g. into the model directory). Leave model_id unset so TaskConfig derives
a filesystem-safe id via safe_filename; the adapter still keeps the caller's
original model_name. Add a regression test covering path-like model ids.
@Yunnglin
Yunnglin marked this pull request as ready for review September 8, 2026 05:52
Copilot AI lite review requested due to automatic review settings September 8, 2026 05:52

Copilot AI 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.

🟡 Changes recommended

The new evaluator test modules should skip cleanly when the optional EvalScope extra isn’t installed, and the new batcher should not start a non-daemon thread that can keep processes alive if cleanup is missed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds an EvalScope Native “agentic evaluator” integration to Twinkle Agentic, providing a single-use Evaluator facade plus adapters that preserve agentic protocol details (reasoning/tool calls/stops/multi-choice) at the model boundary, with optional sampler micro-batching and updated HTTP sampler serialization.

Changes:

  • Introduces twinkle_agentic.evaluator.Evaluator plus EvalScope ModelAPI adapters for protocol APIs and structural samplers.
  • Adds SamplerBatcher micro-batching with DP tail padding, and updates the HTTP vLLMSampler to serialize Twinkle SamplingParams.
  • Adds optional dependency (twinkle-kit[eval]) and bilingual documentation + tests for the new evaluator flow.
File summaries
File Description
tests/twinkle_agentic/evaluator/test_evaluator.py New tests covering evaluator config validation and single-use semantics.
tests/twinkle_agentic/evaluator/test_conversion.py New tests for message/tool conversion and adapter output mapping.
tests/twinkle_agentic/evaluator/test_client_sampler.py Regression test for HTTP sampler SamplingParams serialization shape.
tests/twinkle_agentic/evaluator/test_batcher.py Tests for sampler micro-batching, padding, and error fan-out.
tests/twinkle_agentic/evaluator/conftest.py Local recording fakes/fixtures for evaluator tests.
tests/twinkle_agentic/evaluator/init.py Test package init for evaluator test suite.
src/twinkle_client/sampler/vllm_sampler.py Accepts Twinkle SamplingParams and embeds num_samples into sampling_params payload.
src/twinkle_agentic/evaluator/evaluator.py Single-use EvalScope runner facade with strict config ownership/validation.
src/twinkle_agentic/evaluator/_evalscope_adapter.py EvalScope ModelAPI adapters + converters (roles/reasoning/tools/stops/logprobs).
src/twinkle_agentic/evaluator/_contracts.py Shared evaluator error types and small protocol contracts.
src/twinkle_agentic/evaluator/_batcher.py New single-worker micro-batcher for structurally compatible sampler calls.
src/twinkle_agentic/evaluator/init.py Public evaluator exports.
pyproject.toml Adds eval optional extra pinning EvalScope.
docs/source_zh/使用指引/Agentic评测.md Chinese usage guide for the evaluator and capability boundaries.
docs/source_zh/index.rst Adds the new Chinese doc page to the TOC.
docs/source_en/Usage Guide/Agentic-Evaluator.md English usage guide for the evaluator and capability boundaries.
docs/source_en/index.rst Adds the new English doc page to the TOC.
Review details
  • Files reviewed: 16/17 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/twinkle_agentic/evaluator/batcher.py Outdated
Comment thread tests/twinkle_agentic/evaluator/test_conversion.py
Comment thread tests/twinkle_agentic/evaluator/test_evaluator.py
Resolve sample() conflict in twinkle_client/sampler/vllm_sampler.py: keep
main's async/data-plane additions (asyncio, json_utils, DataRef,
sample_to_data_plane) while retaining this branch's SamplingParams support;
drop the redundant top-level num_samples wire field (the /sample handler and
SampleRequest only read sampling_params).

Also align the evaluator package with the repo-wide module-naming convention
(rename _contracts/_batcher/_evalscope_adapter to base/batcher/
evalscope_adapter) and clear the pre-existing lint failures (isort, yapf,
flake8 E501) in that package.
@Yunnglin
Yunnglin merged commit aec8adf into main Sep 8, 2026
3 of 4 checks passed
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.

4 participants