Python SDK
Installation
Requirements
- Python 3.8 or higher
- httpx for HTTP client
- pydantic for data validation
- typing-extensions for Python < 3.11
Quick Start
Synchronous Client
Asynchronous Client
Authentication
Get your API key from your Plugged.in Profile:Core Features
Document Management
List Documents
Get Document
Search Documents
Create AI-Generated Document
Update Document
RAG Operations
Simple Query
Query with Sources
Find Relevant Documents
File Uploads
Important: Direct file uploads are no longer available via the public API. Theclient.uploadshelpers now raise descriptive errors so legacy code fails fast. Use the Plugged.in web interface or upcoming ingestion pipeline for binary assets. AI-generated documents remain available throughclient.documents.createandclient.uploads.upload_document.
Async Operations
Concurrent Operations
Async RAG Queries
Error Handling
The SDK provides typed exceptions for better error handling:Type Safety with Pydantic
The SDK uses Pydantic models for comprehensive type safety:Advanced Configuration
Custom HTTP Client
Retry Configuration
Logging Configuration
Environment Variables
Store your API key securely using environment variables:Rate Limiting
The SDK automatically handles rate limiting with exponential backoff:- API Endpoints: 60 requests per minute
- Document Search: 10 requests per hour for AI documents
- RAG Queries: Subject to plan limits
Testing
Unit Testing with Mock
Integration Testing
Examples
Complete working examples are available in the GitHub repository:- Basic Usage
- Document Management
- RAG Queries
- File Upload (deprecated)
- Async Operations
- Error Handling
API Reference
Client Classes
| Class | Description |
|---|---|
PluggedInClient | Synchronous API client |
AsyncPluggedInClient | Asynchronous API client |
Configuration Options
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | required | Your Plugged.in API key |
base_url | str | https://plugged.in | API base URL |
timeout | float | 60.0 | Request timeout in seconds |
max_retries | int | 5 | Maximum retry attempts |
debug | bool | False | Enable debug logging |
Document Methods
| Method | Description |
|---|---|
list(filters) | List documents with optional filters |
get(id, include_content, include_versions) | Get a specific document |
search(query, filters, limit, offset) | Search documents semantically |
create(title, content, metadata) | Create a new document |
update(id, request) | Update an existing document |
delete(id) | Delete a document |
RAG Methods
| Method | Description |
|---|---|
query(query) | Returns RagResponse with answer and metadata |
ask_question(query) | Simple RAG query (answer text only) |
query_with_sources(query) | Query with structured source metadata |
find_relevant_documents(query, limit) | Find relevant documents |
check_availability() | Check RAG service availability |
get_storage_stats(user_id) | Get storage statistics |
Upload Methods
Upload helpers now raise descriptive errors because binary ingestion is no longer available via the public API.Support
- PyPI Package: https://pypi.org/project/pluggedinkit/
- GitHub Issues: Report bugs and request features
- Documentation: https://docs.plugged.in
- Discord: Join our community

