Comments (5)
请问可以更详细地描述你的需求/问题吗?
从标题来看,ERNIE-Bot-SDK目前支持流式接口(处理server-sent events),只需要在调用erniebot.ChatCompletion
时指定stream=True
即可。详情请参考API文档。
from ernie-sdk.
from ernie-sdk.
参考文档中的描述,我写了一个例子,在自己的环境里测试是可用的。设置好鉴权参数之后执行:
python -c "import operator; import erniebot; response = erniebot.ChatCompletion.create(model='ernie-bot-turbo', messages=[{'role': 'user', 'content': '深圳周末上哪玩?'}], stream=True); print(''.join(map(operator.attrgetter('result'), response)))"
会打印类似如下结果:
深圳周末有很多好玩的地方,以下是一些推荐:
1. 海上世界:海上世界是一个集娱乐、餐饮、购物于一体的综合性娱乐场所,位于深圳市南山区蛇口海景广场。这里有着豪华游轮、酒吧、餐厅、水族馆、海洋公园等众多娱乐设施,是深圳周末休闲的好去处。
2. 华侨城:华侨城是一个集旅游、文化、娱乐等多种功能于一体的综合性主题公园,包括欢乐谷、世界之窗、锦绣中华民俗文化村等多个主题公园。这里适合家庭出游,可以体验各种不同的文化氛围和娱乐活动。
3. 深圳湾公园:深圳湾公园是一个以自然风光为主的城市公园,位于深圳市南山区深圳湾畔。这里有着广阔的草坪、湖泊、河流等自然景观,还有各种户外运动设施和休闲场所,是深圳周末休闲的好去处。
4. 世界之窗:世界之窗是一个以世界著名景点为主题的旅游景区,位于深圳市南山区深南大道。这里有着100多个世界著名景点的微缩模型,包括埃菲尔铁塔、比萨斜塔等,是拍照留念的好地方。
5. 华强北电子科技广场:华强北电子科技广场是一个以电子产品为主的购物广场,位于深圳市福田区。这里有着各种各样的电子产品,包括手机、电脑、相机等,是科技爱好者的天堂。
以上是一些深圳周末休闲的好去处,希望能对你有所帮助。
看起来是符合预期的。
我不太明白你给出的链接和本issue的关联。链接的页面看起来是一个大模型相关的开源Python库的文档,包含了一些API使用示例,但其中并没有明确提到和“流式调用”相关的内容。如果你想要提出的问题和链接页面的内容有关,请做出进一步解释~
from ernie-sdk.
from ernie-sdk.
我注意到在流式接口的实现中确实存在一个bug,导致流式接口事实上以非流式的方式工作(效率甚至低于非流式接口)。我在上面提到的PR中修复了这个问题。
感谢反馈bug~
from ernie-sdk.
Related Issues (20)
- 请问支持tool_calls吗? HOT 7
- 请问使用ERNIE Bot Agent开发,怎么设置system呢? HOT 19
- 多代理模式目前实现了吗 HOT 9
- 自定义 Remote Tool,FastAPI 的web 服务
- 官方提供的remote tool识别ocr报错
- 请求对agents的文档和使用说明进行补全 HOT 1
- 有计划出rust的SDK么 HOT 2
- 请问我自定义的本地工具报这个错误咋回事 for field_name, field_info in cls.model_fields.items(): AttributeError: type object 'BihaiAddTimeIn' has no attribute 'model_fields' HOT 5
- 请问能够接入其他的模型吗?
- ernie-bot-agent 不支持在aistudio的notebook环境中运行 HOT 3
- 自己写了一个RUST SDK,有大佬愿意看看嘛哈哈哈 HOT 1
- function call出了正确结果了,但是最后一步模型回答的还是错误的答案。 HOT 5
- 运行question_bot.py报错请问是哪里出问题了,安装了langchain-community依然报错 HOT 2
- faiss升级faiss.swigfaiss.IndexFlatIP改为faiss.IndexFlatIP HOT 1
- 多代理模式目前实现了吗,coze那个设计的不错 HOT 2
- 星河社区的token(令牌)采用智能体包中的ERNIEBot访问时报[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')(在Aistudio中调用是正常的) HOT 4
- RemoteToolkit.from_url("http://127.0.0.1:8020")读取openapi.yaml成功,但解析时报错。 HOT 3
- 智能体需要多次执法FC,而在文心返回结果中只有一个FC及其相关参数 HOT 3
- 请问一下运行retrieval_function_call的时候报错是什么原因
- 字段命名拼写错误 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ernie-sdk.