Skip to content

Commit

Permalink
feat : upgrade to 1.0.0-M1
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed May 30, 2024
1 parent 5af5bde commit 0d932ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rag/rag-springai-openai-llm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<properties>
<java.version>21</java.version>
<spring-ai.version>0.8.1</spring-ai.version>
<spring-ai.version>1.0.0-M1</spring-ai.version>
<spotless.version>2.43.0</spotless.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.ai.chat.ChatClient;
import org.springframework.ai.chat.ChatResponse;
import org.springframework.ai.chat.Generation;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.messages.Message;
import org.springframework.ai.chat.messages.UserMessage;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.ai.chat.model.Generation;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.chat.prompt.SystemPromptTemplate;
import org.springframework.ai.document.Document;
Expand Down Expand Up @@ -40,8 +40,8 @@ with one player from the fielding team (the bowler) bowling the ball towards the
private final ChatClient aiClient;
private final VectorStore vectorStore;

public AIChatService(ChatClient aiClient, VectorStore vectorStore) {
this.aiClient = aiClient;
public AIChatService(ChatClient.Builder chatClientBuilder, VectorStore vectorStore) {
this.aiClient = chatClientBuilder.build();
this.vectorStore = vectorStore;
}

Expand All @@ -58,7 +58,7 @@ public String chat(String searchQuery) {
OpenAiChatOptions chatOptions =
OpenAiChatOptions.builder().withFunction("currentDateFunction").build();
Prompt prompt = new Prompt(List.of(systemMessage, userMessage), chatOptions);
ChatResponse aiResponse = aiClient.call(prompt);
ChatResponse aiResponse = aiClient.prompt(prompt).call().chatResponse();
Generation generation = aiResponse.getResult();
return (generation != null) ? generation.getOutput().getContent() : "";
}
Expand Down

0 comments on commit 0d932ba

Please sign in to comment.