Add nscale support for streaming (#10698)

This commit is contained in:
Tom Matthews
2025-05-09 19:39:23 +01:00
committed by GitHub
parent 1a42245da6
commit e2a9cd0c75
2 changed files with 24 additions and 0 deletions
+16
View File
@@ -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",
]