소스 정보
- 저장소
- truera/trulens
- 최근 소스 활동
- 2026년 5월 14일 14:35
- 감지된 SKILL.md 언어
- 영어
- 스타
- 3,514
- 포크
- 323
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/truera/trulens --skill trulens-dataset-curation명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Configure feedback functions and selectors for TruLens evaluations
SOC 직업 분류 기준
SKILL.md 표시 중
| skill_spec_version | 0.1.0 |
| name | trulens-dataset-curation |
| version | 1.0.0 |
| description | Create and curate evaluation datasets with ground truth for TruLens |
| tags | ["trulens","llm","evaluation","dataset","ground-truth"] |
Create evaluation datasets with ground truth to measure your LLM app's performance.
Ground truth datasets allow you to:
pip install trulens pandas
from trulens.core import TruSession
session = TruSession()
Structure your data as a pandas DataFrame with these columns:
| Column | Required | Description |
|---|---|---|
query | Yes | The input query/question |
query_id | No | Unique identifier for the query |
expected_response | No | The expected/ideal response |
expected_chunks | No | Expected retrieved contexts (list or string) |
import pandas as pd
data = {
"query": [
"What is TruLens?",
"How do I instrument a LangChain app?",
"What is the RAG triad?",
],
"query_id": ["q1", "q2", "q3"],
"expected_response": [
"TruLens is an open source library for evaluating and tracing AI agents.",
"Use TruChain to wrap your LangChain app for automatic instrumentation.",
"The RAG triad consists of context relevance, groundedness, and answer relevance.",
],
"expected_chunks": [
["TruLens is an open source library for evaluating and tracing AI agents, including RAG systems."],
["from trulens.apps.langchain import TruChain", "tru_recorder = TruChain(chain, app_name='MyApp')"],
["Context relevance evaluates retrieved chunks", "Groundedness checks if response is supported by context", "Answer relevance measures if the response answers the question"],
],
}
ground_truth_df = pd.DataFrame(data)
session.add_ground_truth_to_dataset(
dataset_name="my_evaluation_dataset",
ground_truth_df=ground_truth_df,
dataset_metadata={"domain": "TruLens QA", "version": "1.0"},
)
# Load the persisted ground truth
ground_truth_df = session.get_ground_truth("my_evaluation_dataset")
print(f"Loaded {len(ground_truth_df)} ground truth examples")
from trulens.core import Metric, Selector
from trulens.feedback import GroundTruthAgreement
from trulens.providers.openai import OpenAI
provider = OpenAI()
ground_truth_agreement = GroundTruthAgreement(
ground_truth_df,
provider=provider
)
f_groundtruth = Metric(
implementation=ground_truth_agreement.agreement_measure,
name="Ground Truth Agreement",
selectors={
"prompt": Selector.select_record_input(),
"response": Selector.select_record_output(),
},
)
If you have existing logs, convert them to the ground truth format:
# From a list of dictionaries
logs = [
{"input": "What is X?", "output": "X is...", "retrieved": ["doc1", "doc2"]},
{"input": "How does Y work?", "output": "Y works by...", "retrieved": ["doc3"]},
]
ground_truth_df = pd.DataFrame({
"query": [log["input"] for log in logs],
"expected_response": [log["output"] for log in logs],
"expected_chunks": [log["retrieved"] for log in logs],
})
For apps logged outside TruLens, use VirtualRecord to ingest data:
from trulens.apps.virtual import VirtualApp, VirtualRecord, TruVirtual
from trulens.core import Select
# Define virtual app structure
virtual_app = VirtualApp()
retriever_component = Select.RecordCalls.retriever
virtual_app[retriever_component] = "retriever"
# Create virtual records from your data
records = []
for row in ground_truth_df.itertuples():
rec = VirtualRecord(
main_input=row.query,
main_output=row.expected_response,
calls={
retriever_component.get_context: dict(
args=[row.query],
rets=row.expected_chunks if isinstance(row.expected_chunks, list) else [row.expected_chunks]
)
}
)
records.append(rec)
# Create recorder and ingest
virtual_recorder = TruVirtual(
app_name="ingested_data",
app=virtual_app,
feedbacks=[f_context_relevance, f_groundedness]
)
for record in records:
virtual_recorder.add_record(record)
Add new examples to an existing dataset:
# Load existing
existing_df = session.get_ground_truth("my_evaluation_dataset")
# Add new examples
new_examples = pd.DataFrame({
"query": ["New question?"],
"expected_response": ["New answer."],
})
updated_df = pd.concat([existing_df, new_examples], ignore_index=True)
# Re-persist (overwrites)
session.add_ground_truth_to_dataset(
dataset_name="my_evaluation_dataset",
ground_truth_df=updated_df,
)
query columnexpected_chunks is a list of strings, not a nested list