client/ollama: document Do

This commit is contained in:
Blake Mizerany 2024-03-31 11:04:20 -07:00
parent a32e7857b2
commit 5182a1dfb1

View File

@ -105,6 +105,9 @@ func (e *Error) Error() string {
return b.String()
}
// Do encodes in and sends it in a request to the Ollama server and decodes
// the response into Res, or an error response (non-2xx) into an *Error, or
// any error encounted decoding the response.
func Do[Res any](ctx context.Context, c *Client, method, path string, in any) (*Res, error) {
var body bytes.Buffer
// TODO(bmizerany): pool and reuse this buffer AND the encoder