about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2026-04-18 22:37:27 +0100
committerArun Isaac2026-04-20 00:23:36 +0100
commitb8ec380aaaa6a44b5ad54924779f331c08eb9be2 (patch)
tree8d46c30f9c531a1019406ab1a123821f1ef14a59
parent60a25919b1245070ee9707e55c406c03a3c2a1d6 (diff)
downloadkaagum-b8ec380aaaa6a44b5ad54924779f331c08eb9be2.tar.gz
kaagum-b8ec380aaaa6a44b5ad54924779f331c08eb9be2.tar.lz
kaagum-b8ec380aaaa6a44b5ad54924779f331c08eb9be2.zip
Capture model context length from OpenAI API.
-rw-r--r--kaagum/openai.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/kaagum/openai.scm b/kaagum/openai.scm
index f57cc25..87478fd 100644
--- a/kaagum/openai.scm
+++ b/kaagum/openai.scm
@@ -32,7 +32,8 @@
 
 (define-public-record-type* (<model> model model?)
   (fields (name model-name)
-          (description model-description)))
+          (description model-description)
+          (context-length model-context-length lensed)))
 
 ;; TODO: URIs must not be operated on using string operations. Replace with a
 ;; more principled implementation involving (web uri).
@@ -116,7 +117,8 @@ in @code{openai-query}."
   (map (lambda (tree)
          (cons (focus (key-ref "id") tree)
                (model (focus (key-ref "name") tree)
-                      (focus (key-ref "description") tree))))
+                      (focus (key-ref "description") tree)
+                      (focus (key-ref "context_length") tree))))
        (vector->list (focus (key-ref "data")
                             (json-get (uri-join base-uri "/v1/models")
                                       #:headers `((authorization