Get started with LangWatch Skills in seconds: Set up evals, scenario tests, and tracing just by asking your AI coding assistant.
import langwatch
df = langwatch.datasets.get_dataset("dataset-id").to_pandas()
experiment = langwatch.experiment.init("my-experiment")
for index, row in experiment.loop(df.iterrows()):
# your execution code here
experiment.evaluate(
"legacy/ragas_context_relevancy",
index=index,
data={
"output": output,
"contexts": row["contexts"],
},
settings={}
)[
{
"status": "processed",
"score": 123,
"passed": true,
"label": "<string>",
"details": "<string>",
"cost": {
"currency": "<string>",
"amount": 123
}
}
]This metric gauges the relevancy of the retrieved context, calculated based on both the question and contexts. The values fall within the range of (0, 1), with higher values indicating better relevancy.
import langwatch
df = langwatch.datasets.get_dataset("dataset-id").to_pandas()
experiment = langwatch.experiment.init("my-experiment")
for index, row in experiment.loop(df.iterrows()):
# your execution code here
experiment.evaluate(
"legacy/ragas_context_relevancy",
index=index,
data={
"output": output,
"contexts": row["contexts"],
},
settings={}
)[
{
"status": "processed",
"score": 123,
"passed": true,
"label": "<string>",
"details": "<string>",
"cost": {
"currency": "<string>",
"amount": 123
}
}
]Documentation Index
Fetch the complete documentation index at: https://langwatch.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
API key for authentication
Successful evaluation
Was this page helpful?