Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计通过

testing-llm测试 LLM

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

1,371

周安装

56

GitHub Stars

160

下载量

439
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:testing-llm(测试 LLM)
来源仓库:https://github.com/yonatangross/orchestkit
仓库路径:skills/testing-llm
安装命令:
npx skills add https://github.com/yonatangross/orchestkit --skill testing-llm
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/yonatangross/orchestkit --skill testing-llm

简介

针对大语言模型应用的专项测试支持。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

  • 适用于提示注入、输出偏见、幻觉等风险检测。
  • 可辅助构建测试数据集与评估指标体系。
  • 需结合具体 LLM 平台特性定制测试用例。
  • testing-llm 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

LLM & AI Testing Patterns

Patterns and tools for testing LLM integrations, evaluating AI output quality, mocking responses for deterministic CI, and applying agentic test workflows (planner, generator, healer).

Quick Reference

AreaFilePurpose
Rulesrules/llm-evaluation.mdDeepEval quality metrics, Pydantic schema validation, timeout testing
Rulesrules/llm-mocking.mdMock LLM responses, VCR.py recording, custom request matchers
Referencereferences/deepeval-ragas-api.mdFull API reference for DeepEval and RAGAS metrics
Referencereferences/generator-agent.mdTransforms Markdown specs into Playwright tests
Referencereferences/healer-agent.mdAuto-fixes failing tests (selectors, waits, dynamic content)
Referencereferences/planner-agent.mdExplores app and produces Markdown test plans
Checklistchecklists/llm-test-checklist.mdComplete LLM testing checklist (setup, coverage, CI/CD)
Exampleexamples/llm-test-patterns.mdFull examples: mocking, structured output, DeepEval, VCR, golden datasets

When to Use This Skill

  • Testing code that calls LLM APIs (OpenAI, Anthropic, etc.)
  • Validating RAG pipeline output quality
  • Setting up deterministic LLM tests in CI
  • Building evaluation pipelines with quality gates
  • Applying agentic test patterns (plan -> generate -> heal)

LLM Mock Quick Start

Mock LLM responses for fast, deterministic unit tests:

from unittest.mock import AsyncMock, patch
import pytest

@pytest.fixture
def mock_llm():
    mock = AsyncMock()
    mock.return_value = {"content": "Mocked response", "confidence": 0.85}
    return mock

@pytest.mark.asyncio
async def test_with_mocked_llm(mock_llm):
    with patch("app.core.model_factory.get_model", return_value=mock_llm):
        result = await synthesize_findings(sample_findings)
    assert result["summary"] is not None

Key rule: NEVER call live LLM APIs in CI. Use mocks for unit tests, VCR.py for integration tests.

DeepEval Quality Quick Start

Validate LLM output quality with multi-dimensional metrics:

from deepeval import assert_test
from deepeval.test_case import LLMTestCase
from deepeval.metrics import AnswerRelevancyMetric, FaithfulnessMetric

test_case = LLMTestCase(
    input="What is the capital of France?",
    actual_output="The capital of France is Paris.",
    retrieval_context=["Paris is the capital of France."],
)

assert_test(test_case, [
    AnswerRelevancyMetric(threshold=0.7),
    FaithfulnessMetric(threshold=0.8),
])

2026 library updates (DeepEval 2.3, RAGAS 1.2)

DeepEval 2.3 introduces self-explaining scores — every metric now emits a reason field alongside the numeric score, so a failing CI build gets a human-readable explanation without a second LLM call:

metric = AnswerRelevancyMetric(threshold=0.7, include_reason=True)
metric.measure(test_case)
print(metric.score, metric.reason)
# 0.62  "Response addresses the topic but omits the date asked for."

RAGAS 1.2 ships dynamic recalibration — when the grader model drifts (e.g. GPT-5.2 → future Gemini 3.1), RAGAS records the shift and adjusts the threshold so historical scores stay comparable across evals:

from ragas.evaluation import evaluate
from ragas.metrics import faithfulness, context_recall

result = evaluate(
    dataset,
    metrics=[faithfulness, context_recall],
    recalibrate=True,   # 1.2+ — normalizes against the grader baseline
)
Bump floors: deepeval >= 2.3, ragas >= 1.2. Older releases silently drop the reason/recalibrate kwargs.

Quality Metrics Thresholds

MetricThresholdPurpose
Answer Relevancy>= 0.7Response addresses question
Faithfulness>= 0.8Output matches context
Hallucination<= 0.3No fabricated facts
Context Precision>= 0.7Retrieved contexts relevant
Context Recall>= 0.7All relevant contexts retrieved

Structured Output Validation

Always validate LLM output with Pydantic schemas:

from pydantic import BaseModel, Field

class LLMResponse(BaseModel):
    answer: str = Field(min_length=1)
    confidence: float = Field(ge=0.0, le=1.0)
    sources: list[str] = Field(default_factory=list)

async def test_structured_output():
    result = await get_llm_response("test query")
    parsed = LLMResponse.model_validate(result)
    assert 0 <= parsed.confidence <= 1.0

VCR.py for Integration Tests

Record and replay LLM API calls for deterministic integration tests:

@pytest.fixture(scope="module")
def vcr_config():
    import os
    return {
        "record_mode": "none" if os.environ.get("CI") else "new_episodes",
        "filter_headers": ["authorization", "x-api-key"],
    }

@pytest.mark.vcr()
async def test_llm_integration():
    response = await llm_client.complete("Say hello")
    assert "hello" in response.content.lower()

Agentic Test Workflow

The three-agent pattern for end-to-end test automation:

Planner -> specs/*.md -> Generator -> tests/*.spec.ts -> Healer (auto-fix)
  1. Planner (references/planner-agent.md): Explores your app, produces Markdown test plans from PRDs or natural language requests. Requires seed.spec.ts for app context.
  2. Generator (references/generator-agent.md): Converts Markdown specs into Playwright tests. Actively validates selectors against the running app. Uses semantic locators (getByRole, getByLabel, getByText).
  3. Healer (references/healer-agent.md): Automatically fixes failing tests by replaying failures, inspecting the DOM, and patching locators/waits. Max 3 healing attempts per test.

Edge Cases to Always Test

For every LLM integration, cover these paths:

  • Empty/null inputs -- empty strings, None values
  • Long inputs -- truncation behavior near token limits
  • Timeouts -- fail-open vs fail-closed behavior
  • Schema violations -- invalid structured output
  • Prompt injection -- adversarial input resistance
  • Unicode -- non-ASCII characters in prompts and responses

See checklists/llm-test-checklist.md for the complete checklist.

Anti-Patterns

Anti-PatternCorrect Approach
Live LLM calls in CIMock for unit, VCR for integration
Random seedsFixed seeds or mocked responses
Single metric evaluation3-5 quality dimensions
No timeout handlingAlways set < 1s timeout in tests
Hardcoded API keysEnvironment variables, filtered in VCR
Asserting only is not NoneSchema validation + quality metrics

Related Skills

  • ork:testing-unit — Unit testing fundamentals, AAA pattern
  • ork:testing-integration — Integration testing for AI pipelines
  • ork:golden-dataset — Evaluation dataset management

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.42%
按下载量换算151

Claude

30.31%
按下载量换算133

Cursor

18.71%
按下载量换算82

Gemini CLI

8.17%
按下载量换算36

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills