Skip to content

Type de-duplication from openai-java for azure-ai-agents and azure-ai-projects packages#48353

Open
jpalvarezl wants to merge 16 commits intomainfrom
jpalvarezl/fix/type_de_dups
Open

Type de-duplication from openai-java for azure-ai-agents and azure-ai-projects packages#48353
jpalvarezl wants to merge 16 commits intomainfrom
jpalvarezl/fix/type_de_dups

Conversation

@jpalvarezl
Copy link
Member

This pull request refactors the Azure AI Agents SDK to support direct interoperability with openai-java models for filter and reasoning types, reducing duplication and simplifying serialization logic. The most important changes are the removal of Azure-specific filter and reasoning model classes, addition of new serialization helpers, and updates to agent and tool classes to accept openai-java types.

Removal of Azure-specific filter and reasoning model classes

  • Deleted ComparisonFilter, ComparisonFilterType, CompoundFilter, and CompoundFilterType classes from com.azure.ai.agents.models, removing Azure-specific filter type definitions in favor of openai-java types. [1] [2] [3] [4]

Serialization and interoperability enhancements

  • Added toBinaryData and fromBinaryData methods to OpenAIJsonHelper for converting openai-java objects to and from BinaryData, enabling seamless serialization/deserialization between Azure and openai-java models.
  • Updated imports in relevant files to use OpenAIJsonHelper for serialization tasks. [1] [2]

Updates to agent and tool classes for openai-java compatibility

  • Modified PromptAgentDefinition to use com.openai.models.Reasoning directly for its reasoning property, updating its getter, setter, serialization, and deserialization logic accordingly. [1] [2] [3] [4] [5] [6]
  • Added overloads to FileSearchTool allowing filters to be set using openai-java ComparisonFilter or CompoundFilter types, with conversion handled by OpenAIJsonHelper.

These changes streamline the SDK's support for openai-java models, making it easier to integrate and reducing code duplication.

Base automatically changed from jpalvarezl/fix/type_overrides to main March 10, 2026 14:20
Copilot AI review requested due to automatic review settings March 10, 2026 16:28
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 refactors azure-ai-agents to interoperate directly with openai-java reasoning and filter model types, reducing duplicated Azure-side model classes and centralizing JSON interop via helper utilities.

Changes:

  • Replaced Azure-specific Reasoning/filter model types with com.openai.models.* equivalents and updated serialization/deserialization paths.
  • Added OpenAIJsonHelper utilities to convert openai-java model instances to/from BinaryData.
  • Added/updated unit tests covering reasoning and file-search filter round-trips.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/ai/azure-ai-agents/tsp-location.yaml Updates the pinned swagger/spec commit for generation inputs.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/implementation/OpenAIJsonHelper.java Adds BinaryData conversion helpers for openai-java objects.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/models/PromptAgentDefinition.java Switches reasoning to openai-java Reasoning and updates JSON handling accordingly.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/models/FileSearchTool.java Adds overloads to set filters using openai-java filter types.
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/models/ReasoningDedupSerializationTests.java New tests validating reasoning and filters behavior with openai-java types.
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/models/PromptAgentDefinitionSerializationTests.java Extends existing tests to cover openai-java Reasoning.
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/models/FileSearchToolSerializationTests.java New tests for file-search tool serialization, including filters.
sdk/ai/azure-ai-agents/src/main/resources/META-INF/azure-ai-agents_metadata.json Regenerated metadata reflecting removed/updated model surface.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/models/* (deleted) Removes Azure-specific Reasoning* and filter model classes in favor of openai-java.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2026

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure:azure-ai-agents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants