]> git.giacomolli.uk - onechat/blobdiff - chain.go
Order daemon and storage declarations
[onechat] / chain.go
index 23c7dec14a6053d8ec38d5201a06f6dc916b4532..59ce563524543d058a7809633451f09a867f02ef 100644 (file)
--- a/chain.go
+++ b/chain.go
@@ -35,6 +35,22 @@ type Chain struct {
        images  *ImageStore
 }
 
+// ChainFunctionCall holds the fields of a function call output item.
+type ChainFunctionCall struct {
+       Type      string `json:"type"`
+       Name      string `json:"name"`
+       Arguments string `json:"arguments"`
+       CallID    string `json:"call_id"`
+}
+
+// ChainFunctionCallOutput is the input item with the result of a function
+// call.
+type ChainFunctionCallOutput struct {
+       Type   string `json:"type"`
+       CallID string `json:"call_id"`
+       Output any    `json:"output"`
+}
+
 // Run runs the chain from input, the input of its first request, and returns
 // the text of the final answer. An error of a log write wraps
 // errChainLogWrite.
@@ -134,22 +150,6 @@ func (c *Chain) handle(ctx context.Context, input []any, response ModelResponse)
        return input, "", nil
 }
 
-// ChainFunctionCall holds the fields of a function call output item.
-type ChainFunctionCall struct {
-       Type      string `json:"type"`
-       Name      string `json:"name"`
-       Arguments string `json:"arguments"`
-       CallID    string `json:"call_id"`
-}
-
-// ChainFunctionCallOutput is the input item with the result of a function
-// call.
-type ChainFunctionCallOutput struct {
-       Type   string `json:"type"`
-       CallID string `json:"call_id"`
-       Output any    `json:"output"`
-}
-
 // chainInputItem returns an output item as an input item for the next request.
 // The calls do not store their items, so the item goes back whole, without its
 // id.