Compare commits

...

2 Commits

Author SHA1 Message Date
leehuwuj 670e2631f3 bump @llamaindex/server 2025-04-02 17:20:32 +07:00
leehuwuj afb519d231 fix llamacloud api and markdown issue 2025-04-02 16:51:21 +07:00
6 changed files with 462 additions and 452 deletions
@@ -99,8 +99,7 @@ async def _stream_content(
event: Union[AgentStream, StopEvent], event: Union[AgentStream, StopEvent],
) -> AsyncGenerator[str, None]: ) -> AsyncGenerator[str, None]:
if isinstance(event, AgentStream): if isinstance(event, AgentStream):
if event.delta.strip(): # Only yield non-empty deltas yield event.delta
yield event.delta
elif isinstance(event, StopEvent): elif isinstance(event, StopEvent):
if isinstance(event.result, str): if isinstance(event.result, str):
yield event.result yield event.result
@@ -108,9 +107,7 @@ async def _stream_content(
async for chunk in event.result: async for chunk in event.result:
if isinstance(chunk, str): if isinstance(chunk, str):
yield chunk yield chunk
elif ( elif hasattr(chunk, "delta") and chunk.delta:
hasattr(chunk, "delta") and chunk.delta.strip()
): # Only yield non-empty deltas
yield chunk.delta yield chunk.delta
stream_started = False stream_started = False
@@ -5,7 +5,7 @@ from typing import Optional
import requests import requests
CHAT_UI_VERSION = "0.0.5" CHAT_UI_VERSION = "0.0.6"
def download_chat_ui( def download_chat_ui(
@@ -74,7 +74,7 @@ class LlamaCloudFileService:
"custom_metadata": {"file_id": file_id, **(custom_metadata or {})}, "custom_metadata": {"file_id": file_id, **(custom_metadata or {})},
} }
] ]
files = client.pipelines.add_files_to_pipeline(pipeline_id, request=files) files = client.pipelines.add_files_to_pipeline_api(pipeline_id, request=files)
if not wait_for_processing: if not wait_for_processing:
return file_id return file_id
+457 -443
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -36,7 +36,7 @@ requests = "^2.32.3"
pydantic-settings = "^2.8.1" pydantic-settings = "^2.8.1"
llama-index-core = "0.12.25" llama-index-core = "0.12.25"
llama-index-readers-file = "^0.4.6" llama-index-readers-file = "^0.4.6"
llama-index-indices-managed-llama-cloud = "^0.6.3" llama-index-indices-managed-llama-cloud = "0.6.3"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
black = {extras = ["jupyter"], version = "<=23.9.1,>=23.7.0"} black = {extras = ["jupyter"], version = "<=23.9.1,>=23.7.0"}
@@ -229,7 +229,6 @@ class TestEventStream:
yield ObjectWithDelta("Delta 1") yield ObjectWithDelta("Delta 1")
yield ObjectWithDelta("Delta 2") yield ObjectWithDelta("Delta 2")
yield ObjectWithDelta(" ") # Should be filtered out by strip check
yield StopEvent(result=generator()) yield StopEvent(result=generator())