Skip to content

Commit 5e90a43

Browse files
authoredMar 13, 2025
Python: Use openai assistant methods not azure ai (microsoft#10947)
### Motivation and Context The OpenAI assistant code is using an import from the AzureAIAgent related code, and when not installing the `azure` extras, this causes an import error. <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description Use OpenAI assistant specific thread action code. - Closes microsoft#10942 <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄
1 parent 9520c0d commit 5e90a43

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
 

‎python/semantic_kernel/agents/open_ai/assistant_content_generation.py

+17
Original file line numberDiff line numberDiff line change
@@ -476,3 +476,20 @@ def generate_streaming_annotation_content(
476476
start_index=annotation.start_index,
477477
end_index=annotation.end_index,
478478
)
479+
480+
481+
@experimental
482+
def generate_function_call_streaming_content(
483+
agent_name: str,
484+
fccs: list[FunctionCallContent],
485+
) -> StreamingChatMessageContent:
486+
"""Generate function call content.
487+
488+
Args:
489+
agent_name: The agent name.
490+
fccs: The function call contents.
491+
492+
Returns:
493+
StreamingChatMessageContent: The chat message content containing the function call content as the items.
494+
"""
495+
return StreamingChatMessageContent(role=AuthorRole.ASSISTANT, choice_index=0, name=agent_name, items=fccs) # type: ignore

‎python/semantic_kernel/agents/open_ai/assistant_thread_actions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
ToolCallsStepDetails,
1818
)
1919

20-
from semantic_kernel.agents.azure_ai.agent_content_generation import generate_function_call_streaming_content
2120
from semantic_kernel.agents.open_ai.assistant_content_generation import (
2221
generate_code_interpreter_content,
2322
generate_final_streaming_message_content,
2423
generate_function_call_content,
24+
generate_function_call_streaming_content,
2525
generate_function_result_content,
2626
generate_message_content,
2727
generate_streaming_code_interpreter_content,

0 commit comments

Comments
 (0)
Please sign in to comment.