docs: fix streaming example in README (#16461)
* docs: add messages variable definition in streaming example - Add missing messages variable in streaming code example - Makes the example complete and runnable without modifications * docs: capitalize LiteLLM in streaming section * docs: add gpt-4o comment
This commit is contained in:
parent
3289038089
commit
656dce92d0
@ -132,11 +132,15 @@ print(response)
|
||||
|
||||
## Streaming ([Docs](https://docs.litellm.ai/docs/completion/stream))
|
||||
|
||||
liteLLM supports streaming the model response back, pass `stream=True` to get a streaming iterator in response.
|
||||
LiteLLM supports streaming the model response back, pass `stream=True` to get a streaming iterator in response.
|
||||
Streaming is supported for all models (Bedrock, Huggingface, TogetherAI, Azure, OpenAI, etc.)
|
||||
|
||||
```python
|
||||
from litellm import completion
|
||||
|
||||
messages = [{"content": "Hello, how are you?", "role": "user"}]
|
||||
|
||||
# gpt-4o
|
||||
response = completion(model="openai/gpt-4o", messages=messages, stream=True)
|
||||
for part in response:
|
||||
print(part.choices[0].delta.content or "")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user