New to Kestra?
Use blueprints to kickstart your first workflows.
Orchestrate automated RAG retrieval evaluation with Cohere cross-encoder reranking and conditional Slack alerting gates in Kestra.
Retrieval-Augmented Generation (RAG) applications frequently suffer from noisy context when standard vector cosine similarity returns irrelevant documents. Cross-encoder reranking models (such as Cohere Rerank) dramatically improve generation quality by scoring exact query-document semantic pairs before injecting context into the LLM prompt.
This blueprint automates end-to-end RAG retrieval optimization: it pulls candidate document chunks, applies semantic reranking, computes aggregate retrieval confidence scores, and gates downstream inference with conditional Slack operational alerts.
retrieve_candidate_chunks (io.kestra.plugin.core.http.Request): Simulates retrieving candidate document chunks from knowledge bases or vector indices.rerank_with_cohere (io.kestra.plugin.scripts.python.Script): Executes a containerized Python cross-encoder evaluation scoring candidate relevance against the user query, selects the top-k matches, and emits aggregate metrics via Kestra.outputs.evaluate_retrieval_confidence (io.kestra.plugin.core.flow.If): Tests whether average retrieval confidence meets operational SLA ($\ge 85%$). Dispatches notify_high_confidence on success or notify_low_confidence_fallback when relevance is suboptimal.alert_on_reranker_failure (errors block): Triggers immediately if API quotas or network timeouts occur, routing an incident alert to Slack with the execution ID.nightly_benchmark_schedule) to measure knowledge base retrieval drift over time.Coordinating hybrid vector search, cross-encoder APIs, and LLM completions requires strict error handling, secret isolation, and conditional routing. Kestra enables data and AI teams to declaratively wire retrieval pipelines without managing custom Celery queues or monolithic microservices.
COHERE_API_KEY: API key for Cohere Rerank endpoints.SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint for workflow alerts.COHERE_API_KEY and SLACK_WEBHOOK_URL in your Kestra namespace secrets.user_query and top_k_rerank inputs to test different retrieval workloads.retrieve_candidate_chunks directly to Qdrant (io.kestra.plugin.qdrant), Pinecone, or Weaviate vector stores.io.kestra.plugin.openai).