diff --git a/README.md b/README.md index f109f4eb9..b8d52f544 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ resp = client.chat.completions.create( ], max_tokens=100, ) -print("Response:", resp[0].choices[0].message.content) +print("Response:", resp.choices[0].message.content) ``` See [OpenAI Compatible API](https://predibase.github.io/lorax/reference/openai_api) for details. diff --git a/docs/guides/structured_output.md b/docs/guides/structured_output.md index 8bbab09b0..73323a95b 100644 --- a/docs/guides/structured_output.md +++ b/docs/guides/structured_output.md @@ -141,7 +141,7 @@ resp = client.chat.completions.create( }, ) -my_character = json.loads(resp[0].choices[0].message.content) +my_character = json.loads(resp.choices[0].message.content) print(my_character) ``` diff --git a/docs/index.md b/docs/index.md index 0632e0e33..ff4161eb1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -142,7 +142,7 @@ resp = client.chat.completions.create( ], max_tokens=100, ) -print("Response:", resp[0].choices[0].message.content) +print("Response:", resp.choices[0].message.content) ``` See [OpenAI Compatible API](./reference/openai_api.md) for details.