Add Library RAG project and cleanup root directory
- Add complete Library RAG application (Flask + MCP server) - PDF processing pipeline with OCR and LLM extraction - Weaviate vector database integration (BGE-M3 embeddings) - Flask web interface with search and document management - MCP server for Claude Desktop integration - Comprehensive test suite (134 tests) - Clean up root directory - Remove obsolete documentation files - Remove backup and temporary files - Update autonomous agent configuration - Update prompts - Enhance initializer bis prompt with better instructions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
31
generations/library_rag/utils/pdf_uploader.py
Normal file
31
generations/library_rag/utils/pdf_uploader.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Upload de fichiers PDF vers l'API Mistral."""
|
||||
|
||||
from mistralai import Mistral
|
||||
|
||||
|
||||
def upload_pdf(client: Mistral, file_bytes: bytes, filename: str) -> str:
|
||||
"""Upload un PDF vers Mistral et retourne l'URL signée.
|
||||
|
||||
Args:
|
||||
client: Client Mistral authentifié
|
||||
file_bytes: Contenu binaire du fichier PDF
|
||||
filename: Nom du fichier
|
||||
|
||||
Returns:
|
||||
URL signée du document uploadé
|
||||
"""
|
||||
# Upload du fichier
|
||||
uploaded = client.files.upload(
|
||||
file={
|
||||
"file_name": filename,
|
||||
"content": file_bytes,
|
||||
},
|
||||
purpose="ocr",
|
||||
)
|
||||
|
||||
# Récupération de l'URL signée
|
||||
signed = client.files.get_signed_url(file_id=uploaded.id)
|
||||
|
||||
return signed.url
|
||||
|
||||
|
||||
Reference in New Issue
Block a user