Metadata-Version: 2.4
Name: ulfblk-ai-rag
Version: 0.1.0
Summary: RAG pipeline: ChromaDB vector search + LLM gateway multi-provider (DeepSeek, OpenAI, Ollama)
Project-URL: Homepage, https://github.com/abelardodiaz/web25-991-bloques-reciclables
Project-URL: Documentation, https://github.com/abelardodiaz/web25-991-bloques-reciclables/tree/main/packages/python/ulfblk-ai-rag
Project-URL: Repository, https://github.com/abelardodiaz/web25-991-bloques-reciclables
Project-URL: Issues, https://github.com/abelardodiaz/web25-991-bloques-reciclables/issues
Author-email: Abelardo Diaz <abelardo@bloques.dev>
License-Expression: MIT
Keywords: ai,chromadb,deepseek,llm,ollama,openai,rag,vector-search
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Requires-Dist: ulfblk-core
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# bloque-ai-rag

RAG pipeline: ChromaDB vector search + LLM gateway multi-provider (DeepSeek, OpenAI, Ollama).

## Instalacion

```bash
uv add bloque-ai-rag
```

## Uso rapido

```python
from bloque_ai_rag.pipeline import RAGPipeline

# Crear pipeline con ChromaDB + DeepSeek
rag = RAGPipeline(
    collection="knowledge_base",
    llm_provider="deepseek",
)

async with rag:
    # Ingestar documentos
    await rag.ingest([
        "FastAPI es un framework web moderno para Python.",
        "ChromaDB es una base de datos vectorial open source.",
    ])

    # Consultar
    response = await rag.respond("Que es FastAPI?")
    print(response.answer)
    print(response.contexts)  # documentos relevantes
```

## Providers soportados

| Provider | API Base | Modelo default |
|----------|----------|---------------|
| `deepseek` | `https://api.deepseek.com` | `deepseek-chat` |
| `openai` | `https://api.openai.com` | `gpt-4o-mini` |
| `ollama` | `http://localhost:11434` | `llama3.2` |

## Componentes

- **ChromaClient** - Cliente HTTP para ChromaDB REST API (sin deps pesadas)
- **OpenAICompatibleClient** - Cliente para DeepSeek, OpenAI, y cualquier API compatible
- **OllamaClient** - Cliente para Ollama local
- **RAGPipeline** - Orquestador: query -> vector search -> context building -> LLM generation

## Multitenant

Con `ulfblk-multitenant` instalado, las colecciones se prefijan automaticamente con el tenant_id:

```python
rag = RAGPipeline(collection="knowledge_base", llm_provider="deepseek")
# Con tenant "acme" activo -> coleccion "acme__knowledge_base"
```

## Dependencias

- `ulfblk-core` (logging, health checks)
- `httpx>=0.27` (HTTP client async)

No requiere el paquete `chromadb` (~200MB). Usa ChromaDB REST API directamente.
