5151import org .openmetadata .schema .configuration .AssetCertificationSettings ;
5252import org .openmetadata .schema .configuration .ExecutorConfiguration ;
5353import org .openmetadata .schema .configuration .HistoryCleanUpConfiguration ;
54+ import org .openmetadata .schema .configuration .LLMConfiguration ;
55+ import org .openmetadata .schema .configuration .LLMEmbeddingsConfig ;
56+ import org .openmetadata .schema .configuration .LLMGoogleConfig ;
57+ import org .openmetadata .schema .configuration .LLMOpenAIConfig ;
5458import org .openmetadata .schema .configuration .SecurityConfiguration ;
5559import org .openmetadata .schema .configuration .WorkflowSettings ;
5660import org .openmetadata .schema .email .SmtpSettings ;
5761import org .openmetadata .schema .entity .app .App ;
5862import org .openmetadata .schema .entity .services .ingestionPipelines .PipelineServiceClientResponse ;
5963import org .openmetadata .schema .security .client .OidcClientConfig ;
6064import org .openmetadata .schema .security .client .OpenMetadataJWTClientConfig ;
65+ import org .openmetadata .schema .security .credentials .AWSBaseConfig ;
6166import org .openmetadata .schema .security .scim .ScimConfiguration ;
6267import org .openmetadata .schema .service .configuration .elasticsearch .ElasticSearchConfiguration ;
63- import org .openmetadata .schema .service .configuration .elasticsearch .Google ;
64- import org .openmetadata .schema .service .configuration .elasticsearch .NaturalLanguageSearchConfiguration ;
6568import org .openmetadata .schema .service .configuration .slackApp .SlackAppConfiguration ;
6669import org .openmetadata .schema .services .connections .metadata .AuthProvider ;
6770import org .openmetadata .schema .services .connections .metadata .OpenMetadataConnection ;
8386import org .openmetadata .service .attachments .AssetService ;
8487import org .openmetadata .service .attachments .AssetServiceFactory ;
8588import org .openmetadata .service .attachments .NoOpAssetService ;
89+ import org .openmetadata .service .clients .llm .LlmConfigHolder ;
8690import org .openmetadata .service .config .ObjectStorageConfiguration ;
8791import org .openmetadata .service .events .scheduled .ServicesStatusJobHandler ;
8892import org .openmetadata .service .exception .CustomExceptionMessage ;
@@ -882,53 +886,21 @@ private StepValidation validateEmbeddingGeneration(
882886
883887 private String getEmbeddingConfigurationMessage (OpenMetadataApplicationConfig applicationConfig ) {
884888 try {
885- NaturalLanguageSearchConfiguration nlpConfig =
886- applicationConfig .getElasticSearchConfiguration ().getNaturalLanguageSearch ();
887- String provider = nlpConfig .getEmbeddingProvider ();
889+ LLMConfiguration llmConfig = LlmConfigHolder .get ();
890+ LLMEmbeddingsConfig embeddings = llmConfig != null ? llmConfig .getEmbeddings () : null ;
891+ String provider =
892+ embeddings != null && embeddings .getProvider () != null
893+ ? embeddings .getProvider ().value ()
894+ : null ;
888895 if (nullOrEmpty (provider )) {
889896 return "Required configuration: embeddingProvider" ;
890897 }
891898
892899 return switch (provider .toLowerCase ()) {
893- case "djl" -> String .format (
894- "DJL configuration: embeddingModel: %s" , nlpConfig .getDjl ().getEmbeddingModel ());
895- case "bedrock" -> String .format (
896- "Bedrock configuration: region: %s, embeddingModelId: %s, embeddingDimension %s" ,
897- nlpConfig .getBedrock ().getAwsConfig () != null
898- ? nlpConfig .getBedrock ().getAwsConfig ().getRegion ()
899- : "not configured" ,
900- nlpConfig .getBedrock ().getEmbeddingModelId (),
901- nlpConfig .getBedrock ().getEmbeddingDimension ());
902- case "openai" -> {
903- String openaiEndpoint =
904- nullOrEmpty (nlpConfig .getOpenai ().getEndpoint ())
905- ? "api.openai.com"
906- : nlpConfig .getOpenai ().getEndpoint ();
907- String deploymentInfo =
908- nullOrEmpty (nlpConfig .getOpenai ().getDeploymentName ())
909- ? ""
910- : String .format (
911- ", deploymentName: %s" , nlpConfig .getOpenai ().getDeploymentName ());
912- yield String .format (
913- "OpenAI configuration: endpoint: %s, embeddingModelId: %s, embeddingDimension: %s%s" ,
914- openaiEndpoint ,
915- nlpConfig .getOpenai ().getEmbeddingModelId (),
916- nlpConfig .getOpenai ().getEmbeddingDimension (),
917- deploymentInfo );
918- }
919- case "google" -> {
920- Google googleCfg = nlpConfig .getGoogle ();
921- if (googleCfg == null ) {
922- yield "Google provider selected but google configuration block is missing" ;
923- }
924- String googleEndpoint =
925- nullOrEmpty (googleCfg .getEndpoint ())
926- ? "generativelanguage.googleapis.com"
927- : googleCfg .getEndpoint ();
928- yield String .format (
929- "Google configuration: endpoint: %s, embeddingModelId: %s, embeddingDimension: %s" ,
930- googleEndpoint , googleCfg .getEmbeddingModelId (), googleCfg .getEmbeddingDimension ());
931- }
900+ case "djl" -> getDjlEmbeddingMessage (embeddings );
901+ case "bedrock" -> getBedrockEmbeddingMessage (llmConfig , embeddings );
902+ case "openai" -> getOpenAiEmbeddingMessage (llmConfig , embeddings );
903+ case "google" -> getGoogleEmbeddingMessage (llmConfig , embeddings );
932904 default -> String .format (
933905 "Unknown provider '%s'. Supported providers: djl, bedrock, openai, google" , provider );
934906 };
@@ -938,6 +910,77 @@ private String getEmbeddingConfigurationMessage(OpenMetadataApplicationConfig ap
938910 }
939911 }
940912
913+ private String getDjlEmbeddingMessage (LLMEmbeddingsConfig embeddings ) {
914+ String message = "DJL provider selected but djl configuration block is missing" ;
915+ if (embeddings .getDjl () != null ) {
916+ message =
917+ String .format (
918+ "DJL configuration: embeddingModel: %s" , embeddings .getDjl ().getEmbeddingModel ());
919+ }
920+ return message ;
921+ }
922+
923+ private String getBedrockEmbeddingMessage (
924+ LLMConfiguration llmConfig , LLMEmbeddingsConfig embeddings ) {
925+ String message = "Bedrock provider selected but bedrock configuration block is missing" ;
926+ if (embeddings .getBedrock () != null ) {
927+ AWSBaseConfig awsConfig =
928+ llmConfig .getBedrock () != null ? llmConfig .getBedrock ().getAwsConfig () : null ;
929+ message =
930+ String .format (
931+ "Bedrock configuration: region: %s, embeddingModelId: %s, embeddingDimension %s" ,
932+ awsConfig != null && awsConfig .getRegion () != null
933+ ? awsConfig .getRegion ()
934+ : "not configured" ,
935+ embeddings .getBedrock ().getEmbeddingModelId (),
936+ embeddings .getBedrock ().getEmbeddingDimension ());
937+ }
938+ return message ;
939+ }
940+
941+ private String getOpenAiEmbeddingMessage (
942+ LLMConfiguration llmConfig , LLMEmbeddingsConfig embeddings ) {
943+ String message = "OpenAI provider selected but openai configuration block is missing" ;
944+ if (embeddings .getOpenai () != null ) {
945+ LLMOpenAIConfig openaiCreds = llmConfig .getOpenai ();
946+ String openaiEndpoint =
947+ openaiCreds == null || nullOrEmpty (openaiCreds .getEndpoint ())
948+ ? "api.openai.com"
949+ : openaiCreds .getEndpoint ();
950+ String deploymentInfo =
951+ openaiCreds == null || nullOrEmpty (openaiCreds .getDeploymentName ())
952+ ? ""
953+ : String .format (", deploymentName: %s" , openaiCreds .getDeploymentName ());
954+ message =
955+ String .format (
956+ "OpenAI configuration: endpoint: %s, embeddingModelId: %s, embeddingDimension: %s%s" ,
957+ openaiEndpoint ,
958+ embeddings .getOpenai ().getEmbeddingModelId (),
959+ embeddings .getOpenai ().getEmbeddingDimension (),
960+ deploymentInfo );
961+ }
962+ return message ;
963+ }
964+
965+ private String getGoogleEmbeddingMessage (
966+ LLMConfiguration llmConfig , LLMEmbeddingsConfig embeddings ) {
967+ String message = "Google provider selected but google configuration block is missing" ;
968+ if (embeddings .getGoogle () != null ) {
969+ LLMGoogleConfig googleCreds = llmConfig .getGoogle ();
970+ String googleEndpoint =
971+ googleCreds == null || nullOrEmpty (googleCreds .getEndpoint ())
972+ ? "generativelanguage.googleapis.com"
973+ : googleCreds .getEndpoint ();
974+ message =
975+ String .format (
976+ "Google configuration: endpoint: %s, embeddingModelId: %s, embeddingDimension: %s" ,
977+ googleEndpoint ,
978+ embeddings .getGoogle ().getEmbeddingModelId (),
979+ embeddings .getGoogle ().getEmbeddingDimension ());
980+ }
981+ return message ;
982+ }
983+
941984 private StepValidation getDatabaseValidation (OpenMetadataApplicationConfig applicationConfig ) {
942985 try {
943986 dao .testConnection ();
0 commit comments