about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--kaagum/tea.scm5
-rw-r--r--tests/tea.scm2
2 files changed, 6 insertions, 1 deletions
diff --git a/kaagum/tea.scm b/kaagum/tea.scm
index 7617d31..0a90afb 100644
--- a/kaagum/tea.scm
+++ b/kaagum/tea.scm
@@ -243,6 +243,7 @@ state."
 
 (define-record-type* (<llm-response> llm-response llm-response?)
   (fields (session-id llm-response-session-id)
+          (id llm-response-id)
           (message llm-response-message)
           (prompt-tokens llm-response-prompt-tokens)
           (completion-tokens llm-response-completion-tokens)
@@ -1005,8 +1006,10 @@ in @code{tea-loop}."
                                    tools))))
       (list (if (http-error? json)
                 (llm-response (llm-request-session-id effect)
-                              #f 0 0 0 0 0 0 #t)
+                              #f #f 0 0 0 0 0 0 #t)
                 (llm-response (llm-request-session-id effect)
+                              (focus (in-json "id")
+                                     json)
                               (focus (in-json "choices" 0 "message")
                                      json)
                               (focus (in-json "usage" "prompt_tokens")
diff --git a/tests/tea.scm b/tests/tea.scm
index 96c0155..651bec3 100644
--- a/tests/tea.scm
+++ b/tests/tea.scm
@@ -41,6 +41,7 @@
 (test-assert "handle LLM response"
   (run-with-state
    (acp-effects (llm-response 0
+                              "gen-1793743825"
                               '(("role" . "assistant")
                                 ("content" . "Hello! How can I help you today?"))
                               1770
@@ -58,6 +59,7 @@
 (test-assert "handle LLM response without \"cached_tokens\" field in usage"
   (run-with-state
    (acp-effects (llm-response 0
+                              "gen-1793743825"
                               '(("role" . "assistant")
                                 ("content" . "Hello! How can I help you today?"))
                               1770