Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 17, 2025

Problem

The repository was using openai version 1.102.0, but the latest version is 2.4.0. The update introduced a breaking change in how optional parameters are passed to the OpenAI API, causing type checking failures.

Changes

This PR updates the openai package from 1.102.0 to 2.4.0 and addresses the breaking change where the sentinel value for optional parameters changed from NOT_GIVEN to omit.

Modified Files

  1. packages/openai/pyproject.toml

    • Updated dependency: openai>=1.102.0openai>=2.4.0
  2. packages/openai/src/microsoft/teams/openai/completions_model.py

    • Replaced NOT_GIVEN import with omit
    • Updated optional parameter handling for tools
  3. packages/openai/src/microsoft/teams/openai/responses_chat_model.py

    • Replaced NOT_GIVEN import with omit
    • Updated optional parameter handling for tools and instructions
  4. packages/openai/tests/test_openai_completions_model.py

    • Updated test assertions to check for Omit type instead of NOT_GIVEN

Breaking Change Details

OpenAI 2.4.0 replaced NOT_GIVEN with omit as the sentinel value for optional parameters:

# Before (1.102.0)
from openai import NOT_GIVEN
tools = self._convert_functions(functions) if functions else NOT_GIVEN

# After (2.4.0)
from openai import omit
tools = self._convert_functions(functions) if functions else omit

This change affects how optional parameters are passed to OpenAI API endpoints, ensuring proper type compatibility with the new API.

Validation

  • ✅ All 362 tests pass (including 21 openai-specific tests)
  • ✅ PyRight type checking passes with 0 errors
  • ✅ Ruff linting and formatting checks pass
  • ✅ Manual testing with echo test application confirms functionality
  • ✅ No security vulnerabilities detected in openai 2.4.0

Related

Fixes the issue reported in feat: add a2a server and client plugins and samples where CI failed due to type incompatibilities after attempting to update the openai package.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • login.microsoftonline.com
    • Triggering command: /home/REDACTED/work/teams.py/teams.py/.venv/bin/python /home/REDACTED/work/teams.py/teams.py/.venv/bin/pytest packages -v --tb=short (dns block)
  • token.botframework.com
    • Triggering command: /home/REDACTED/work/teams.py/teams.py/.venv/bin/python /home/REDACTED/work/teams.py/teams.py/.venv/bin/pytest packages -v --tb=short (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

in the Python repository, we have a dependency on the openai package. Right now, we are on version 1.102.0, but the most recent version is 2.4.0. This change contains a few breaking changes. This is the link to the stack trace of what broke in our repository after the update. feat: add a2a server and client plugins and samples · microsoft/teams.py@997d516. Please create a PR to update and fix these errors.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Update openai package to version 2.4.0 and fix errors Update openai package to 2.4.0 and fix breaking changes Oct 17, 2025
Copilot AI requested a review from lilyydu October 17, 2025 16:45
Copilot finished work on behalf of lilyydu October 17, 2025 16:45
@lilyydu lilyydu marked this pull request as ready for review October 17, 2025 16:50
Copilot AI review requested due to automatic review settings October 17, 2025 16:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the OpenAI Python package from version 1.102.0 to 2.4.0 and addresses breaking changes in the API, specifically the replacement of NOT_GIVEN with omit as the sentinel value for optional parameters.

  • Updated OpenAI dependency version requirement in pyproject.toml
  • Replaced all instances of NOT_GIVEN imports and usage with omit across the codebase
  • Updated test assertions to check for Omit type instead of NOT_GIVEN value

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

File Description
packages/openai/pyproject.toml Updated OpenAI dependency from >=1.102.0 to >=2.4.0
packages/openai/src/microsoft/teams/openai/completions_model.py Replaced NOT_GIVEN import with omit and updated tools parameter handling
packages/openai/src/microsoft/teams/openai/responses_chat_model.py Replaced NOT_GIVEN import with omit and updated tools/instructions parameter handling
packages/openai/tests/test_openai_completions_model.py Updated test assertion to check for Omit type instead of NOT_GIVEN value

Copy link
Collaborator

@lilyydu lilyydu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!! 🔥

Copy link
Collaborator

lilyydu commented Oct 17, 2025

@copilot Nice job

Copilot AI requested a review from lilyydu October 17, 2025 16:55
Copilot finished work on behalf of lilyydu October 17, 2025 16:55
@heyitsaamir
Copy link
Collaborator

Waiting on a manual sanity check before we merge

@lilyydu
Copy link
Collaborator

lilyydu commented Oct 20, 2025

verified on devtools with our local ai-test sample 👍🏻

@lilyydu lilyydu merged commit a49bed2 into main Oct 20, 2025
8 of 9 checks passed
@lilyydu lilyydu deleted the copilot/update-openai-package-version branch October 20, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants