Skip to content

Commit 6937e02

Browse files
committed
Fix MultiChat configuration
1 parent 1a99f37 commit 6937e02

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

docs/ENDPOINTS.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Transfer-Encoding: chunked
186186
{
187187
"content": "The US senators from Washington are Patty Murray and Maria Cantwell.",
188188
"errorMessage": null,
189-
"generationTokens": 14,
189+
"completionTokens": 14,
190190
"modelName": "neversleep/llama-3.1-lumimaid-70b",
191191
"promptTokens": 3230,
192192
"responseTime": "8s19ms",
@@ -196,7 +196,7 @@ Transfer-Encoding: chunked
196196
{
197197
"content": " The two US senators from Washington are Patty Murray and Maria Cantwell.",
198198
"errorMessage": null,
199-
"generationTokens": 16,
199+
"completionTokens": 16,
200200
"modelName": "gryphe/mythomax-l2-13b",
201201
"promptTokens": 2989,
202202
"responseTime": "4s47ms",
@@ -206,7 +206,7 @@ Transfer-Encoding: chunked
206206
{
207207
"content": " The US senators from Washington are Sen. Patty Murray and Sen. Maria Cantwell.",
208208
"errorMessage": null,
209-
"generationTokens": 19,
209+
"completionTokens": 19,
210210
"modelName": "mistralai/mixtral-8x7b-instruct",
211211
"promptTokens": 4592,
212212
"responseTime": "2s833ms",
@@ -216,7 +216,7 @@ Transfer-Encoding: chunked
216216
{
217217
"content": null,
218218
"errorMessage": "Error while extracting response for type [org.springframework.ai.openai.api.OpenAiApi$ChatCompletion] and content type [application/json]",
219-
"generationTokens": null,
219+
"completionTokens": null,
220220
"modelName": "qwen/qwen-2.5-7b-instruct",
221221
"promptTokens": null,
222222
"responseTime": null,
@@ -226,7 +226,7 @@ Transfer-Encoding: chunked
226226
{
227227
"content": "The US senators from Washington are:\n- Senior Senator: Patty Murray (Democrat)\n- Junior Senator: Not mentioned in the provided context, but according to external knowledge, it is Maria Cantwell. However, following the rules: I don't know who the junior senator is based on the given context.",
228228
"errorMessage": null,
229-
"generationTokens": 61,
229+
"completionTokens": 61,
230230
"modelName": "perplexity/llama-3.1-sonar-huge-128k-online",
231231
"promptTokens": 3219,
232232
"responseTime": "11s634ms",
@@ -236,7 +236,7 @@ Transfer-Encoding: chunked
236236
{
237237
"content": "The U.S. senators from Washington are:\n\nPatty Murray (D-WA) - Senior Senator \nCory Booker (D-NJ) - Junior Senator\n\nHowever, there seems to be an error in the provided information. Cory Booker is not a senator from Washington, he is the senior senator from New Jersey. Patty Murray is indeed the senior senator from Washington. The junior senator from Washington is not mentioned in the given context.",
238238
"errorMessage": null,
239-
"generationTokens": 88,
239+
"completionTokens": 88,
240240
"modelName": "anthracite-org/magnum-v4-72b",
241241
"promptTokens": 3739,
242242
"responseTime": "11s623ms",
@@ -246,7 +246,7 @@ Transfer-Encoding: chunked
246246
{
247247
"content": "The US senators from Washington are Sen. Patty Murray [D-WA] and Sen. Maria Cantwell [D-WA].",
248248
"errorMessage": null,
249-
"generationTokens": 26,
249+
"completionTokens": 26,
250250
"modelName": "openai/gpt-4o-mini",
251251
"promptTokens": 3293,
252252
"responseTime": "3s9ms",
@@ -256,7 +256,7 @@ Transfer-Encoding: chunked
256256
{
257257
"content": null,
258258
"errorMessage": "Error while extracting response for type [org.springframework.ai.openai.api.OpenAiApi$ChatCompletion] and content type [application/json]",
259-
"generationTokens": null,
259+
"completionTokens": null,
260260
"modelName": "anthropic/claude-3.5-sonnet-20240620:beta",
261261
"promptTokens": null,
262262
"responseTime": null,
@@ -266,7 +266,7 @@ Transfer-Encoding: chunked
266266
{
267267
"content": null,
268268
"errorMessage": "Error while extracting response for type [org.springframework.ai.openai.api.OpenAiApi$ChatCompletion] and content type [application/json]",
269-
"generationTokens": null,
269+
"completionTokens": null,
270270
"modelName": "google/gemini-pro-1.5",
271271
"promptTokens": null,
272272
"responseTime": null,
@@ -276,7 +276,7 @@ Transfer-Encoding: chunked
276276
{
277277
"content": "The US senators from Washington are:\n1. Senior Senator Patty Murray (Democrat)\n2. Junior Senator Maria Cantwell (Democrat)",
278278
"errorMessage": null,
279-
"generationTokens": 0,
279+
"completionTokens": 0,
280280
"modelName": "nousresearch/hermes-3-llama-3.1-405b",
281281
"promptTokens": 0,
282282
"responseTime": "3s575ms",
@@ -286,7 +286,7 @@ Transfer-Encoding: chunked
286286
{
287287
"content": "Patty Murray (D) and Marco Rubio (R) are the US senators from Washington.",
288288
"errorMessage": null,
289-
"generationTokens": 22,
289+
"completionTokens": 22,
290290
"modelName": "pygmalionai/mythalion-13b",
291291
"promptTokens": 4628,
292292
"responseTime": "4s900ms",
@@ -296,7 +296,7 @@ Transfer-Encoding: chunked
296296
{
297297
"content": "The US senators from Washington are:\n- **Patty Murray** [D-WA], who is the Senior Senator and holds the leadership title of President Pro Tempore of the Senate.\n- **The Junior Senator's information is not provided in the given context.**",
298298
"errorMessage": null,
299-
"generationTokens": 53,
299+
"completionTokens": 53,
300300
"modelName": "x-ai/grok-beta",
301301
"promptTokens": 3787,
302302
"responseTime": "4s7ms",

src/main/java/org/cftoolsuite/config/MultiChat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public Map<String, ChatClient> chatClients(
6767
chatOptions.setModel(model);
6868
OpenAiChatModel openAiChatModel = new OpenAiChatModel(
6969
openAiApi,
70-
chatProperties.getOptions(),
70+
chatOptions,
7171
DefaultToolCallingManager.builder().observationRegistry(observationRegistry).build(),
7272
retryTemplate,
7373
observationRegistry

src/main/java/org/cftoolsuite/domain/chat/MultiChatResponse.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public record MultiChatResponse(
1010
boolean success,
1111
String errorMessage,
1212
Integer promptTokens,
13+
Integer completionTokens,
1314
Integer totalTokens,
1415
String responseTime
1516
) {
@@ -32,10 +33,10 @@ private static String getFormattedResponseTime(long responseTimeMillis) {
3233
}
3334

3435
public static MultiChatResponse success(String model, String response, Usage usage, long responseTime) {
35-
return new MultiChatResponse(model, response, true, null, usage.getPromptTokens(), usage.getTotalTokens(), getFormattedResponseTime(responseTime));
36+
return new MultiChatResponse(model, response, true, null, usage.getPromptTokens(), usage.getCompletionTokens(), usage.getTotalTokens(), getFormattedResponseTime(responseTime));
3637
}
3738

3839
public static MultiChatResponse failure(String model, String error) {
39-
return new MultiChatResponse(model, null, false, error, null, null, null);
40+
return new MultiChatResponse(model, null, false, error, null, null, null, null);
4041
}
4142
}

0 commit comments

Comments
 (0)