Merge pull request #640 from better629/feat_fixllm

Feat fixllm client kwargs
This commit is contained in:
geekan 2023-12-28 10:48:10 +08:00 committed by GitHub
commit c8b87e28b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View file

@ -85,10 +85,9 @@ class FireworksLLM(OpenAILLM):
self._init_client()
self.model = self.config.fireworks_api_model # `self.model` should after `_make_client` to rewrite it
def _make_client_kwargs(self) -> (dict, dict):
def _make_client_kwargs(self) -> dict:
kwargs = dict(api_key=self.config.fireworks_api_key, base_url=self.config.fireworks_api_base)
async_kwargs = kwargs.copy()
return kwargs, async_kwargs
return kwargs
def _update_costs(self, usage: CompletionUsage):
if self.config.calc_usage and usage:

View file

@ -48,10 +48,9 @@ class OpenLLMGPTAPI(OpenAILLM):
self._init_client()
self.model = self.config.open_llm_api_model # `self.model` should after `_make_client` to rewrite it
def _make_client_kwargs(self) -> (dict, dict):
def _make_client_kwargs(self) -> dict:
kwargs = dict(api_key="sk-xxx", base_url=self.config.open_llm_api_base)
async_kwargs = kwargs.copy()
return kwargs, async_kwargs
return kwargs
def _calc_usage(self, messages: list[dict], rsp: str) -> CompletionUsage:
usage = CompletionUsage(prompt_tokens=0, completion_tokens=0, total_tokens=0)