[Python] What to include in context precision/recall for RAG LLM evaluation

Discussão em 'Python' iniciado por Stack, Março 6, 2025.

  1. Stack

    Stack Membro Participativo

    I am doing evaluation for my RAG LLM application using ragas. I have the prompt instruction to describe some rules, the retrieved content from my retriever, and chat history together for the LLM to do question answering. When I do the evaluation for context precision or context recall in the documentation, should I use the instruction+retrieved content+chat history or just retrieved content? Thanks!

    For example, for the parameter retrieved_contexts in the example codes below, should I use instruction+retrieved content+chat history or just retrieved content?

    from ragas import SingleTurnSample
    from ragas.metrics import LLMContextPrecisionWithoutReference

    context_precision = LLMContextPrecisionWithoutReference(llm=evaluator_llm)

    sample = SingleTurnSample(
    user_input="Where is the Eiffel Tower located?",
    response="The Eiffel Tower is located in Paris.",
    retrieved_contexts=["The Eiffel Tower is located in Paris."],
    )

    await context_precision.single_turn_ascore(sample)

    Continue reading...

Compartilhe esta Página