ollama / ollama-js

Ollama JavaScript library
https://ollama.ai
MIT License
1.56k stars 103 forks source link

Different interfaces for an un-streamed "streamable" response, a streamed response and the final (done) response from a stream #96

Open hopperelec opened 1 month ago

hopperelec commented 1 month ago

While using ollama-js, I've found myself referring to the Ollama API docs to see exactly when certain fields are provided in the response, but I believe ollama-js should be aiming to abstract away the API. Currently, the types for optional fields aren't actually optional. While documentation on the response interfaces would help with this, I think it would be even better if they were treated as different types of responses altogether.

There's three ways I think the final response could be handled