summaryrefslogtreecommitdiffstats
path: root/docs/client.md
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-21 17:02:54 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-21 17:02:54 +0100
commit0a0698c7f3fa117e95eaf9b017e4122d15ef4566 (patch)
tree8d2997750aef7bf9ae0f9ec63410279119fffb69 /docs/client.md
parentMerge pull request #1603 from xtekky/index (diff)
downloadgpt4free-0a0698c7f3fa117e95eaf9b017e4122d15ef4566.tar
gpt4free-0a0698c7f3fa117e95eaf9b017e4122d15ef4566.tar.gz
gpt4free-0a0698c7f3fa117e95eaf9b017e4122d15ef4566.tar.bz2
gpt4free-0a0698c7f3fa117e95eaf9b017e4122d15ef4566.tar.lz
gpt4free-0a0698c7f3fa117e95eaf9b017e4122d15ef4566.tar.xz
gpt4free-0a0698c7f3fa117e95eaf9b017e4122d15ef4566.tar.zst
gpt4free-0a0698c7f3fa117e95eaf9b017e4122d15ef4566.zip
Diffstat (limited to 'docs/client.md')
-rw-r--r--docs/client.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/client.md b/docs/client.md
index 8e02b581..f2ba9bcd 100644
--- a/docs/client.md
+++ b/docs/client.md
@@ -44,10 +44,22 @@ client = Client(
You can use the `ChatCompletions` endpoint to generate text completions as follows:
```python
+response = client.chat.completions.create(
+ model="gpt-3.5-turbo",
+ messages=[{"role": "user", "content": "Say this is a test"}],
+ ...
+)
+print(response.choices[0].message.content)
+```
+
+Also streaming are supported:
+
+```python
stream = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Say this is a test"}],
stream=True,
+ ...
)
for chunk in stream:
if chunk.choices[0].delta.content: