Build a complete RAG pipeline using Bailian for document ingestion, chunking, and embedding, deploy a RAG chatbot application on Elasticsearch as the vector search engine, and integrate EventBridge to route low-confidence answers and user feedback to DingTalk/Lark for human review — forming a closed-loop enterprise knowledge base with continuous quality improvement.
Use this combination when building an enterprise-grade RAG chatbot that requires high-accuracy vector search, continuous quality monitoring, and human-in-the-loop review. Bailian handles document parsing, chunking, and embedding, Elasticsearch powers low-latency ANN retrieval and chatbot orchestration, and EventBridge automatically routes low-confidence responses or negative user feedback to DingTalk/Lark for rapid knowledge base refinement.
POST https://dashscope.aliyuncs.com/api/v1/knowledge-bases/{kb_id}/documents with {"chunk_size": 500, "embedding_model": "text-embedding-v3"}.
"type": "dense_vector", "dims": 1024, "index": true, "similarity": "cosine".PUT /_ml/trained_models/bailian-rag-pipeline with a pipeline linking the vector field to https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation.
confidence_score and append a feedback hook. Emit structured JSON: {"event_type": "rag_response", "confidence": 0.62, "user_feedback": "thumbs_down", "query_id": "uuid"}.aliyun eb CreateRule --RuleName LowConfidenceRAG --EventPattern '{"source": ["custom.rag-app"], "detail": {"confidence": [{"numeric": ["<", 0.75]}]}}'
{"msgtype": "markdown", "markdown": {"title": "RAG Review Needed", "text": "Query: <detail.query_id>\nConfidence: <detail.confidence>"}}
Documents flow into Bailian for parsing, chunking, and vectorization. Embeddings sync to an Elasticsearch dense_vector index for fast ANN retrieval. User queries hit the ES-hosted chatbot, which retrieves top-k chunks, forwards them to Bailian’s LLM for synthesis, and returns the answer. Concurrently, the application emits telemetry (confidence scores, feedback) to EventBridge. EventBridge evaluates payloads against threshold rules and pushes formatted alerts to DingTalk/Lark webhooks, enabling SMEs to update the Bailian knowledge base and close the quality loop.
DASHSCOPE_API_KEY and ES cluster credentials.text-embedding-v3).dense_vector dims must exactly match Bailian’s output; otherwise, indexing fails with mapper_parsing_exception.msgtype or malformed markdown triggers 400 Bad Request and drops alerts.< 0.75 causes alert fatigue. Implement dynamic thresholds based on query category.POST /_refresh or set refresh_interval: "1s" during sync.