Skip to content

chore: support the new genai endpoint format #297

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 1 commit into
base: main
Choose a base branch
from

Conversation

garethjevans
Copy link

@garethjevans garethjevans commented Jun 11, 2025

With the 10.1.0 genai tile release, there is a new binding format. This PR adds support for the new format, whilst retaining compatibility for the old format

@garethjevans garethjevans force-pushed the support-new-endpoint-format branch from 512e802 to 2d2dfb2 Compare June 11, 2025 14:15
@garethjevans garethjevans force-pushed the support-new-endpoint-format branch from 2d2dfb2 to e7cc3ae Compare June 11, 2025 15:16
Map<String, String> endpoint = (Map<String, String>)cfCredentials.getMap().get("endpoint");
properties.put("spring.ai.openai.chat.base-url", endpoint.get("api_base") + "/openai");
properties.put("spring.ai.openai.chat.api-key", endpoint.get("api_key"));
properties.put("spring.ai.openai.chat.options.model", "tanzu://chat");
Copy link
Member

Choose a reason for hiding this comment

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

If I understand correctly, this logic will always set the spring.ai.openai.chat.* properties for all bindings that contain the endpoint key, even if there is no chat-capable model behind the endpoint? Is that a problem? I guess that if an app were to make a chat request, it would receive some sort of 404 model not found response, which maybe is fine?

Copy link
Member

Choose a reason for hiding this comment

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

I guess this would only be an issue if the app / spring ai attempts to test connectivity to all configured models at startup 🤔

Map<String, String> endpoint = (Map<String, String>)cfCredentials.getMap().get("endpoint");
properties.put("spring.ai.openai.embedding.base-url", endpoint.get("api_base") + "/openai");
properties.put("spring.ai.openai.embedding.api-key", endpoint.get("api_key"));
properties.put("spring.ai.openai.embedding.options.model", "tanzu://embedding");
Copy link
Member

Choose a reason for hiding this comment

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

Same note as above, this will always try to configure an embedding model, even when there is none.

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