mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-05 11:07:29 +00:00
Add nscale support for streaming (#10698)
This commit is contained in:
@@ -67,6 +67,22 @@ response = completion(
|
||||
print(response)
|
||||
```
|
||||
|
||||
```python showLineNumbers title="Nscale Text Generation - Streaming"
|
||||
from litellm import completion
|
||||
import os
|
||||
|
||||
os.environ["NSCALE_API_KEY"] = "" # your Nscale API key
|
||||
stream = completion(
|
||||
model="nscale/meta-llama/Llama-4-Scout-17B-16E-Instruct",
|
||||
messages=[{"role": "user", "content": "What is LiteLLM?"}],
|
||||
stream=True
|
||||
)
|
||||
|
||||
for chunk in stream:
|
||||
if chunk.choices[0].delta.content is not None:
|
||||
print(chunk.choices[0].delta.content, end="")
|
||||
```
|
||||
|
||||
### Image Generation
|
||||
|
||||
```python showLineNumbers title="Nscale Image Generation"
|
||||
|
||||
@@ -41,4 +41,12 @@ class NscaleConfig(OpenAIGPTConfig):
|
||||
"n",
|
||||
"temperature",
|
||||
"top_p",
|
||||
"stream",
|
||||
"logprobs",
|
||||
"top_logprobs",
|
||||
"frequency_penalty",
|
||||
"presence_penalty",
|
||||
"response_format",
|
||||
"stop",
|
||||
"logit_bias",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user