blob: 3dfb32ce17b645e21991d07124421b3dc11cbfb1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import gptworldAi
# single completion
for chunk in gptworldAi.Completion.create("你是谁", "127.0.0.1:7890"):
print(chunk, end="", flush=True)
print()
# chat completion
message = []
while True:
prompt = input("请输入问题:")
message.append({"role": "user", "content": prompt})
text = ""
for chunk in gptworldAi.ChatCompletion.create(message, '127.0.0.1:7890'):
text = text + chunk
print(chunk, end="", flush=True)
print()
message.append({"role": "assistant", "content": text})
|