Skip to content

Commit

Permalink
Merge pull request #160 from edeandrea/add-baseurl-prop
Browse files Browse the repository at this point in the history
In azure openai extension, need a way to override the base url
  • Loading branch information
geoand authored Dec 15, 2023
2 parents fde1ac1 + 18db9b6 commit 5bd3e7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ public Object get() {
}

private String getBaseUrl(Langchain4jAzureOpenAiConfig runtimeConfig) {
return String.format("https://%s.openai.azure.com/openai/deployments/%s", runtimeConfig.resourceName(),
runtimeConfig.deploymentId());
var baseUrl = runtimeConfig.baseUrl();

return !baseUrl.trim().isEmpty() ? baseUrl
: String.format("https://%s.openai.azure.com/openai/deployments/%s", runtimeConfig.resourceName(),
runtimeConfig.deploymentId());
}

public void cleanUp(ShutdownContext shutdown) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ public interface Langchain4jAzureOpenAiConfig {
*/
String deploymentId();

/**
* The base url for the Azure OpenAI resource. Defaults to
* {@code https://${quarkus.langchain4j.azure-openai.resource-name}.openai.azure.com/openai/deployments/${quarkus.langchain4j.azure-openai.deployment-id}}.
*/
@WithDefault("https://${quarkus.langchain4j.azure-openai.resource-name}.openai.azure.com/openai/deployments/${quarkus.langchain4j.azure-openai.deployment-id}")
String baseUrl();

/**
* The API version to use for this operation. This follows the YYYY-MM-DD format
*/
Expand Down

0 comments on commit 5bd3e7b

Please sign in to comment.