Example Eval - LlamaIndex
from llama_index.core import VectorStoreIndex, Document
from llama_index.llms.openai import OpenAI
docs = [Document(text="Our refund policy allows returns within 30 days.")]
index = VectorStoreIndex.from_documents(docs)
engine = index.as_query_engine(llm=OpenAI(model="gpt-4o-mini"))
def llamaindex_agent(case):
response = engine.query(case.query)
return {"output": str(response), "metadata": {"framework": "llamaindex"}}
report = (
client.evaluations
.run(dataset_id="...", subject={"kind": "custom_agent", "displayName": "LlamaIndex RAG", "framework": "llamaindex"})
.execute(llamaindex_agent)
.finalize()
.analyze()
)Full example: llamaindex_eval
Updated about 8 hours ago
