Skip to content

Conversation

@levscaut
Copy link
Contributor

@levscaut levscaut commented Dec 1, 2025

Related Issues/PRs

#xxx

What changes are proposed in this pull request?

Add OpenAI API Type (Responses API and Chat Completions API) to OpenAIDefault

How is this patch tested?

  • I have written tests (not required for typo or doc fix) and confirmed the proposed feature/bug-fix/change works.

Does this PR change any dependencies?

  • No. You can skip this section.
  • Yes. Make sure the dependencies are resolved correctly, and list changes here.

Does this PR add a new feature? If so, have you added samples on website?

  • No. You can skip this section.
  • Yes. Make sure you have added samples following below steps.
  1. Find the corresponding markdown file for your new feature in website/docs/documentation folder.
    Make sure you choose the correct class estimators/transformers and namespace.
  2. Follow the pattern in markdown file and add another section for your new API, including pyspark, scala (and .NET potentially) samples.
  3. Make sure the DocTable points to correct API link.
  4. Navigate to website folder, and run yarn run start to make sure the website renders correctly.
  5. Don't forget to add <!--pytest-codeblocks:cont--> before each python code blocks to enable auto-tests for python samples.
  6. Make sure the WebsiteSamplesTests job pass in the pipeline.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Hey @levscaut 👋!
Thank you so much for contributing to our repository 🙌.
Someone from SynapseML Team will be reviewing this pull request soon.

We use semantic commit messages to streamline the release process.
Before your pull request can be merged, you should make sure your first commit and PR title start with a semantic prefix.
This helps us to create release messages and credit you for your hard work!

Examples of commit messages with semantic prefixes:

  • fix: Fix LightGBM crashes with empty partitions
  • feat: Make HTTP on Spark back-offs configurable
  • docs: Update Spark Serving usage
  • build: Add codecov support
  • perf: improve LightGBM memory usage
  • refactor: make python code generation rely on classes
  • style: Remove nulls from CNTKModel
  • test: Add test coverage for CNTKModel

To test your commit locally, please follow our guild on building from source.
Check out the developer guide for additional guidance on testing your change.

@levscaut
Copy link
Contributor Author

levscaut commented Dec 1, 2025

/azp

@azure-pipelines
Copy link

Supported commands
  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

@levscaut
Copy link
Contributor Author

levscaut commented Dec 1, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.34%. Comparing base (b8d7b8a) to head (1530561).

Files with missing lines Patch % Lines
...re/synapse/ml/services/openai/OpenAIDefaults.scala 85.71% 1 Missing ⚠️
...zure/synapse/ml/services/openai/OpenAIPrompt.scala 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2453      +/-   ##
==========================================
- Coverage   84.36%   84.34%   -0.02%     
==========================================
  Files         335      335              
  Lines       17711    17723      +12     
  Branches     1610     1616       +6     
==========================================
+ Hits        14942    14949       +7     
- Misses       2769     2774       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@levscaut
Copy link
Contributor Author

levscaut commented Dec 1, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@levscaut
Copy link
Contributor Author

levscaut commented Dec 1, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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 adds support for specifying the OpenAI API type (either "responses" or "chat_completions") to OpenAIDefaults, allowing users to configure which API variant should be used globally. The change extends the existing global parameter pattern used for other OpenAI configuration options.

Key Changes:

  • Added OpenAIApiTypeKey global parameter and associated getter/setter/reset methods in OpenAIDefaults
  • Registered the apiType parameter with global params in OpenAIPrompt
  • Updated validation logic for column types in OpenAIPrompt
  • Added comprehensive test coverage in OpenAIDefaultsSuite

Reviewed changes

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

Show a summary per file
File Description
cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/openai/OpenAI.scala Defines the OpenAIApiTypeKey global key for API type parameter
cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/openai/OpenAIDefaults.scala Implements setter, getter, and reset methods for the API type default value with validation
cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/openai/OpenAIPrompt.scala Registers apiType parameter with GlobalParams and updates column type validation logic
cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/openai/OpenAIDefaultsSuite.scala Adds test coverage for the new API type getter, setter, and reset functionality
cognitive/src/main/python/synapse/ml/services/openai/OpenAIDefaults.py Adds Python wrapper methods for setting, getting, and resetting API type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ranadeepsingh ranadeepsingh merged commit bfa8c46 into microsoft:master Dec 2, 2025
73 of 75 checks passed
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.

4 participants