Skip to content

Commit 740cea8

Browse files
committed
LCORE-2649: fixed types
1 parent aa6ffb2 commit 740cea8

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/utils/endpoints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from models.common.responses.responses_conversation_context import (
2020
ResponsesConversationContext,
2121
)
22-
from models.common.turn_summary import ReferencedDocument, TurnSummary
22+
from models.common.turn_summary import RagChunk, ReferencedDocument, TurnSummary
2323
from models.database.conversations import UserConversation, UserTurn
2424
from utils.responses import create_new_conversation
2525
from utils.suid import normalize_conversation_id, to_llama_stack_conversation_id
@@ -476,7 +476,7 @@ def _add_additional_metadata_docs(
476476

477477

478478
def _process_rag_chunks_for_documents(
479-
rag_chunks: list[ReferencedDocument],
479+
rag_chunks: list[RagChunk],
480480
metadata_map: Optional[dict[str, Any]] = None,
481481
) -> list[tuple[Optional[AnyUrl], str]]:
482482
"""

src/utils/streaming_sse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import json
66
from collections.abc import AsyncIterator
7-
from typing import Optional
7+
from typing import Any, Optional
88

99
from fastapi import HTTPException
1010

@@ -54,7 +54,7 @@ def stream_http_error_event(
5454
)
5555

5656

57-
def format_stream_data(d: dict) -> str:
57+
def format_stream_data(d: dict[str, Any]) -> str:
5858
"""Format a dictionary as an SSE data event string.
5959
6060
Args:
@@ -182,7 +182,7 @@ def stream_end_event(
182182
)
183183

184184

185-
def stream_event(data: dict, event_type: str, media_type: str) -> str:
185+
def stream_event(data: dict[str, Any], event_type: str, media_type: str) -> str:
186186
"""Build an SSE event string based on media type.
187187
188188
Args:
@@ -195,7 +195,7 @@ def stream_event(data: dict, event_type: str, media_type: str) -> str:
195195
"""
196196
if media_type == MEDIA_TYPE_TEXT:
197197
if event_type == LLM_TOKEN_EVENT:
198-
return data.get("token", "")
198+
return str(data.get("token", ""))
199199
if event_type == LLM_TOOL_CALL_EVENT:
200200
return f"[Tool Call: {data.get('function_name', 'unknown')}]\n"
201201
if event_type == LLM_TOOL_RESULT_EVENT:

0 commit comments

Comments
 (0)