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(
"ragas/response_context_precision",
index=index,
data={
"input": row["input"],
"contexts": row["contexts"],
"output": output,
"expected_output": row["expected_output"],
},
settings={}
)[
{
"score": 123,
"passed": true,
"label": "<string>",
"details": "<string>",
"cost": {
"currency": "<string>",
"amount": 123
}
}
]RAG Quality
Ragas Response Context Precision
Uses an LLM to measure the proportion of chunks in the retrieved context that were relevant to generate the output or the expected output.
POST
/
ragas
/
response_context_precision
/
evaluate
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(
"ragas/response_context_precision",
index=index,
data={
"input": row["input"],
"contexts": row["contexts"],
"output": output,
"expected_output": row["expected_output"],
},
settings={}
)[
{
"score": 123,
"passed": true,
"label": "<string>",
"details": "<string>",
"cost": {
"currency": "<string>",
"amount": 123
}
}
]Authorizations
API key for authentication
Body
application/json
Response
Successful evaluation
Was this page helpful?
⌘I