by baidubce
AppBuilder-SDK is a client-side SDK for Baidu AI Cloud Qianfan AppBuilder, designed to help developers flexibly and quickly build AI-native applications by providing tools for calling large models, orchestrating workflows, and deploying solutions.
AppBuilder-SDK is a client-side SDK provided by Baidu AI Cloud Qianfan AppBuilder for AI-native application developers. It aims to help developers build AI-native applications flexibly and quickly.
To use AppBuilder-SDK, you need Python 3.9 or higher. You can install it via pip:
python3 -m pip install --upgrade appbuilder-sdk
For Java, Go, or Docker usage, refer to the installation documentation. After installation, you can set your APPBUILDER_TOKEN
in the environment and start using the SDK to call large models, invoke capability components, or interact with AI-native applications.
AppBuilder-SDK provides essential functionalities for AI application developers:
KnowledgeBase
for CRUD operations on documents and knowledge slices, enabling the development of industrial-grade RAG applications with the web interface.Message
, Component
, and AgentRuntime
multi-level abstractions, and integrate with industry ecosystems like LangChain and OpenAI.AgentRuntime
supports deployment as an API service based on Flask
and gunicorn
.AgentRuntime
supports deployment as a conversational frontend based on Chainlit
.appbuilder_bce_deploy
tool for quick deployment to Baidu Cloud, offering public network API services and linking with AppBuilder workflows.AppBuilder-SDK can be used to build various applications, including:
AppBuilderClient
SDK after being created and published on the AppBuilder web interface.While the provided README does not have a dedicated FAQ section, common questions might include:
Cookbooks
and User Documentation
sections in the README for more examples and detailed documentation on various features and applications.appbuilder_bce_deploy
.百度智能云千帆AppBuilder-SDK是百度智能云千帆AppBuilder面向AI原生应用开发者提供的一站式开发平台的客户端SDK。
百度智能云千帆AppBuilder-SDK提供了以下AI应用开发者的必备功能:
RAG
应用Message
、Component
、AgentRuntime
多级工作流抽象,实现工作流编排,并可与LangChain、OpenAI等业界生态能力打通AgentRuntime
支持部署为基于Flask
与gunicorn
的API服务AgentRuntime
支持部署为基于Chainlit
的对话框交互前端appbuilder_bce_deploy
工具,可快速部署程序到百度云,提供公网API服务,联动AppBuilder工作流AppBuilder-SDK提供多类型组件,覆盖以下构建产业级RAG
应用的完整步骤:
AppBuilder-SDK不仅提供了百度智能云提供的基础能力组件,同时提供经过深度优化的大模型高级能力组件,可以组合下表提供的原子能力组件,构建个性化的RAG应用RAG 原子能力 CookBook:
阶段 | 组件名称 | 组件类型 | 组件链接 |
---|---|---|---|
文档解析 | 文档矫正增强 (DocCropEnhance) | 基础能力组件 | 链接 |
文档解析 | 文档格式转换 (DocFormatConverter) | 基础能力组件 | 链接 |
文档解析 | 文档解析(DocParser) | 基础能力组件 | 链接 |
文档解析 | 表格抽取组件(ExtractTableFromDoc) | 基础能力组件 | 链接 |
文档解析 | 通用文字识别-高精度版(GeneralOCR) | 基础能力组件 | 链接 |
文档切片 | 文档切分(DocSplitter) | 基础能力组件 | 链接 |
切片向量化 | 向量计算(Embedding) | 基础能力组件 | 链接 |
索引构建及切片召回 | 向量检索-VectorDB(BaiduVectorDBRetriever) | 基础能力组件 | 链接 |
索引构建及切片召回 | 向量检索-BES(BaiduElasticSearchRetriever) | 基础能力组件 | 链接 |
文档切片及答案生成 | 问答对挖掘(QAPairMining) | 高级能力组件 | 链接 |
文档切片及答案生成 | 相似问生成(SimilarQuestion) | 高级能力组件 | 链接 |
答案生成 | 标签抽取(TagExtraction) | 高级能力组件 | 链接 |
答案生成 | 复杂Query判定(IsComplexQuery) | 高级能力组件 | 链接 |
答案生成 | 复杂Query分解(QueryDecomposition) | 高级能力组件 | 链接 |
答案生成 | 多轮改写 (QueryRewrite) | 高级能力组件 | 链接 |
答案生成 | 阅读理解问答(MRC) | 高级能力组件 | 链接 |
答案生成 | 幻觉检测(Hallucination Detection) | 高级能力组件 | 链接 |
百度智能云千帆AppBuilder-SDK 更新记录&最新特性请查阅我们的版本说明
Python
版本安装,要求Python版本 >= 3.9
python3 -m pip install --upgrade appbuilder-sdk
Java
及 Go
版本安装,以及通过Docker
镜像使用,请查阅安装说明
- 请在
>=3.9
的Python环境安装appbuilder-sdk
后使用该端到端应用示例- 示例中提供了试用Token,访问和QPS受限,正式使用请替换为您的个人Token
Playground
组件可自由调用,您在百度智能云千帆大模型平台有权限的任何模型,并可自定义prompt
模板 与 模型参数import appbuilder
import os
# 设置环境中的TOKEN,以下TOKEN为访问和QPS受限的试用TOKEN,正式使用请替换为您的个人TOKEN
os.environ["APPBUILDER_TOKEN"] = "bce-v3/ALTAK-n5AYUIUJMarF7F7iFXVeK/1bf65eed7c8c7efef9b11388524fa1087f90ea58"
# 定义prompt模板
template_str = "你扮演{role}, 请回答我的问题。\n\n问题:{question}。\n\n回答:"
# 定义输入,调用playground组件
input = appbuilder.Message({"role": "java工程师", "question": "请简要回答java语言的内存回收机制是什么,要求100字以内"})
playground = appbuilder.Playground(prompt_template=template_str, model="Qianfan-Agent-Speed-8K")
# 以打字机的方式,流式展示大模型回答内容
output = playground(input, stream=True, temperature=1e-10)
for stream_message in output.content:
print(stream_message)
# 流式输出结束后,可再次打印完整的大模型对话结果,除回答内容外,还包括token的用量情况
print(output.model_dump_json(indent=4))
Java语言的
内存回收机制是通过垃圾回收器(Garbage Collector)来实现的。
垃圾回收器会自动检测不再使用的对象,并释放其占用的内存空间,从而确保系统的内存不会被耗尽。
Java提供了多种垃圾回收器,如串行回收器、并行回收器、CMS回收器和G1回收器等,以满足不同场景下的性能需求
。
{
"content": "Java语言的内存回收机制是通过垃圾回收器(Garbage Collector)来实现的。垃圾回收器会自动检测不再使用的对象,并释放其占用的内存空间,从而确保系统的内存不会被耗尽。Java提供了多种垃圾回收器,如串行回收器、并行回收器、CMS回收器和G1回收器等,以满足不同场景下的性能需求。",
"name": "msg",
"mtype": "dict",
"id": "2bbee989-40e3-45e4-9802-e144cdc829a9",
"extra": {},
"token_usage": {
"prompt_tokens": 35,
"completion_tokens": 70,
"total_tokens": 105
}
}
RAG with Baidu Search增强版
, 结合百度搜索的搜索引擎技术和ERNIE模型的语义理解能力,可以更准确地理解用户的搜索意图,并提供与搜索查询相关性更高的搜索结果import appbuilder
import os
# 设置环境中的TOKEN,以下TOKEN为访问和QPS受限的试用TOKEN,正式使用请替换为您的个人TOKEN
os.environ["APPBUILDER_TOKEN"] = "bce-v3/ALTAK-n5AYUIUJMarF7F7iFXVeK/1bf65eed7c8c7efef9b11388524fa1087f90ea58"
rag_with_baidu_search_pro = appbuilder.RagWithBaiduSearchPro(model="ERNIE-3.5-8K")
input = appbuilder.Message("9.11和9.8哪个大")
result = rag_with_baidu_search_pro.run(
message=input,
instruction=appbuilder.Message("你是专业知识助手"))
# 输出运行结果
print(result.model_dump_json(indent=4))
{
"content": "9.11小于9.8。在比较两个小数的大小时,需要逐位比较它们的数值,包括整数部分和小数部分。对于9.11和9.8,整数部分都是9,所以需要在小数部分进行比较。小数点后的第一位是1和8,显然1小于8,所以9.11小于9.8。",
"name": "msg",
"mtype": "dict",
"id": "eb31b7de-dd6a-485f-adb9-1f7921a6f4bf",
"extra": {
"search_baidu": [
{
"content": "大模型‘智商’受质疑:9.11 vs 9...",
"icon": "https://appbuilder.bj.bcebos.com/baidu-search-rag-pro/icon/souhu.ico",
"url": "https://m.sohu.com/a/793754123_121924584/",
"ref_id": "2",
"site_name": "搜狐网",
"title": "大模型‘智商’受质疑:9.11 vs 9.8的比较揭示AI理解能力的..."
},
{
"content": "究竟|9.11比9.8大?大模型们为何会...",
"icon": "https://appbuilder.bj.bcebos.com/baidu-search-rag-pro/icon/tencent.svg.png",
"url": "https://new.qq.com/rain/a/20240717A07JLV00",
"ref_id": "4",
"site_name": "腾讯网",
"title": "究竟|9.11比9.8大?大模型们为何会在小学数学题上集体..."
},
...
]
},
"token_usage": {
"completion_tokens": 77,
"prompt_tokens": 2008,
"total_tokens": 2085
}
}
import appbuilder
import os
# 设置环境中的TOKEN,以下TOKEN为访问和QPS受限的试用TOKEN,正式使用请替换为您的个人TOKEN
os.environ["APPBUILDER_TOKEN"] = "bce-v3/ALTAK-n5AYUIUJMarF7F7iFXVeK/1bf65eed7c8c7efef9b11388524fa1087f90ea58"
# 从AppBuilder网页获取并传入应用ID,以下为说唱导师应用ID
app_id = "4678492a-5864-472e-810a-654538d3503c"
app_builder_client = appbuilder.AppBuilderClient(app_id)
conversation_id = app_builder_client.create_conversation()
answer = app_builder_client.run(conversation_id, "以“上班狼狈却又追逐梦想“为主题进行一首说唱创作,保持押韵, 控制在200字以内")
print(answer.content.answer)
好的,我们来以“上班狼狈却又追逐梦想”为主题,进行一段简短的说唱创作。这里是一个简单的示例,你可以根据自己的感觉进行调整:
Intro:
朝九晚五,生活重压,
狼狈上班,却心怀梦想,
每一天,都是新的挑战,
为了那未来,我奋发向前。
Verse 1:
穿上西装,打好领带,
步入人群,去追逐名利,
虽然狼狈,却不曾言败,
因为心中,有梦想在激励。
Hook:
上班狼狈,却不曾放弃,
追逐梦想,是我心中的火炬,
照亮前路,指引我前行,
无论多难,我都要坚持到底。
这首小曲儿以“上班狼狈却又追逐梦想”为主题,通过押韵的方式表达了上班族虽然生活艰辛,但依然怀揣梦想,勇往直前的精神。希望你喜欢!
应用类型 | 应用链接 | 推荐理由 |
---|---|---|
基础能力组件 | 通用文字识别 | 体验百度AI开放平台提供的通用文字识别-高精度版的精准识别结果 |
基础能力组件 | 基础组件服务化 | 基础组件可通过flask实现服务化部署 或 通过chainlit实现可交互的前端部署,集成到您的系统中 |
流程编排 | Assistant SDK | 学习如何纯代码态搭建一个Agent应用,并实现自定义工作流程及FunctionCall |
端到端应用 | AppBuilder Client SDK | 使用AppBuilder网页端创建并发布一个Agent应用后,通过AppBuilderClient SDK集成到你的系统中 |
端到端应用 | Agent应用-工作流Agent | 使用AppBuilder网页端创建并发布一个工作流Agent应用后,通过AppBuilderClient SDK集成到你的系统中 |
端到端应用 | 通过AppBuilder-ToolCall功能实现端云组件联动的Agent | 学习Agent、FunctionCall的知识,并构造调用本地组件的Agent |
端到端应用 | 简历筛选小助手 | 通过对本地简历库的简历进行解析、切片、创建索引,实现基于JD进行简历筛选,并对筛选的Top1简历进行总结 |
端到端应用 | 企业级问答系统 | 学习如何通过SDK与网页平台搭配,实现离线知识库生产与在线问答 |
进阶应用 | 使用appbuilder_bce_deploy部署公有云服务 | 一键将自己的服务部署到百度智能云,部署后可以自动生成公网ip,联动工作流的API节点 |
进阶应用 | 使用appbuilder_trace_server实现对使用状态的跟踪 | 使用Appbuilder-SDK Trace功能实现对组件、应用调用情况的追踪 |
Github Issue: 提交安装/使用问题、报告bug、建议新特性、沟通开发计划等
AppBuilder-SDK遵循Apache-2.0开源协议。
Please log in to share your review and rating for this MCP.
Discover more MCP servers with similar functionality and use cases
by danny-avila
Provides a customizable ChatGPT‑like web UI that integrates dozens of AI models, agents, code execution, image generation, web search, speech capabilities, and secure multi‑user authentication, all open‑source and ready for self‑hosting.
by ahujasid
BlenderMCP integrates Blender with Claude AI via the Model Context Protocol (MCP), enabling AI-driven 3D scene creation, modeling, and manipulation. This project allows users to control Blender directly through natural language prompts, streamlining the 3D design workflow.
by pydantic
Enables building production‑grade generative AI applications using Pydantic validation, offering a FastAPI‑like developer experience.
by GLips
Figma-Context-MCP is a Model Context Protocol (MCP) server that provides Figma layout information to AI coding agents. It bridges design and development by enabling AI tools to directly access and interpret Figma design data for more accurate and efficient code generation.
by mcp-use
Easily create and interact with MCP servers using custom agents, supporting any LLM with tool calling and offering multi‑server, sandboxed, and streaming capabilities.
by sonnylazuardi
This project implements a Model Context Protocol (MCP) integration between Cursor AI and Figma, allowing Cursor to communicate with Figma for reading designs and modifying them programmatically.
by lharries
WhatsApp MCP Server is a Model Context Protocol (MCP) server for WhatsApp that allows users to search, read, and send WhatsApp messages (including media) through AI models like Claude. It connects directly to your personal WhatsApp account via the WhatsApp web multi-device API and stores messages locally in a SQLite database.
by idosal
GitMCP is a free, open-source remote Model Context Protocol (MCP) server that transforms any GitHub project into a documentation hub, enabling AI tools to access up-to-date documentation and code directly from the source to eliminate "code hallucinations."
by Klavis-AI
Klavis AI provides open-source Multi-platform Control Protocol (MCP) integrations and a hosted API for AI applications. It simplifies connecting AI to various third-party services by managing secure MCP servers and authentication.