Metadata-Version: 2.3
Name: condy
Version: 0.2.4
Summary: Python client for the Condensation.ai API
Project-URL: Homepage, https://github.com/yourusername/condy
Project-URL: Documentation, https://justrach/condy
Project-URL: Repository, https://github.com/justrach/condy.git
Project-URL: bug tracker, https://github.com/yourusername/condy/issues
Author-email: Rach Pradhan <rach@condensation.ai>
License-Expression: MIT
Keywords: ai,api-client,condensation,rag
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: httpx>=0.24.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: isort>=5.12.0; extra == 'dev'
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.0.270; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.0.0; extra == 'docs'
Requires-Dist: mkdocs>=1.4.0; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.22.0; extra == 'docs'
Description-Content-Type: text/markdown

# Condy: Python Client for Condensation.ai

A modern, async Python client library for interacting with the Condensation.ai API, providing seamless access to document processing and RAG (Retrieval-Augmented Generation) capabilities.

## Features

- 🚀 Fully async implementation using `httpx`
- 📄 Document processing and chunking
- 🔍 RAG (Retrieval-Augmented Generation) querying
- 💪 Type hints and modern Python practices
- ⚡ Efficient markdown processing and page management
- 🛡️ Comprehensive error handling

## Installation

```bash
pip install condy
```

## Quick Start

```python
import asyncio
from condy import CondyClient

async def main():
    # Initialize the client
    client = CondyClient(api_key="your-api-key")
    
    # Process a document from URL
    doc_output = await client.process_document("https://example.com/document.md") | await client.process_document("https://example.com/document.pdf")
    
    # Query the document using RAG
    response = await client.query_rag(
        question="What are the key points?",
        document_id=doc_output.document_id
    )
    
    print(response.answer)

asyncio.run(main())
```

## Core Features

### Document Processing

```python
# Upload pages directly
pages = {
    1: "Page 1 content",
    2: "Page 2 content"
}
doc_output = await client.upload_pages(pages)

# Or process markdown from URL
doc_output = await client.process_document("https://example.com/document.md")
```

### RAG Queries

```python
# Query a document
response = await client.query_rag(
    question="What does the document say about X?",
    document_id="doc-id",
    max_chunks=5
)

# Access the response
print(response.answer)
print(response.source_pages)  # List of source pages used
```

### Chunk Management

```python
# Fetch document chunks
chunks = await client.fetch_chunks(
    document_id="doc-id",
    include_embeddings=False  # Set to True to include vector embeddings
)
```

## Configuration

The client can be configured with custom settings:

```python
client = CondyClient(
    api_key="your-api-key",
    base_url="https://custom-url.example.com",  # Optional
    timeout=60.0  # Custom timeout in seconds
)
```

## Error Handling

The library provides specific exceptions for different error cases:

- `NetworkError`: For connection and network-related issues
- `TimeoutError`: For request timeout issues
- `APIError`: For API-specific errors with status codes and details

```python
from condy import NetworkError, TimeoutError, APIError

try:
    response = await client.query_rag(question="...", document_id="...")
except TimeoutError:
    print("Request timed out")
except NetworkError:
    print("Network error occurred")
except APIError as e:
    print(f"API error: {e.status_code} - {e.detail}")
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

[License information here]

## Support

For support, please [contact information here]