🐍

Python SDK

Official Python client library for Summize.app

Installation

Get started with the Python SDK

pip

terminal
pip install summize

Install from PyPI using pip.

conda

terminal
conda install -c conda-forge summize

Install from conda-forge channel.

Quick Start

Get up and running in minutes

Basic Usage

python
import summize

# Initialize with your API key
client = summize.Client('your-api-key')

# Generate a summary
result = client.summarize(
    data=sales_data,
    format='narrative',
    style='executive'
)

print(result.summary)

API Reference

Complete documentation of all methods and options

Client(api_key, **kwargs)

client = summize.Client('your-api-key', timeout=30)

Parameters

  • api_key (str) - Your Summize API key
  • timeout (int) - Request timeout in seconds
  • base_url (str) - Custom API base URL
  • retries (int) - Number of retry attempts

Attributes

  • api_key - Your API key
  • timeout - Request timeout
  • base_url - API base URL

summarize(data, format='narrative', style='business', max_length=None)

Generate AI-powered summaries from your data

result = client.summarize(
    data=sales_data,
    format='narrative',
    style='executive',
    max_length=500
)

Parameters

  • data - Your data to summarize
  • format - 'narrative' | 'bullet' | 'executive'
  • style - 'technical' | 'business' | 'casual'
  • max_length - Maximum summary length

Returns

  • summary - Generated summary text
  • insights - List of key insights
  • confidence - Confidence score (0-1)
  • processing_time - Processing time in seconds

get_reports(limit=10, offset=0, status=None)

Retrieve generated reports and summaries

reports = client.get_reports(
    limit=10,
    offset=0,
    status='completed'
)

Parameters

  • limit - Number of reports to return
  • offset - Pagination offset
  • status - Filter by status

Returns

  • reports - List of report objects
  • total - Total number of reports
  • has_more - Whether more reports exist

Examples

Common use cases and patterns

Pandas DataFrame

import pandas as pd
import summize

# Load your data
df = pd.read_csv('sales_data.csv')

# Convert to dict for summarization
data = {
    'total_sales': df['sales'].sum(),
    'avg_order': df['sales'].mean(),
    'top_products': df.groupby('product')['sales'].sum().nlargest(5).to_dict()
}

# Generate summary
result = client.summarize(data, format='executive')
print(result.summary)

Error Handling

from summize import SummizeError

try:
    result = client.summarize(data)
    print(result.summary)
except SummizeError as e:
    if e.code == 'RATE_LIMIT':
        print('Rate limit exceeded')
    elif e.code == 'INVALID_API_KEY':
        print('Invalid API key')
    else:
        print(f'Error: {e.message}')
except Exception as e:
    print(f'Unexpected error: {e}')

Data Science Integration

Perfect for Jupyter notebooks and data analysis workflows

Jupyter Notebook

# In your Jupyter notebook
import summize
import matplotlib.pyplot as plt

# Analyze sales data
sales_summary = client.summarize(sales_data)
print("📊 Sales Summary:")
print(sales_summary.summary)

# Get insights
for insight in sales_summary.insights:
    print(f"💡 {insight}")

Batch Processing

# Process multiple datasets
datasets = [sales_data, marketing_data, user_data]
summaries = []

for data in datasets:
    summary = client.summarize(data)
    summaries.append(summary)

# Combine insights
all_insights = []
for summary in summaries:
    all_insights.extend(summary.insights)

Migration Guide

Upgrading from previous versions

Version 2.0 Breaking Changes

  • • Client constructor now requires API key as first parameter
  • • All methods now return Response objects with attributes
  • • Improved error handling with custom exceptions
  • • Better support for async operations

Ready to get started?

Install the Python SDK and start building with Summize.