diff --git a/fern/docs/pages/reference/chat_sse.mdx b/fern/docs/pages/reference/chat_sse.mdx index 224360b..781856f 100644 --- a/fern/docs/pages/reference/chat_sse.mdx +++ b/fern/docs/pages/reference/chat_sse.mdx @@ -45,19 +45,17 @@ method for your application. } ] - result = client.chat.completions.create( - model="Neural-Chat-7B", - messages=messages, - max_tokens=500, - stream=true, - ) - - print(json.dumps( - result, - sort_keys=True, - indent=4, - separators=(',', ': ') - )) +for res in client.chat.completions.create( + model="Neural-Chat-7B", + messages=messages, + max_tokens=500, + temperature=0.1, + stream=True +): + + # Use 'end' parameter in print function to avoid new lines. + print(res["data"]["choices"][0]["delta"]["content"], end='') +``` ``` diff --git a/fern/docs/pages/usingllms/streaming.mdx b/fern/docs/pages/usingllms/streaming.mdx index b307621..de845be 100644 --- a/fern/docs/pages/usingllms/streaming.mdx +++ b/fern/docs/pages/usingllms/streaming.mdx @@ -71,8 +71,8 @@ for res in client.chat.completions.create( stream=True ): -# Use 'end' parameter in print function to avoid new lines. -print(res["data"]["choices"][0]["delta"]["content"], end='') + # Use 'end' parameter in print function to avoid new lines. + print(res["data"]["choices"][0]["delta"]["content"], end='') ``` ![Retrieval augmented generation](streaming.gif)