rag-observability
БесплатноБез исполняемых скриптовНе проверенTracing, evaluation, and alerting for RAG systems. LangSmith, Langfuse, Arize Phoenix, Comet Opik, OpenTelemetry GenAI conventions. What to log (query…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
RAG Observability
Minimum Log Schema per Request
{
"trace_id": "uuid",
"tenant_id": "t_123",
"user_id_hash": "sha256(...)",
"query": "...",
"rewritten_queries": ["..."],
"retrieval": [
{"chunk_id": "c1", "score": 0.82, "source": "doc1.pdf#p3",
"retriever": "hybrid", "rank": 1}
],
"rerank": [{"chunk_id": "c3", "score": 0.91, "rank": 1}],
"prompt_tokens": 1820,
"completion_tokens": 310,
"latency_ms": {"retrieve": 42, "rerank": 180, "generate": 1200, "total": 1520},
"answer": "...",
"citations": ["c3", "c5"],
"groundedness_score": 0.88,
"cache_layer": "L2",
"model": "claude-opus-4-5",
"index_version": "v42",
"embedding_model": "text-embedding-3-small"
}
Never log raw user PII. Hash user IDs, and redact the query if your policy requires it (see rag-security).
LangSmith
# pip install langsmith
import os
os.environ["LANGCHAIN_TRACING_V2"] = "true"
os.environ["LANGCHAIN_API_KEY"] = "..."
os.environ["LANGCHAIN_PROJECT"] = "rag-prod"
from langsmith import traceable, Client
@traceable(run_type="retriever", name="hybrid_retrieve")
def retrieve(query: str, k: int = 8):
hits = vectorstore.similarity_search_with_score(query, k=k)
return [{"page_content": d.page_content, "metadata": d.metadata,
"score": float(s)} for d, s in hits]
@traceable(run_type="chain", name="rag_answer")
def rag_answer(query: str):
docs = retrieve(query)
return generate(query, docs)
# Custom evaluators
from langsmith.evaluation import evaluate, LangChainStringEvaluator
evaluate(
rag_answer,
data="rag-golden-set",
evaluators=[
LangChainStringEvaluator("qa"), # reference answer
LangChainStringEvaluator("labeled_criteria", # LLM judge
config={"criteria": "groundedness"}),
],
experiment_prefix="opus-vs-sonnet",
)
The retriever run type surfaces chunk scores in the UI. Attach feedback with Client().create_feedback(run_id, key="thumbs", score=1) from your app.
Langfuse (Self-Hostable)
# pip install langfuse
from langfuse import Langfuse
from langfuse.decorators import observe, langfuse_context
lf = Langfuse(host="https://langfuse.your-domain.com")
@observe()
def rag_answer(query: str):
langfuse_context.update_current_trace(
user_id=hashed_user, session_id=session_id,
tags=["prod", "tenant:"+tenant_id],
)
docs = retrieve(query)
langfuse_context.update_current_observation(
metadata={"top_score": docs[0].score, "n_retrieved": len(docs)})
answer = generate(query, docs)
return answer
# Score programmatically (groundedness, latency SLA, etc.)
lf.score(trace_id=langfuse_context.get_current_trace_id(),
name="groundedness", value=groundedness_score)
Langfuse's strengths: self-hosted, prompt versioning, dataset + experiment runner, RBAC.
Arize Phoenix (Local, OTel-native)
# pip install arize-phoenix openinference-instrumentation-langchain
import phoenix as px
from phoenix.otel import register
from openinference.instrumentation.langchain import LangChainInstrumentor
px.launch_app() # local UI on :6006
tracer_provider = register(project_name="rag-dev")
LangChainInstrumentor().instrument(tracer_provider=tracer_provider)
# Works the same for OpenAI / Anthropic / LlamaIndex via
# openinference-instrumentation-{openai,anthropic,llama_index}
Phoenix exports OpenTelemetry spans natively; point it at any OTLP backend (Jaeger, Tempo, Honeycomb) in production.
Comet Opik
# pip install opik
import opik
from opik import track
opik.configure(use_local=True) # or Comet cloud
@track(name="rag_answer", type="general")
def rag_answer(query: str):
docs = retrieve(query)
return generate(query, docs)
from opik.evaluation.metrics import Hallucination, AnswerRelevance
metrics = [Hallucination(), AnswerRelevance()]
Opik includes built-in LLM-judge metrics and integrates with CI for regression gates.
OpenTelemetry GenAI Semantic Conventions
Vendor-neutral spans using the stable GenAI conventions:
# pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
trace.set_tracer_provider(provider)
tracer = trace.get_tracer("rag")
def rag(query: str):
with tracer.start_as_current_span("gen_ai.chat") as span:
span.set_attribute("gen_ai.system", "anthropic")
span.set_attribute("gen_ai.request.model", "claude-opus-4-5")
span.set_attribute("gen_ai.operation.name", "chat")
with tracer.start_as_current_span("retrieval") as rs:
docs = retrieve(query)
Установить rag-observability в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditFAQ
Что делает скилл rag-observability?
Tracing, evaluation, and alerting for RAG systems. LangSmith, Langfuse, Arize Phoenix, Comet Opik, OpenTelemetry GenAI conventions. What to log (query, chunks+scores, rerank scores, answer, citations), retrieval debugging workflows, alerts for empty/low-score retrieval. USE WHEN: user mentions "LangSmith", "Langfuse", "Phoenix", "Opik", "OpenTelemetry LLM", "LLM tracing", "retrieval debugging", "RAG metrics", "RAG dashboard", "RAG alerting" DO NOT USE FOR: hallucination validators - use `rag-guardrails`; caching layer metrics - use `rag-caching`; security audit logs - use `rag-security`
Как установить скилл rag-observability?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл rag-observability запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic