optional parameter to not stream response (#639)

* update streaming request accept header
* add optional stream param to request bodies
This commit is contained in:
Bruce MacDonald
2023-10-11 12:54:27 -04:00
committed by GitHub
parent 77295f716e
commit 274d5a5fdf
4 changed files with 94 additions and 18 deletions

View File

@@ -17,6 +17,10 @@ import (
"github.com/jmorganca/ollama/version"
)
const DefaultHost = "127.0.0.1:11434"
var envHost = os.Getenv("OLLAMA_HOST")
type Client struct {
base *url.URL
http http.Client
@@ -143,7 +147,7 @@ func (c *Client) stream(ctx context.Context, method, path string, data any, fn f
}
request.Header.Set("Content-Type", "application/json")
request.Header.Set("Accept", "application/json")
request.Header.Set("Accept", "application/x-ndjson")
request.Header.Set("User-Agent", fmt.Sprintf("ollama/%s (%s %s) Go/%s", version.Version, runtime.GOARCH, runtime.GOOS, runtime.Version()))
response, err := c.http.Do(request)