Commit Graph

6 Commits

Author SHA1 Message Date
Bruce MacDonald 4d9568172d api: add optional hints to errors for troubleshooting
Introduces structured error responses that pair error messages with user-friendly
troubleshooting hints. This improves error handling across the codebase and
provides better guidance to users when things go wrong.

Key changes:
- Add ErrorResponse type with Err and Hint fields
- Update client to handle structured errors in streaming and regular responses
- Add specific error handling for common cases like missing models
- Improve CLI output to clearly show both errors and hints
- Add comprehensive test coverage for new error formats

Maintains backward compatibility with existing error handling while making error
messages more helpful and actionable for users.
2025-02-11 13:47:32 -08:00
Bruce MacDonald 00ba065e90 api: document client stream behavior with a test
Added unit tests to verify error handling behavior in the Client.stream and Client.do methods.
Tests cover various error scenarios including:
- Error responses with status codes >= 400
- Error messages with successful status codes
- Empty error messages
- Successful responses
2025-02-11 13:47:09 -08:00
Michael Yang 1954ec5917 uint64 2024-07-22 11:49:02 -07:00
Patrick Devine c69bc19e46
move OLLAMA_HOST to envconfig (#5009) 2024-06-12 18:48:16 -04:00
Patrick Devine 9009bedf13
better checking for OLLAMA_HOST variable (#3661) 2024-04-29 19:14:07 -04:00
Michael Yang 28c3f288e2 client: fix trailing slash 2023-10-26 11:09:38 -07:00