Skip to content

Commit 8be1e42

Browse files
committed
address review comments
1 parent e87a55e commit 8be1e42

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

models/spring-ai-ollama/src/main/java/org/springframework/ai/ollama/OllamaChatModel.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public static Builder builder() {
112112
return new Builder();
113113
}
114114

115-
static ChatResponseMetadata from(OllamaApi.ChatResponse response, ChatResponse perviousChatResponse) {
115+
static ChatResponseMetadata from(OllamaApi.ChatResponse response, ChatResponse previousChatResponse) {
116116
Assert.notNull(response, "OllamaApi.ChatResponse must not be null");
117117

118118
OllamaChatUsage newUsage = OllamaChatUsage.from(response);
@@ -125,24 +125,24 @@ static ChatResponseMetadata from(OllamaApi.ChatResponse response, ChatResponse p
125125
Duration loadDuration = response.getLoadDuration();
126126
Duration totalDuration = response.getTotalDuration();
127127

128-
if (perviousChatResponse != null && perviousChatResponse.getMetadata() != null) {
129-
if (perviousChatResponse.getMetadata().get("eval-duration") != null) {
130-
evalDuration = evalDuration.plus(perviousChatResponse.getMetadata().get("eval-duration"));
128+
if (previousChatResponse != null && previousChatResponse.getMetadata() != null) {
129+
if (previousChatResponse.getMetadata().get("eval-duration") != null) {
130+
evalDuration = evalDuration.plus(previousChatResponse.getMetadata().get("eval-duration"));
131131
}
132-
if (perviousChatResponse.getMetadata().get("prompt-eval-duration") != null) {
132+
if (previousChatResponse.getMetadata().get("prompt-eval-duration") != null) {
133133
promptEvalDuration = promptEvalDuration
134-
.plus(perviousChatResponse.getMetadata().get("prompt-eval-duration"));
134+
.plus(previousChatResponse.getMetadata().get("prompt-eval-duration"));
135135
}
136-
if (perviousChatResponse.getMetadata().get("load-duration") != null) {
137-
loadDuration = loadDuration.plus(perviousChatResponse.getMetadata().get("load-duration"));
136+
if (previousChatResponse.getMetadata().get("load-duration") != null) {
137+
loadDuration = loadDuration.plus(previousChatResponse.getMetadata().get("load-duration"));
138138
}
139-
if (perviousChatResponse.getMetadata().get("total-duration") != null) {
140-
totalDuration = totalDuration.plus(perviousChatResponse.getMetadata().get("total-duration"));
139+
if (previousChatResponse.getMetadata().get("total-duration") != null) {
140+
totalDuration = totalDuration.plus(previousChatResponse.getMetadata().get("total-duration"));
141141
}
142-
if (perviousChatResponse.getMetadata().getUsage() != null) {
143-
promptTokens += perviousChatResponse.getMetadata().getUsage().getPromptTokens();
144-
generationTokens += perviousChatResponse.getMetadata().getUsage().getGenerationTokens();
145-
totalTokens += perviousChatResponse.getMetadata().getUsage().getTotalTokens();
142+
if (previousChatResponse.getMetadata().getUsage() != null) {
143+
promptTokens += previousChatResponse.getMetadata().getUsage().getPromptTokens();
144+
generationTokens += previousChatResponse.getMetadata().getUsage().getGenerationTokens();
145+
totalTokens += previousChatResponse.getMetadata().getUsage().getTotalTokens();
146146
}
147147
}
148148

0 commit comments

Comments
 (0)