mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-07-02 16:01:04 +02:00
format code
This commit is contained in:
parent
60d34f4a50
commit
549cb2d90b
3 changed files with 27 additions and 26 deletions
|
|
@ -45,7 +45,13 @@ class ZhiPuAILLM(BaseLLM):
|
|||
def _const_kwargs(self, messages: list[dict], stream: bool = False) -> dict:
|
||||
max_tokens = self.config.max_token if self.config.max_token > 0 else 1024
|
||||
temperature = self.config.temperature if self.config.temperature > 0.0 else 0.3
|
||||
kwargs = {"model": self.model, "max_tokens": max_tokens, "messages": messages, "stream": stream, "temperature": temperature}
|
||||
kwargs = {
|
||||
"model": self.model,
|
||||
"max_tokens": max_tokens,
|
||||
"messages": messages,
|
||||
"stream": stream,
|
||||
"temperature": temperature,
|
||||
}
|
||||
return kwargs
|
||||
|
||||
def completion(self, messages: list[dict], timeout=USE_CONFIG_TIMEOUT) -> dict:
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
# @Version : None
|
||||
# @Description : None
|
||||
|
||||
import time
|
||||
import json
|
||||
import time
|
||||
from multiprocessing import Pipe
|
||||
|
||||
|
||||
|
|
@ -21,17 +21,8 @@ class StreamPipe:
|
|||
"model": "gpt-3.5-turbo-0125",
|
||||
"system_fingerprint": "fp_3bc1b5746c",
|
||||
"choices": [
|
||||
{
|
||||
"index": 0,
|
||||
"delta":
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": "content"
|
||||
},
|
||||
"logprobs": None,
|
||||
"finish_reason": None
|
||||
}
|
||||
]
|
||||
{"index": 0, "delta": {"role": "assistant", "content": "content"}, "logprobs": None, "finish_reason": None}
|
||||
],
|
||||
}
|
||||
|
||||
def set_message(self, msg):
|
||||
|
|
@ -44,6 +35,6 @@ class StreamPipe:
|
|||
return None
|
||||
|
||||
def msg2stream(self, msg):
|
||||
self.format_data['created'] = int(time.time())
|
||||
self.format_data['choices'][0]['delta']['content'] = msg
|
||||
self.format_data["created"] = int(time.time())
|
||||
self.format_data["choices"][0]["delta"]["content"] = msg
|
||||
return f"data: {json.dumps(self.format_data, ensure_ascii=False)}\n".encode("utf-8")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue