Skip to content

Commit 08b0c30

Browse files
jitokimilayaperumalg
authored andcommitted
Fix duplicate keys in ChatResponseMetadata for OllamaApi.ChatResponse metadata
Fix assertion in contructor of OllamaChatModel Signed-off-by: jitokim <pigberger70@gmail.com>
1 parent 6261ce0 commit 08b0c30

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
* @author Christian Tzolov
7575
* @author luocongqiu
7676
* @author Thomas Vitale
77+
* @author Jihoon Kim
7778
* @since 1.0.0
7879
*/
7980
public class OllamaChatModel extends AbstractToolCallSupport implements ChatModel {
@@ -97,7 +98,7 @@ public OllamaChatModel(OllamaApi ollamaApi, OllamaOptions defaultOptions,
9798
Assert.notNull(ollamaApi, "ollamaApi must not be null");
9899
Assert.notNull(defaultOptions, "defaultOptions must not be null");
99100
Assert.notNull(observationRegistry, "observationRegistry must not be null");
100-
Assert.notNull(observationRegistry, "modelManagementOptions must not be null");
101+
Assert.notNull(modelManagementOptions, "modelManagementOptions must not be null");
101102
this.chatApi = ollamaApi;
102103
this.defaultOptions = defaultOptions;
103104
this.observationRegistry = observationRegistry;
@@ -118,8 +119,8 @@ public static ChatResponseMetadata from(OllamaApi.ChatResponse response) {
118119
.withKeyValue("eval-duration", response.evalDuration())
119120
.withKeyValue("eval-count", response.evalCount())
120121
.withKeyValue("load-duration", response.loadDuration())
121-
.withKeyValue("eval-duration", response.promptEvalDuration())
122-
.withKeyValue("eval-count", response.promptEvalCount())
122+
.withKeyValue("prompt-eval-duration", response.promptEvalDuration())
123+
.withKeyValue("prompt-eval-count", response.promptEvalCount())
123124
.withKeyValue("total-duration", response.totalDuration())
124125
.withKeyValue("done", response.done())
125126
.build();

0 commit comments

Comments
 (0)