Skip to content

OpenAI: support any path configuration #3452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

lambochen
Copy link
Contributor

@lambochen lambochen commented Jun 5, 2025

Thank you for taking time to contribute this pull request!
You might have already read the [contributor guide][1], but as a reminder, please make sure to:

  • Sign the contributor license agreement
  • Rebase your changes on the latest main branch and squash your commits
  • Add/Update unit tests as needed
  • Run a build and make sure all tests pass prior to submission

ref issue: #3451

OpenAI's audio and moderation configuration paths are supported, as detailed below:

  • Audio Model: support audioSpeechPath, audioTranscriptionPath, audioTranslationPath configuration
  • Moderation Model: support moderationPath configuration

@lambochen lambochen changed the title OpenAI: support any audio path configuration OpenAI: support any path configuration Jun 5, 2025
@lambochen
Copy link
Contributor Author

@markpollack @tzolov @ilayaperumalg Hi, please review the PR, thank you.

@ConfigurationProperties(OpenAiChatProperties.CONFIG_PREFIX)
public class OpenAiChatProperties extends OpenAiParentProperties {

public static final String CONFIG_PREFIX = "spring.ai.openai.chat";

public static final String DEFAULT_CHAT_MODEL = "gpt-4o-mini";

public static final String DEFAULT_COMPLETIONS_PATH = "/v1/chat/completions";
public static final String DEFAULT_COMPLETIONS_PATH = OpenAiApiConstants.DEFAULT_COMPLETIONS_PATH;
Copy link
Contributor

Choose a reason for hiding this comment

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

OpenAiChatProperties.DEFAULT_COMPLETIONS_PATH can be replaced with OpenAiApiConstants.DEFAULT_COMPLETIONS_PATH.
Is there any reason to keep OpenAiChatProperties.DEFAULT_COMPLETIONS_PATH anymore? Both are public static final.

OpenAiEmbeddingProperties.DEFAULT_EMBEDDINGS_PATH and OpenAiImageProperties.DEFAULT_IMAGES_PATH are the same as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @dev-jonghoonpark .

To ensure compatibility with lower versions (as these attributes are all public and may have been referenced in user business code), OpenAiChatProperties.DEFAULT_COMPLETIONS_PATH, OpenAiEmbeddingProperties.DEFAULT_EMBEDDINGS_PATH, and OpenAiImageProperties.DEFAULT_IMAGES_PATH have been retained.
However, they have all been moved to OpenAiApiConstants for unified management.

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.

2 participants