Skip to content

Issue while trying to use RAGAS to evaluate RAG application #1945

Answered by pierlj
adhsay asked this question in Q&A
Discussion options

You must be logged in to vote

To compute the ragas metrics, you need to define an answer_fn that returns an instance of AgentAnswer. The retrieved_document argument from the evaluate function is deprecated, but you can pass a list of AgentAnswer in place of a list of strings as the answers. I will update the docs as it is still mentioned there.

Here is an example you can follow:

from giskard.rag import AgentAnwer

def get_answer_fn(question: str, history=None) -> str:
    """A function representing your RAG agent."""
    # Format appropriately the history for your RAG agent
    messages = history if history else []
    messages.append({"role": "user", "content": question})

    # Get the answer and the documents
    a…

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
1 reply
@adhsay
Comment options

Comment options

You must be logged in to vote
10 replies
@adhsay
Comment options

@adhsay
Comment options

@pierlj
Comment options

Answer selected by alexcombessie
@oussamaJmaaa
Comment options

@pierlj
Comment options

@oussamaJmaaa
Comment options

@pierlj
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants