baidubce / app-builder Goto Github PK
View Code? Open in Web Editor NEWappbuilder-sdk, 千帆AppBuilder-SDK帮助开发者灵活、快速的搭建AI原生应用
Home Page: https://appbuilder.cloud.baidu.com/
License: Apache License 2.0
appbuilder-sdk, 千帆AppBuilder-SDK帮助开发者灵活、快速的搭建AI原生应用
Home Page: https://appbuilder.cloud.baidu.com/
License: Apache License 2.0
期望:百度云正式登陆环境
ERNIE Speed-AppBuilder用不了,ERNIE-Bot 4.0调用太慢,ERNIE-Bot和ERNIE-Bot-turbo效果差,所以GBI什么时候能升级一下
import appbuilder
os.environ["APPBUILDER_TOKEN"] = "bce-YOURTOKEN"
print(appbuilder.show_model_list())
期望结果
当前可以使用的模型列表如下:
Erniebot4-8k
Llama2-13b
...
当前appbuilder依赖了一个非常早期的pydantic版本(https://github.com/baidubce/app-builder/blob/master/requirements.txt#L3 )
当前很多三方组件不兼容此版本,建议升级到2.x版本。
文档解析在使用手册中是免费使用的,但我使用示例代码进行文档解析,返回权限错误。这是什么原因呢?而我使用同样的API KEY进行TTS是可以正常返回结果的。
以下是具体报错信息:
Traceback (most recent call last):
File "/home/yxliu56/code/work/app-builder/docprase.py", line 42, in
parse_result = parser(msg, return_raw=True)
File "/home/yxliu56/code/work/app-builder/appbuilder/core/component.py", line 94, in call
return self.run(*inputs, **kwargs)
File "/home/yxliu56/code/work/app-builder/appbuilder/core/components/doc_parser/doc_parser.py", line 126, in run
self.check_response_header(response)
File "/home/yxliu56/code/work/app-builder/appbuilder/core/component.py", line 149, in check_response_header
raise BaseRPCException(message)
appbuilder.core._exception.BaseRPCException: request_id=30d05399-ea69-4b10-93be-0dcebb70e255 , http status code is 401, body is {"requestId":"30d05399-ea69-4b10-93be-0dcebb70e255","code":216003,"message":"Authentication error: ( Unsupported authorization header type )"}
以下是我的调用代码
`import os
os.environ["APPBUILDER_TOKEN"] = "我的百度apikey,是复制的SDK密钥中的API KEY"
from appbuilder.core.components.doc_parser.doc_parser import DocParser
from appbuilder.core.components.doc_splitter.doc_splitter import DocSplitter
from appbuilder.core.message import Message
file_path = "text.pptx" # 待解析的文件路径
msg = Message(file_path)
parser = DocParser()
parse_result = parser(msg)
print(parse_result.content)`
使用的是txt文本文档
设置的参数如下
splitter = DocSplitter(splitter_type="split_by_chunk", max_segment_length=50, overlap=0,
separators=["。", "!", "?", ".", "!", "?", "……", "|\n", "\\n", "\n", ";"])
最终返回结果始终只有一段,且超过设置的50字
https://github.com/baidubce/app-builder/blob/master/cookbooks/console_rag.ipynb
appbuilder.core._exception.AppBuilderServerException: request_id=3a2f2a81-d557-47d1-96f7-9aa6c13330c7, code=1039, message=应用服务已下线,请前往应用中心创建新应用(跳转URL:https://console.bce.baidu.com/ai_apaas/appCenter), service_err_code=, service_err_message=
class MRC(CompletionBaseComponent):
"""
阅读理解问答组件,基于大模型进行阅读理解问答,支持拒答、澄清、重点强调、友好性提升、溯源等多种功能,可用于回答用户提出的问题。
Examples:
.. code-block:: python
import appbuilder
os.environ["APPBUILDER_TOKEN"] = '...'
mrc_component = appbuilder.MRC()
# 获取功能说明
instructions = mrc_component.get_instruction_set()
# 输出功能说明
for key, value in instructions.items():
print(f"{key}: {value}")
# 模拟运行MRC组件,开启澄清和友好性提升功能
result = mrc_component.run(appbuilder.Message("什么是人工智能?"), clarify=True, friendly=True)
# 输出运行结果
print(result)
当前面向开发者提供开放的数据结构,包括Message和Component,方便开发者融入个人已有的大模型应用程序。此部分仍在不断建设中。
消息(Message)
构建大模型应用的统一数据结构,基于Pydantic构建,在不同的Component之间流动。Message几类的默认字段是content,类型是Any。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.