dedup-openai

Suppress duplicate Java classes by mapping TypeSpec types to openai-java models.

2.6k|2.2k|Updated Dec 6, 2011
One-click install
npx skills add https://github.com/Azure/azure-sdk-for-java --skill dedup-openai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dedup-openai
Source: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/ai/.workflow_docs/dedup-openai
Command: npx skills add https://github.com/Azure/azure-sdk-for-java --skill dedup-openai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill resolves the issue of redundant Java classes generated by TypeSpec that duplicate models already present in the openai-java library, preventing code bloat and simplifying maintenance.

Core Features & Use Cases

  • Model Suppression: Identifies and suppresses generated Java classes that are structurally identical to openai-java models.
  • Type Mapping: Uses TypeSpec's @@alternateType directive to map generated types to their openai-java equivalents, ensuring correct serialization and deserialization.
  • Serialization Bridging: Provides helper methods (OpenAIJsonHelper) to correctly serialize and deserialize openai-java objects, bypassing Jackson's limitations with Kotlin internals.
  • Use Case: When generating an Azure SDK client that interacts with OpenAI APIs, this skill ensures that you don't generate duplicate model classes for common OpenAI entities like Reasoning or ComparisonFilter, instead leveraging the existing openai-java library.

Quick Start

Use the dedup-openai skill after dup-classes has identified actionable duplicates to suppress generated Java classes and bridge to openai-java equivalents.

Frequently Asked Questions about dedup-openai

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does TypeSpec generate duplicate Java classes for OpenAI models?

TypeSpec generates duplicate Java classes because it independently creates model definitions for OpenAI entities like Reasoning or ComparisonFilter, even when structurally identical models already exist in the openai-java library, causing code bloat and maintenance overhead.

How do I suppress duplicate Java classes generated by TypeSpec?

Suppress duplicate Java classes by using TypeSpec's @@alternateType directive to map generated types to their openai-java equivalents, preventing redundant model generation and ensuring correct serialization.

What do I need before using the dedup-openai skill?

You need TypeSpec synchronization, a project pom.xml with the openai-java dependency, and identification of duplicate classes via the dup-classes skill before applying this de-duplication process.

How do I serialize openai-java objects when bypassing Jackson limitations?

Serialize openai-java objects by using provided OpenAIJsonHelper helper methods to correctly serialize and deserialize objects, bypassing Jackson's limitations with Kotlin internals.

What is the best way to avoid Java code bloat when generating an Azure SDK client for OpenAI APIs?

The best way to avoid Java code bloat is to suppress generated TypeSpec classes and map them to existing openai-java library models, leveraging existing definitions for common OpenAI entities.