Skip to main content

Python SDK for JaaS AI evaluation API

Project description

JaaS API Python SDK

PyPI version Python Support License: MIT

A Python SDK for interacting with the JaaS AI evaluation API. This library provides a simple and intuitive interface for evaluating AI-generated responses against various criteria.

Visit jaas-ai.net for more information. Note: a JaaS AI API key is required.

Features

  • 🚀 Simple and intuitive API
  • 🔧 Support for multiple evaluation types (S, C, D, V), with multiple citeria
  • 📊 Comprehensive evaluation criteria support including Hallucination Detection
  • 🛡️ Robust error handling
  • 📝 Type hints for better IDE support
  • 🐍 Python 3.7+ support

Installation

From PyPI (recommended)

pip install jaas_ai

Quick Start

from jaas_ai import jaas_client

# Initialize the client with your API key
client = jaas_client(api_key="your-api-key-here")

# Evaluate an AI response
result = client.evaluate(
    question="What is the capital of France?",
    answer="The capital of France is Paris.",
    evaluation_criteria=["accuracy", "completeness", "clarity"],
    eval_type="S"
)

# Check if the request was successful
if result["status"] == "success":
    print("Evaluation results:", result["data"])
else:
    print("Error:", result["error"])

API Reference

jaas_client

The main client class for interacting with the JaaS API.

Constructor

jaas_client(api_key: str)
  • api_key (str): Your JaaS API key

Methods

evaluate()

Submit an evaluation request to the JaaS API.

def evaluate(
    self,
    question: str,
    answer: str,
    evaluation_criteria: List[str],
    eval_type: str = "S",
    ground_truth_answer: Optional[str] = None,
    context: Optional[str] = None,
    cohort: Optional[str] = None
) -> Dict

Parameters:

  • question (str): The input question
  • answer (str): The AI-generated answer to evaluate
  • evaluation_criteria (List[str]): List of criteria to evaluate against
  • eval_type (str, optional): Evaluation type. Options:
  • ground_truth_answer (str, optional): Reference answer for comparison
  • context (str, optional): Additional context for evaluation
  • cohort (str, optional): Cohort name for grouping evaluations

Returns:

  • Dict: Response with consistent structure:
    • Success: {"status": "success", "data": {...}}
    • Error: {"status": "error", "error": "error message"}

Error Handling:

The method returns structured responses instead of raising exceptions:

  • Check result["status"] to determine success or failure
  • On success: access data via result["data"]
  • On error: get error message via result["error"]

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Response Format

All API responses follow a consistent structure:

Success Response

{
    "status": "success",
    "data": {
        // Evaluation results from JaaS API
    }
}

Error Response

{
    "status": "error",
    "error": "Error message describing what went wrong"
}

Changelog

v0.1.10 (2025-09-08)

  • Implemented structured response format
  • All responses now include status and data/error fields
  • Improved error handling with consistent JSON structure
  • No more exceptions - all errors returned as structured responses

v0.1.5 (2025-09-08)

  • Improved error handling with cleaner error messages
  • Better HTTP error reporting from server responses

v0.1.4 (2025-09-08)

  • Simplified use and API call
  • Improved evaluation functionality
  • Support for multiple evaluation types
  • Comprehensive error handling

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jaas_ai-0.1.10.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jaas_ai-0.1.10-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file jaas_ai-0.1.10.tar.gz.

File metadata

  • Download URL: jaas_ai-0.1.10.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for jaas_ai-0.1.10.tar.gz
Algorithm Hash digest
SHA256 e5966b6cd07e5513ecf1d23a3365931ca34588b16981f8dc8b2710f9aadd9b4a
MD5 368b94c79ab8ce37cd7ea6f6f2afbae2
BLAKE2b-256 b61db02228d1bebcba32653f93943308ec7cb5ffbc9464633acf6c7c6892b357

See more details on using hashes here.

File details

Details for the file jaas_ai-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: jaas_ai-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for jaas_ai-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 42b6ff55dddba1d82beb5413e097dcdf1e174ba5efb428dc86e8129d11645d5e
MD5 773cf9d6d306bbd8517a3340c1a22f1d
BLAKE2b-256 3be86c7e0c26972c0f4d06c984a6400de27606575a3b4e1903aa6f61866b5c0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page