Python: Fix onnx pkg by pinning. Pin openai < 2.0. (#13284)

### Motivation and Context

For the latest onnxruntime 1.23.2 pkg: our GitHub Actions run is failing
because uv is not matching the macOS wheel tag.
Pinning to last-known-good until it's sorted out.

- Pin openai pkg < 2.0 until we can investigate if 2.0 brings in other
breaking changes.

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] 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
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
This commit is contained in:
Evan Mattson
2025-10-24 11:23:08 +09:00
committed by GitHub
parent 3bc2a64fca
commit cf9a5f21f7
7 changed files with 3243 additions and 2727 deletions
+4 -2
View File
@@ -37,7 +37,7 @@ dependencies = [
"numpy >= 1.25.0; python_version < '3.12'",
"numpy >= 1.26.0; python_version >= '3.12'",
# openai connector
"openai >= 1.98.0",
"openai >= 1.98.0, < 2.0.0",
# openapi and swagger
"openapi_core >= 0.18,<0.20",
"websockets >= 13, < 16",
@@ -121,7 +121,9 @@ ollama = [
"ollama ~= 0.4"
]
onnx = [
"onnxruntime-genai ~= 0.7"
# Pinning due to uv tag-resolution issues on macOS.
"onnxruntime==1.22.1",
"onnxruntime-genai==0.9.0"
]
pandas = [
"pandas ~= 2.2"
@@ -5,7 +5,8 @@ import logging
from collections.abc import AsyncIterable, Iterable, Sequence
from typing import TYPE_CHECKING, Any, ClassVar, Literal, TypeVar, cast
from openai import NOT_GIVEN, AsyncOpenAI, NotGiven
from openai import AsyncOpenAI
from openai._types import Omit, omit
from openai.types.beta.code_interpreter_tool import CodeInterpreterTool
from openai.types.beta.file_search_tool import FileSearchTool
from openai.types.beta.threads.run_create_params import AdditionalMessage, AdditionalMessageAttachment
@@ -597,7 +598,7 @@ class AssistantThreadActions:
An async iterable of ChatMessageContent.
"""
agent_names: dict[str, Any] = {}
last_id: str | NotGiven = NOT_GIVEN
last_id: str | Omit = omit
while True:
messages = await client.beta.threads.messages.list(
@@ -7,7 +7,8 @@ from collections.abc import AsyncIterable, Awaitable, Callable, Iterable
from copy import copy, deepcopy
from typing import TYPE_CHECKING, Any, ClassVar, Literal, TypeVar
from openai import NOT_GIVEN, AsyncOpenAI, NotGiven
from openai import AsyncOpenAI
from openai._types import Omit, omit
from openai.lib._parsing._completions import type_to_response_format_param
from openai.types.beta.assistant import Assistant
from openai.types.beta.assistant_create_params import (
@@ -138,9 +139,9 @@ class AssistantAgentThread(AgentThread):
self,
client: AsyncOpenAI,
thread_id: str | None = None,
messages: Iterable["ThreadCreateMessage"] | NotGiven = NOT_GIVEN,
metadata: dict[str, Any] | NotGiven = NOT_GIVEN,
tool_resources: ToolResources | NotGiven = NOT_GIVEN,
messages: Iterable["ThreadCreateMessage"] | Omit = omit,
metadata: dict[str, Any] | Omit = omit,
tool_resources: ToolResources | Omit = omit,
) -> None:
"""Initialize the OpenAI Assistant Thread.
@@ -706,7 +706,7 @@ class OpenAIResponsesAgent(DeclarativeSpecMixin, Agent):
A WebSearchToolParam dictionary with any passed-in parameters.
"""
tool: WebSearchToolParam = {
"type": "web_search_preview",
"type": "web_search",
}
if context_size is not None:
tool["search_context_size"] = context_size
@@ -5,7 +5,7 @@ from abc import ABC
from typing import Any, Union
from openai import AsyncOpenAI, AsyncStream, BadRequestError, _legacy_response
from openai._types import NOT_GIVEN, FileTypes, NotGiven
from openai._types import FileTypes, Omit, omit
from openai.lib._parsing._completions import type_to_response_format_param
from openai.types import Completion, CreateEmbeddingResponse
from openai.types.audio import Transcription
@@ -135,7 +135,7 @@ class OpenAIHandler(KernelBaseModel, ABC):
self,
image: list[FileTypes],
settings: OpenAITextToImageExecutionSettings,
mask: FileTypes | NotGiven = NOT_GIVEN,
mask: FileTypes | Omit = omit,
) -> ImagesResponse:
"""Send a request to the OpenAI image edit endpoint.
@@ -4,7 +4,7 @@ from pathlib import Path
from typing import IO, Any
from warnings import warn
from openai._types import NOT_GIVEN, FileTypes, NotGiven
from openai._types import FileTypes, Omit, omit
from openai.types.images_response import ImagesResponse
from semantic_kernel.connectors.ai.open_ai.prompt_execution_settings.open_ai_text_to_image_execution_settings import (
@@ -217,7 +217,7 @@ class OpenAITextToImageBase(OpenAIHandler, TextToImageClientBase):
elif image_files is not None:
images = list(image_files)
mask: FileTypes | NotGiven = NOT_GIVEN
mask: FileTypes | Omit = omit
if mask_path is not None:
mask = Path(mask_path)
elif mask_file is not None:
+3226 -2714
View File
File diff suppressed because it is too large Load Diff