add qianfan ut code and update xx_llm from xx_gpt

This commit is contained in:
better629 2024-02-07 18:32:32 +08:00
parent dc240a2efd
commit d3f6e38e8a
11 changed files with 153 additions and 80 deletions

View file

@ -5,6 +5,7 @@ import copy
import os
import qianfan
from qianfan import ChatCompletion
from qianfan.resources.typing import JsonBody
from tenacity import (
after_log,
@ -78,7 +79,7 @@ class QianFanLLM(BaseLLM):
# self deployed model on the cloud not to calculate usage, it charges resource pool rental fee
self.calc_usage = self.config.calc_usage and self.config.endpoint is None
self.aclient = qianfan.ChatCompletion()
self.aclient: ChatCompletion = qianfan.ChatCompletion()
def _const_kwargs(self, messages: list[dict], stream: bool = False) -> dict:
kwargs = {