Closed SimonCW closed 5 months ago
Hi @pepperoni21,
thanks for the library! I've been using it for a bit and stumbled over functions returning Result<T, String> instead of <T, Error> (e.g. the generate() function. IMHO, this decreases the ergonomics, e.g. makes it harder to surface errors, harder to use anyhow::context(), ...
Would you be open for a PR that introduces error types for the client? I'm relatively new to Rust but this is something I can pull off with a bit of guidance. I'd keep to the recommendations shared here: https://youtu.be/jpVzSse7oJ4?si=N4zw1Wg7fVsQ8Mdl
This would probably introduce the thiserror crate as a dependency, increase compile time a little bit, and constitute a breaking change (I think).
Let me know what you think Simon
Hey, thanks for your suggestion. Actually I did make an error type in https://github.com/pepperoni21/ollama-rs/blob/master/src/error.rs, I guess I just forgot to use it in that method.
But if you think you can make some improvements feel free to make a PR, because I know error handling could be better.
Hi @pepperoni21,
thanks for the library! I've been using it for a bit and stumbled over functions returning Result<T, String> instead of <T, Error> (e.g. the generate() function. IMHO, this decreases the ergonomics, e.g. makes it harder to surface errors, harder to use anyhow::context(), ...
Would you be open for a PR that introduces error types for the client? I'm relatively new to Rust but this is something I can pull off with a bit of guidance. I'd keep to the recommendations shared here: https://youtu.be/jpVzSse7oJ4?si=N4zw1Wg7fVsQ8Mdl
This would probably introduce the thiserror crate as a dependency, increase compile time a little bit, and constitute a breaking change (I think).
Let me know what you think Simon