summaryrefslogtreecommitdiffstats
path: root/gpt4free/gptworldAi/README.md
blob: a6b07f86e5752a5420f7b163694f49ade95cb743 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# gptworldAi
Written by [hp_mzx](https://github.com/hpsj).

## Examples:
### Completion:
```python
for chunk in gptworldAi.Completion.create("你是谁", "127.0.0.1:7890"):
    print(chunk, end="", flush=True)
    print()
```

### Chat Completion:
Support context
```python
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})
```