AI Skill Hub 强烈推荐:serverless-chat-langchainjs — RAG 知识库工具中文文档 是一款优质的AI工具。AI 综合评分 8.3 分,在同类工具中表现稳健。如果你正在寻找可靠的AI工具解决方案,这是一个值得深入了解的选择。
serverless-chat-langchainjs — RAG 知识库工具中文文档 是一款基于 TypeScript 开发的开源工具,专注于 ai-azd-templates、azd-templates、azure 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
serverless-chat-langchainjs — RAG 知识库工具中文文档 是一款基于 TypeScript 开发的开源工具,专注于 ai-azd-templates、azd-templates、azure 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:npm 全局安装 npm install -g serverless-chat-langchainjs # 方式二:npx 直接运行(无需安装) npx serverless-chat-langchainjs --help # 方式三:项目依赖安装 npm install serverless-chat-langchainjs # 方式四:从源码运行 git clone https://github.com/Azure-Samples/serverless-chat-langchainjs cd serverless-chat-langchainjs npm install npm start
# 命令行使用
serverless-chat-langchainjs --help
# 基本用法
serverless-chat-langchainjs [options] <input>
# Node.js 代码中使用
const serverless_chat_langchainjs = require('serverless-chat-langchainjs');
const result = await serverless_chat_langchainjs.run(options);
console.log(result);
# serverless-chat-langchainjs 配置说明 # 查看配置选项 serverless-chat-langchainjs --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export SERVERLESS_CHAT_LANGCHAINJS_CONFIG="/path/to/config.yml"
<img src="./packages/webapp/public/favicon.png" alt="" align="center" height="64" />
Building AI applications can be complex and time-consuming, but using LangChain.js and Azure serverless technologies allows to greatly simplify the process. This application is a chatbot that uses a set of enterprise documents to generate responses to user queries.
We provide sample data to make this sample ready to try, but feel free to replace it with your own. We use a fictitious company called Contoso Real Estate, and the experience allows its customers to ask support questions about the usage of its products. The sample data includes a set of documents that describes its terms of service, privacy policy and a support guide.
This application is made from multiple components:
packages/webapp folder.packages/api folder.We use the HTTP protocol for AI chat apps to communicate between the web app and the API.
There are multiple ways to get started with this project.
The quickest way is to use GitHub Codespaces that provides a preconfigured environment for you. Alternatively, you can set up your local environment following the instructions below.
[!IMPORTANT] If you want to run this sample entirely locally using Ollama, you have to follow the instructions in the local environment section.
Microsoft.Authorization/roleAssignments/write permissions, such as Role Based Access Control Administrator, User Access Administrator, or Owner. If you don't have subscription-level permissions, you must be granted RBAC for an existing resource group and deploy to that existing group.Microsoft.Resources/deployments/write permissions on the subscription level.See the cost estimation details for running this sample on Azure.
1. Open a terminal and navigate to the root of the project. 2. Authenticate with Azure by running azd auth login. 3. Run azd up to deploy the application to Azure. This will provision Azure resources, deploy this sample, and build the search index based on the files found in the ./data folder. - You will be prompted to select a base location for the resources. If you're unsure of which location to choose, select eastus2. - By default, the OpenAI resource will be deployed to eastus2. You can set a different location with azd env set AZURE_OPENAI_RESOURCE_GROUP_LOCATION <location>. Currently only a short list of locations is accepted. That location list is based on the OpenAI model availability table and may become outdated as availability changes.
The deployment process will take a few minutes. Once it's done, you'll see the URL of the web app in the terminal.
You can now open the web app in your browser and start chatting with the bot.
When deploying the sample in an enterprise context, you may want to enforce tighter security restrictions to protect your data and resources. See the enhance security guide for more information.
If you want to enable Continuous Deployment for your forked repository, you need to configure the Azure pipeline first:
1. Open a terminal at the root of your forked project. 2. Authenticate with Azure by running azd auth login. 3. Run azd pipeline config to configure the required secrets and variables for connecting to Azure from GitHub Actions. - This command will set up the necessary Azure service principal and configure GitHub repository secrets. - Follow the prompts to complete the configuration.
Once configured, the GitHub Actions workflow will automatically deploy your application to Azure whenever you push changes to the main branch.
To clean up all the Azure resources created by this sample:
azd down --purgeyThe resource group and all the resources will be deleted.
There are multiple ways to run this sample: locally using Ollama or Azure OpenAI models, or by deploying it to Azure.
If you have a machine with enough resources, you can run this sample entirely locally without using any cloud resources. To do that, you first have to install Ollama and then run the following commands to download the models on your machine:
ollama pull llama3.1:latest
ollama pull nomic-embed-text:latest
[!NOTE] The llama3.1 model with download a few gigabytes of data, so it can take some time depending on your internet connection.
After that you have to install the NPM dependencies:
npm install
Then you can start the application by running the following command which will start the web app and the API locally:
npm start
Then, open a new terminal running concurrently and run the following command to upload the PDF documents from the /data folder to the API:
npm run upload:docs
This only has to be done once, unless you want to add more documents.
You can now open the URL http://localhost:8000 in your browser to start chatting with the bot.
[!NOTE] While local models usually works well enough to answer the questions, sometimes they may not be able to follow perfectly the advanced formatting instructions for the citations and follow-up questions. This is expected, and a limitation of using smaller local models.
First you need to provision the Azure resources needed to run the sample. Follow the instructions in the Deploy the sample to Azure section to deploy the sample to Azure, then you'll be able to run the sample locally using the deployed Azure resources.
Once your deployment is complete, you should see a .env file in the packages/api folder. This file contains the environment variables needed to run the application using Azure resources.
To run the sample, you can then use the same commands as for the Ollama setup. This will start the web app and the API locally:
npm start
Open the URL http://localhost:8000 in your browser to start chatting with the bot.
Note that the documents are uploaded automatically when deploying the sample to Azure with azd up.
[!TIP] You can switch back to using Ollama models by simply deleting thepackages/api/.envfile and starting the application again. To regenerate the.envfile, you can runazd env get-values > packages/api/.env.
You need to install following tools to work on your local machine:
pwsh.exe from a PowerShell command. If this fails, you likely need to upgrade PowerShell.Then you can get the project code:
git clone <your-repo-url>
You can find answers to frequently asked questions in the FAQ.
If you have any issue when running or deploying this sample, please check the troubleshooting guide. If you can't find a solution to your problem, please open an issue in this repository.
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
总体来看,serverless-chat-langchainjs — RAG 知识库工具中文文档 是一款质量优秀的AI工具,在同类工具中具备一定竞争力。AI Skill Hub 将持续追踪其更新动态,建议收藏备用,结合自身场景选择合适时机引入使用。
| 原始名称 | serverless-chat-langchainjs |
| 原始描述 | Build your own serverless AI Chat with Retrieval-Augmented-Generation using LangChain.js, TypeScript and Azure |
| Topics | ai-azd-templatesazd-templatesazureazure-functionschatbotgenerative-airag |
| GitHub | https://github.com/Azure-Samples/serverless-chat-langchainjs |
| License | MIT |
| 语言 | TypeScript |
收录时间:2026-05-22 · 更新时间:2026-05-22 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。