diff options
| author | Xe Iaso <me@xeiaso.net> | 2024-02-03 22:12:19 -0500 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2024-02-04 08:53:04 -0500 |
| commit | 60939a2e6ce459ffabb02e365bdaef66f006e8ae (patch) | |
| tree | c024c273f568485d8b80182987efa16d7056b025 /web | |
| parent | a780c424b1792a01fbc5046b453ccd2ae6ebf455 (diff) | |
| download | x-60939a2e6ce459ffabb02e365bdaef66f006e8ae.tar.xz x-60939a2e6ce459ffabb02e365bdaef66f006e8ae.zip | |
web/ollama: add keep alive for models
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'web')
| -rw-r--r-- | web/ollama/ollama.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/web/ollama/ollama.go b/web/ollama/ollama.go index 130dc34..c679ec3 100644 --- a/web/ollama/ollama.go +++ b/web/ollama/ollama.go @@ -30,12 +30,13 @@ type Message struct { } type CompleteRequest struct { - Model string `json:"model"` - Messages []Message `json:"messages"` - Format *string `json:"format,omitempty"` - Template *string `json:"template,omitempty"` - Stream bool `json:"stream"` - Options map[string]any `json:"options"` + Model string `json:"model"` + Messages []Message `json:"messages"` + Format *string `json:"format,omitempty"` + Template *string `json:"template,omitempty"` + Stream bool `json:"stream"` + Options map[string]any `json:"options"` + KeepAlive string `json:"keep_alive"` } type CompleteResponse struct { @@ -52,6 +53,8 @@ type CompleteResponse struct { } func (c *Client) Chat(ctx context.Context, inp *CompleteRequest) (*CompleteResponse, error) { + inp.KeepAlive = "-1" + buf := &bytes.Buffer{} if err := json.NewEncoder(buf).Encode(inp); err != nil { return nil, fmt.Errorf("ollama: error encoding request: %w", err) |
