import os
import sys
from pathlib import Path
# Add the starter directory to Python path
starter_dir = Path(__file__).parent
sys.path.insert(0, str(starter_dir))
from rippletide_client import RippletideClient
# 1. Initialize the client
api_key = os.getenv("RIPPLETIDE_API_KEY")
client = RippletideClient(api_key=api_key)
# 2. Create an agent configured for evaluation
agent = client.create_agent(
name="Evaluation Agent",
public_url="https://your-agent-url.com/chat" # Your agent's chat endpoint
)
agent_id = agent["id"]
print(f"Created agent: {agent_id}")
# 3. Upload a PDF to extract questions and expected answers
client.extract_questions_from_pdf(
agent_id=agent_id,
pdf_path="knowledge.pdf"
)
# 4. Get all generated test prompts
test_prompts = client.get_test_prompts(agent_id)
print(f"Found {len(test_prompts)} test prompts")
# 5. Evaluate each prompt
for prompt in test_prompts:
report = client.evaluate(
agent_id=agent_id,
question=prompt["prompt"],
expected_answer=prompt.get("expectedAnswer"),
)
print(f"Question: {prompt['prompt'][:50]}...")
print(f"Result: {report['label']}")
print(f"Justification: {report['justification']}\n")