From d26ee82c36e11eaf1aa25dfb9d1cb7cf3ff734c1 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 12 Nov 2026 02:08:42 +0000 Subject: Capture completion ID from LLM response. --- kaagum/tea.scm | 5 ++++- tests/tea.scm | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) 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?) (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 -- cgit 1.4.1