ollama/api
Bruce MacDonald 5b6a8e6001
api/client: handle non-json streaming errors (#13007)
While processing the response stream during a chat or generation if an error is occurred it is parsed and returned to the user. The issue with the existing code is that this assumed the response would be valid JSON, which is not a safe assumption and caused cryptic error messages to be displayed due to parsing failures:
`invalid character 'i' looking for beginning of value`

This change updates the stream function to return the raw error string if it cant be parsed as JSON. This should help with debugging issues by making sure the actual error reaches the user.
2025-12-01 15:10:16 -08:00
..
examples docs: improve syntax highlighting in code blocks (#8854) 2025-02-07 09:55:07 -08:00
client.go api/client: handle non-json streaming errors (#13007) 2025-12-01 15:10:16 -08:00
client_test.go api/client: handle non-json streaming errors (#13007) 2025-12-01 15:10:16 -08:00
types.go logprob: add bytes to logprobs (#13068) 2025-11-13 13:49:25 -08:00
types_test.go api: add omitempty to required tool function parameter type (#12989) 2025-11-06 14:08:55 -08:00
types_typescript_test.go tools: support anyOf types 2025-08-05 16:46:24 -07:00