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.3.tar.gz (6.0 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.3-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: botintel_sdk-0.0.3.tar.gz
  • Upload date:
  • Size: 6.0 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.3.tar.gz
Algorithm Hash digest
SHA256 fc0effc108d90419e819ced4a09289e0eb0ee58612cf36b69fe4d08ec6dab5ec
MD5 915eb5ad1c9423ab721647b0a74e53c5
BLAKE2b-256 595fad7fbdc794511a134021e4e14b52d56c889b3400524922d2b5c9046877bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: botintel_sdk-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6c0a0e159650da333493fea6427418f27ce7f94583a769ead2ddeea79ef8b4d9
MD5 916c3bf4f1083ab17daf27455585fefe
BLAKE2b-256 4421e9becbd062a514458ce698c55290a3025457c34d593cedc097cd0ac5eb56

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