Athina Client SDK

0.2.11 · active · verified Fri Apr 17

Athina Client is a lightweight Python SDK designed to interact with Athina's datasets and API. It enables users to log LLM inferences, evaluations, and experiments for monitoring, analysis, and debugging AI applications. The current version is 0.2.11, with new releases occurring regularly, typically a few times a month, especially for minor fixes and feature additions.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the Athina client and use its core functionality to log an LLM inference and a corresponding evaluation. Ensure the ATHINA_API_KEY environment variable is set.

import os
from athina.client import AthinaClient

# Initialize the Athina client with your API key
athina_client = AthinaClient(api_key=os.environ.get("ATHINA_API_KEY", ""))

# Example 1: Log an inference
try:
    response = athina_client.log_inference(
        prompt="What is the capital of France?",
        response="Paris",
        external_reference_id="my-app-inference-123",
        user_query="Capital question"
    )
    print(f"Inference logged successfully: {response.json()}")
except Exception as e:
    print(f"Error logging inference: {e}")

# Example 2: Log a simple evaluation
try:
    response = athina_client.log_evaluation(
        external_reference_id="my-app-evaluation-456",
        metric="correctness",
        score=1, # 1 for correct, 0 for incorrect
        details="The response was accurate.",
        language_model_id="gpt-4"
    )
    print(f"Evaluation logged successfully: {response.json()}")
except Exception as e:
    print(f"Error logging evaluation: {e}")

view raw JSON →