Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lighton.ai/llms.txt

Use this file to discover all available pages before exploring further.

Monitor and analyze platform usage with comprehensive reporting endpoints. Track user activity, chat sessions, and tool usage to gain insights into how your organization uses Paradigm.
Below is a possible use of the:
  • latest connections,
  • active users,
  • chat sessions,
  • tool usage.

Retrieve chat sessions

import requests
import os

# Get API key and base URL from environment
api_key = os.getenv("PARADIGM_API_KEY")
base_url = os.getenv("PARADIGM_BASE_URL", "https://paradigm.lighton.ai/api/v2")

url = f"{base_url}/reporting/chat-sessions/"

headers = {
    "Authorization": f"Bearer {api_key}",
    "Content-Type": "application/json"
}

params = {
    "company_id": 2,
    "start_date": "2025-01-01",  # Required
    # "end_date": "2025-04-01"   # Optional, defaults to today
}

response = requests.get(url, headers=headers, params=params)

if response.status_code == 200:
    try:
        data = response.json()
    except requests.JSONDecodeError:
        print("Received non-JSON response:", response.text)
else:
    print("Error:", response.status_code, response.text)
If you have a private Paradigm instance, please replace your base URL by your company’s instance.

Structure chat session data in a Pandas dataframe

import pandas as pd

# Flatten the structure
flattened_data = []
for entry in data["reporting"][0]["dates"]:
    flat_entry = {
        'date': entry['date'],
        'nb_sessions': entry['sessions']['sessions_count'],
        'unique_models': entry['sessions']['unique_models_count'],
        'average_session': entry['sessions']['average_session_length'],
        'user_queries': entry['chats']['user_queries_count'],
        'model_responses': entry['chats']['model_responses_count'],
        'model_responses_with_docs': entry['chats']['model_responses_with_docs_count'],
    }
    flattened_data.append(flat_entry)

# Create DataFrame
df_sessions = pd.DataFrame(flattened_data)

Going further with more endpoints

The same approach can be done with:
  • the feedbacks endpoint: /reporting/chats-feedback/
  • the tools usage endpoint: /reporting/tools/
Then, merging everything into the same dataframe allows a complete data analysis on the usage of the platform.