diff --git a/blogs-analyzer/src/main/java/com/nashtech/blogs/analyzer/config/GeminiConfiguration.java b/blogs-analyzer/src/main/java/com/nashtech/blogs/analyzer/config/GeminiConfiguration.java index d077c1e..8f01103 100644 --- a/blogs-analyzer/src/main/java/com/nashtech/blogs/analyzer/config/GeminiConfiguration.java +++ b/blogs-analyzer/src/main/java/com/nashtech/blogs/analyzer/config/GeminiConfiguration.java @@ -4,6 +4,7 @@ import com.google.cloud.vertexai.generativeai.ChatSession; import com.google.cloud.vertexai.generativeai.GenerativeModel; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.context.annotation.SessionScope; @@ -12,15 +13,25 @@ @Configuration(proxyBeanMethods = false) public class GeminiConfiguration { + + @Value("${spring.ai.vertex.ai.gemini.project-id}") + private String projectId; + + @Value("${spring.ai.vertex.ai.gemini.location}") + private String location; + + @Value("${spring.ai.vertex.ai.gemini.modelName}") + private String modelName; + @Bean public VertexAI vertexAI() throws IOException { - return new VertexAI("gen-lang-client-0999974873", "asia-south1"); + return new VertexAI(projectId, location); } @Bean public GenerativeModel geminiProVisionGenerativeModel(VertexAI vertexAI) { - return new GenerativeModel("gemini-1.0-pro-vision-001", vertexAI); + return new GenerativeModel(modelName, vertexAI); } @Bean diff --git a/blogs-analyzer/src/main/resources/application.properties b/blogs-analyzer/src/main/resources/application.properties index d137ce4..38c5934 100644 --- a/blogs-analyzer/src/main/resources/application.properties +++ b/blogs-analyzer/src/main/resources/application.properties @@ -1,2 +1,5 @@ spring.application.name=blogsAnalyzer -server.port=8888 \ No newline at end of file +server.port=8888 +spring.ai.vertex.ai.gemini.project-id=gen-lang-client-0999974873 +spring.ai.vertex.ai.gemini.location=asia-south1 +spring.ai.vertex.ai.gemini.modelName=gemini-1.0-pro-vision-001 \ No newline at end of file