Evaluation
Data Collection
from pylangdb.client import LangDb
client = LangDb(
api_key=os.getenv("LANGDB_API_KEY"),
project_id=os.getenv("LANGDB_PROJECT_ID"))
thread_id =[...,...,...] # LangDB Threads
df = client.create_evaluation_df(thread_ids)Cost Calculation
print(f"Total cost across all threads: ${df['thread_total_cost'].sum():.4f}")
thread_costs = df.groupby('thread_id')['thread_total_cost'].sum()
avg_cost = df['thread_total_cost'].sum() / len(df)
print(f"\nAverage cost per message: ${avg_cost:.4f}")Custom Evaluations
Last updated
Was this helpful?