Inspeq AI
  • Introduction
  • Registration Process
  • Quickstart
  • Metrics
  • Benchmarking Results
  • Response Structure Details
  • Default Config
  • Root Cause Analysis (RCA)
  • On-Premise Deployment Overview
  • On-Premise AWS Deployment Guide
  • API Overview
  • Authentication
  • Endpoints
Powered by GitBook
On this page
  • Installation
  • Inspeq Python package installation

Quickstart

PreviousRegistration ProcessNextMetrics

Last updated 7 months ago

Installation

Activate the python environment

  source venv/bin/activate

Inspeq Python package installation

To install inspeqai python sdk, you can follow these steps:

Get latest version from

pip install inspeqai

Install dotenv package if not installed already

Get latest version from

pip install python-dotenv

Get API keys

Get your API keys from

Usage

Create a python file like main.py where you could use the functions provided by inspeq python sdk.


from inspeq.client import InspeqEval

# Initialize the client
INSPEQ_API_KEY = "your_inspeq_sdk_key"
INSPEQ_PROJECT_ID = "your_project_id"
INSPEQ_API_URL = "your_inspeq_backend_url" #  NOTE : Required only for our on-prem customers


inspeq_eval = InspeqEval(inspeq_api_key=INSPEQ_API_KEY, inspeq_project_id=INSPEQ_PROJECT_ID)


# Prepare input data
input_data = [{
    "prompt": "What is the capital of France?",
    "response": "Paris is the capital of France.",
    "context": "The user is asking about European capitals."
}]
# You can pass multiple set of input data object

# Define metrics to evaluate
metrics_list = ["RESPONSE_TONE", "FACTUAL_CONSISTENCY", "ANSWER_RELEVANCE"]

try:
    results = inspeq_eval.evaluate_llm_task(
        metrics_list=metrics_list,
        input_data=input_data,
        task_name="capital_question"
    )
    print(results)
except Exception as e:
    print(f"An error occurred: {str(e)}")
    
Here
Here
Here