iflytek / spark-ai-python

星火大模型 python sdk库
MIT License
203 stars 11 forks source link

流式Handler token计量 #13

Open whybeyoung opened 3 months ago

whybeyoung commented 3 months ago

缺失2个信息:

  1. 流式处理最后一帧没有在 handler中 放入 token计量信息
  2. 流式每一帧,理论也要按token计量,这里需要对齐 星火计量方法
whybeyoung commented 2 months ago

当前星火api 不支持每帧返回token计量,需等其正式支持后可支持。

当前已实现流式 最后一帧回调usage信息,用法请参考: https://github.com/iflytek/spark-ai-python?tab=readme-ov-file#%E6%96%B9%E5%BC%8F1-%E5%9B%9E%E8%B0%83%E5%87%BD%E6%95%B0