Skip to content

Commit

Permalink
Changes to read values from property file.
Browse files Browse the repository at this point in the history
  • Loading branch information
SaurabhDhotreknoldus committed Jun 24, 2024
1 parent 7810519 commit cecf9af
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion blogs-analyzer/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
spring.application.name=blogsAnalyzer
server.port=8888
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

0 comments on commit cecf9af

Please sign in to comment.