Skip to main content

Official Python SDK for BotIntel API

Project description

BotIntel Python SDK

PyPI version Python Versions License: MIT Documentation

The official Python client for BotIntel's enterprise-grade AI API, featuring multi-model support, real-time web integration, and advanced analytics.

# Basic Example
from botintel import Client

client = Client(api_key="your_api_key")
response = client.chat.completions.create(
    model="botintel-v3",
    messages=[{"role": "user", "content": "Latest AI breakthroughs in 2024"}]
)
print(response)

Table of Contents

Features

🌐 Web-enhanced responses with real-time data

🧮 Advanced token accounting system

⚡ Streaming support with partial responses

🔒 Enterprise-grade security (SOC 2 compliant)

📈 Built-in usage analytics

♻️ Automatic retries with exponential backoff

Installation

pip install botintel

Quick Start

from botintel import Client

# Initialize with API key
client = Client(api_key="bix-your-api-key-here")

# Basic chat completion
response = client.chat.completions.create(
    model="botintel-v3",
    messages=[
        {"role": "system", "content": "You are a senior developer"},
        {"role": "user", "content": "Explain monorepo architecture"}
    ]
)

print(f"Response: {response.choices[0].message.content}")
print(f"Tokens Used: {response.usage.total_tokens}")

Available Models

Model Name Context Window Best For Web Access
botintel-v3 8K tokens General purpose AI
botintel-pro 32K tokens Technical problem solving
botintel-v3-search 4K tokens Real-time information
imagen-1 N/A Basic image generation
imagen-2 N/A Advanced image generation (latest and most improved)

Usage Examples

Web-Enhanced Search

response = client.chat.completions.create(
    model="botintel-v3-search",
    messages=[
        {"role": "user", "content": "Current USD to EUR exchange rate"}
    ],
    web_search=True,
    cite_sources=True
)

print(response.choices[0].message.content)
# Output might include: [Source: European Central Bank, 2024-03-15]

Technical Analysis (Pro Model)

response = client.chat.completions.create(
    model="botintel-pro",
    messages=[
        {"role": "user", "content": "Optimize this Python code..."},
        {"role": "assistant", "content": "Current code: ..."},
    ],
    temperature=0.2,
    max_tokens=1000
)

Error Handling

from botintel import exceptions

try:
    response = client.chat.completions.create(...)
except exceptions.InsufficientBalanceError as e:
    print(f"Payment required: {e.balance_needed}")
    # Auto-recharge logic here
except exceptions.RateLimitError as e:
    print(f"Retry after: {e.retry_after} seconds")
except exceptions.APIError as e:
    print(f"Server error: {e.status_code}")

Advanced Features

Streaming Responses

stream = client.chat.completions.create(
    model="botintel-v3",
    messages=[{"role": "user", "content": "Tell me a story..."}],
    stream=True,
    temperature=0.7
)

for chunk in stream:
    print(chunk.choices[0].delta.content, end="", flush=True)

Usage Analytics

# Get current balance
balance = client.get_balance()
print(f"Remaining balance: ${balance:.2f}")

# Get usage statistics
usage = client.get_usage(start_date="2024-01-01")
print(f"Total tokens used: {usage.total_tokens}")

Pricing

Model Input ($/1k tokens) Output ($/1k tokens)
botintel-v3 0.27 1.10
botintel-pro 0.55 2.19
botintel-search 0.35 1.45
Volume discounts available for >1M tokens/month

Configuration

client = Client(
    api_key="your_key",
    base_url="https://api.botintel.ai/v1",  # Custom endpoint
    timeout=30.0,          # Request timeout in seconds
    max_retries=5,         # Automatic retries
    cache_enabled=True,    # Response caching
    debug=False            # Enable debug logging
)

Deployment

Recommended Architecture

                          +-----------------+
                          |   Load Balancer |
                          +--------+--------+
                                   |
                          +--------+--------+
                          |    API Servers   |
                          +--------+--------+
                                   |
                          +--------+--------+
                          |  PostgreSQL DB  |
                          +-----------------+
                          |   Redis Cache   |
                          +-----------------+

Docker Setup

# Dockerfile.prod
FROM python:3.11-slim

WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["gunicorn", "app:create_app()", "--bind", "0.0.0.0:8000", "--workers", "4"]

Contributing

  • Fork the repository
  • Create feature branch (git checkout -b feature/amazing-feature)
  • Commit changes (git commit -m 'Add amazing feature')
  • Push to branch (git push origin feature/amazing-feature)
  • Open Pull Request

License

MIT License - See LICENSE for details.

Support

📧 Enterprise Support: botintelai1@gmail.com

💬 Community: Discord Server

📄 Documentation

⬆ Back to Top

Copy

To use this README:

  1. Save as README.md
  2. Update placeholder URLs (status page, docs, etc.)
  3. Add your LICENSE file
  4. Customize deployment details as needed

The file includes:

  • Interactive code examples
  • Detailed model comparisons
  • Error handling patterns
  • Deployment architecture diagrams
  • Complete pricing information
  • Docker configuration examples
  • Support resources

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

botintel_sdk-0.0.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

botintel_sdk-0.0.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file botintel_sdk-0.0.2.tar.gz.

File metadata

  • Download URL: botintel_sdk-0.0.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for botintel_sdk-0.0.2.tar.gz
Algorithm Hash digest
SHA256 63e208030d55520d7fa043724a954fb1c8b9e1b48df18d4bb3204699435301f4
MD5 7341247d76f188ca585e7e8306374de9
BLAKE2b-256 5565f3e6d840ad3f3a1478552f35ef2205b04953690a8074ae3942bb621fe704

See more details on using hashes here.

File details

Details for the file botintel_sdk-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: botintel_sdk-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for botintel_sdk-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0cf0f093bb2a818d671f973188f9ad9f5b06a5f9d52e1a732950441465922bbb
MD5 919488b87af33f6be14395e59da3dffb
BLAKE2b-256 bc15fdd1ed682d5ba8d5011511ad7c6ff7c1d5baba766316b962e67682499f09

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