mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
Fix OCI streaming (#13437)
* add oci models to model_prices_and_context_window.json * remove unsupported and unavailable oci models from docs * fix: split data chunks when using async streaming * add oci models to model_prices_and_context_window.json * fix: split data chunks when using async streaming * revert model.json modifications
This commit is contained in:
parent
49ca4dc792
commit
7484a19edf
1 changed files with 9 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ import base64
|
|||
import datetime
|
||||
import hashlib
|
||||
import json
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
|
||||
from typing import TYPE_CHECKING, Any, AsyncIterator, Dict, List, Optional, Tuple, Union
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import httpx
|
||||
|
|
@ -586,8 +586,15 @@ class OCIChatConfig(BaseConfig):
|
|||
|
||||
completion_stream = response.aiter_text()
|
||||
|
||||
async def split_chunks(completion_stream: AsyncIterator[str]):
|
||||
async for item in completion_stream:
|
||||
for chunk in item.split("\n\n"):
|
||||
if not chunk:
|
||||
continue
|
||||
yield chunk.strip()
|
||||
|
||||
streaming_response = OCIStreamWrapper(
|
||||
completion_stream=completion_stream,
|
||||
completion_stream=split_chunks(completion_stream),
|
||||
model=model,
|
||||
custom_llm_provider=custom_llm_provider,
|
||||
logging_obj=logging_obj,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue