Skip to main content
The official Python SDK for Meibel AI provides a simple, intuitive interface for all API operations.

Installation

pip install git+https://github.com/meibel-ai/meibelai-python.git

Quick Start

from meibelai import Meibelai
import os

# Initialize the client
client = Meibelai(
    api_key_header=os.getenv("MEIBELAI_API_KEY_HEADER")
)

# Make your first request
response = client.rag.chat(
    messages=[{"role": "user", "content": "Hello, Meibel!"}]
)
print(response.choices[0].message.content)

Features

  • Type Safety: Full type hints for better IDE support
  • Async Support: Both sync and async clients
  • Auto-retry: Built-in retry logic for resilience
  • Streaming: Real-time response streaming
  • Error Handling: Comprehensive error types

Client Options

client = Meibelai(
    api_key_header="your-api-key",
    base_url="https://api.meibel.ai",  # Optional custom endpoint
    timeout=30,  # Request timeout in seconds
    max_retries=3,  # Number of retries
    verify_ssl=True  # SSL verification
)

Async Usage

from meibelai import AsyncMeibelai
import asyncio

async def main():
    async with AsyncMeibelai(
        api_key_header=os.getenv("MEIBELAI_API_KEY_HEADER")
    ) as client:
        response = await client.rag.chat(
            messages=[{"role": "user", "content": "Hello!"}]
        )
        print(response)

asyncio.run(main())

Available Resources

  • client.datasources: Manage data sources
  • client.dataelements: Work with data elements
  • client.blueprints: Blueprint operations
  • client.rag: RAG chat operations
  • client.tagging: Tagging functionality
  • client.workflows: Workflow management

Error Handling

from meibelai.core import MeibelaiError

try:
    response = client.datasources.list()
except MeibelaiError as e:
    print(f"Error: {e.message}")
    print(f"Status: {e.status_code}")

Next Steps