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.4.tar.gz (6.3 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.4-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: botintel_sdk-0.0.4.tar.gz
  • Upload date:
  • Size: 6.3 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.4.tar.gz
Algorithm Hash digest
SHA256 9c78f23ecca1eeacd4a18c706ce6b20e39951778999fe4b4ca413c4293a44380
MD5 e3d9abe87c9f9e4b14e28faeb50307e1
BLAKE2b-256 3baa5554a7d05f9599d10dc7fa9131af24a6a05e91be96cd3d936e4b9cf2b098

See more details on using hashes here.

File details

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

File metadata

  • Download URL: botintel_sdk-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ee729b6c2226b747a960b809fc693cd3c55178d2b4e12ab5d3f5063af01614cf
MD5 de114a6d0c8cd5d5480cd4418ed7fcf5
BLAKE2b-256 6f7e284c6714d52524d281d13c8c8a3c7240703ff1e8f7b3c1eebf42006735d9

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