Scripts2026年3月31日·1 分钟阅读

Chainlit — Build Conversational AI Apps Fast

Python framework for building production conversational AI interfaces in minutes. Chat UI, streaming, file upload, feedback, auth, and LangChain/LlamaIndex integration. 12K+ stars.

TO
TokRepo精选 · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

pip install chainlit
# app.py
import chainlit as cl

@cl.on_message
async def main(message: cl.Message):
    response = f"You said: {message.content}"
    await cl.Message(content=response).send()
chainlit run app.py

Open http://localhost:8000 — you have a chat UI.


介绍

Chainlit is a Python framework for building production conversational AI interfaces in minutes. It provides a polished chat UI with streaming, file upload, feedback collection, authentication, and data persistence — out of the box. Integrates natively with LangChain, LlamaIndex, Haystack, and any Python LLM library. 12,000+ GitHub stars, Apache 2.0.

Best for: Python developers who need a chat interface for their AI app without building frontend Works with: OpenAI, Anthropic, LangChain, LlamaIndex, Haystack, any Python LLM library


Key Features

Instant Chat UI

Beautiful, responsive chat interface with zero frontend code. Streaming, markdown, code highlighting, and LaTeX.

File Upload & Display

Users can upload files. Agents can send images, PDFs, and data visualizations.

Feedback & Human Evaluation

Built-in thumbs up/down feedback on AI responses. Export for fine-tuning.

Multi-Step Display

Show intermediate "thinking" steps, tool calls, and chain-of-thought reasoning.

Authentication

Built-in auth with OAuth (Google, GitHub) or custom login.

Data Persistence

Conversation history saved automatically. Resume sessions across visits.

Framework Integration

# LangChain integration
@cl.on_message
async def main(message):
    result = await chain.ainvoke({"input": message.content},
        callbacks=[cl.LangchainCallbackHandler()])
    await cl.Message(content=result).send()

FAQ

Q: What is Chainlit? A: A Python framework for building conversational AI interfaces in minutes — chat UI, streaming, file upload, feedback, and auth included. 12K+ stars.

Q: How is Chainlit different from Streamlit? A: Chainlit is purpose-built for chat/conversational AI with streaming, multi-step display, and LLM framework integrations. Streamlit is a general data app framework.


🙏

来源与感谢

Created by Chainlit. Licensed under Apache 2.0. Chainlit/chainlit — 12,000+ GitHub stars

相关资产