Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
from semantic_kernel.contents.function_call_content import FunctionCallContent
from semantic_kernel.contents.streaming_chat_message_content import STREAMING_CMC_ITEM_TYPES as STREAMING_ITEM_TYPES
from semantic_kernel.contents.streaming_chat_message_content import StreamingChatMessageContent
from semantic_kernel.contents.streaming_reasoning_content import StreamingReasoningContent
from semantic_kernel.contents.streaming_text_content import StreamingTextContent
from semantic_kernel.contents.reasoning_content import ReasoningContent
from semantic_kernel.contents.text_content import TextContent
from semantic_kernel.contents.utils.author_role import AuthorRole
from semantic_kernel.contents.utils.finish_reason import FinishReason
Expand Down Expand Up @@ -302,7 +304,9 @@ def _create_chat_message_content(
items: list[CMC_ITEM_TYPES] = []
if candidate.content and candidate.content.parts:
for idx, part in enumerate(candidate.content.parts):
if part.text:
if getattr(part, "thought", False):
items.append(ReasoningContent(text=part.text, inner_content=response, metadata=response_metadata))
elif part.text:
items.append(TextContent(text=part.text, inner_content=response, metadata=response_metadata))
elif part.function_call:
fc_metadata: dict[str, Any] = {}
Expand Down Expand Up @@ -357,7 +361,16 @@ def _create_streaming_chat_message_content(
items: list[STREAMING_ITEM_TYPES] = []
if candidate.content and candidate.content.parts:
for idx, part in enumerate(candidate.content.parts):
if part.text:
if getattr(part, "thought", False):
items.append(
StreamingReasoningContent(
choice_index=candidate.index or 0,
text=part.text,
inner_content=chunk,
metadata=response_metadata,
)
)
elif part.text:
items.append(
StreamingTextContent(
choice_index=candidate.index or 0,
Expand Down
Loading