From a32e7857b221e2eba0f98fd1fa47ed24ab8c02c4 Mon Sep 17 00:00:00 2001 From: Blake Mizerany Date: Sun, 31 Mar 2024 11:00:07 -0700 Subject: [PATCH] client/ollama: docs for Error type --- client/ollama/ollama.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/client/ollama/ollama.go b/client/ollama/ollama.go index b491cda5..6e8b6f94 100644 --- a/client/ollama/ollama.go +++ b/client/ollama/ollama.go @@ -77,10 +77,21 @@ func (c *Client) Run(ctx context.Context, ref string, messages []apitype.Message } type Error struct { - Status int `json:"status"` - Code string `json:"code"` + // Status is the HTTP status code returned by the server. + Status int `json:"status"` + + // Code specifies a machine readable code indicating the class of + // error this error is. See http://docs.ollama.com/errors for a full + // list of error codes. + Code string `json:"code"` + + // Message is a humage readable message that describes the error. It + // may change across versions of the API, so it should not be used for + // programmatic decisions. Message string `json:"message"` - Field string `json:"field,omitempty"` + + // Field is the field in the request that caused the error, if any. + Field string `json:"field,omitempty"` } func (e *Error) Error() string {