From 0a0698c7f3fa117e95eaf9b017e4122d15ef4566 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Wed, 21 Feb 2024 17:02:54 +0100 Subject: Update docs / readme, Improve Gemini auth --- docs/client.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'docs/client.md') diff --git a/docs/client.md b/docs/client.md index 8e02b581..f2ba9bcd 100644 --- a/docs/client.md +++ b/docs/client.md @@ -43,11 +43,23 @@ 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: -- cgit v1.2.3