You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
done could be an object instead of a boolean, where the object contains all the fields which are only accessible when done is truthy. This would still allow for if (done), since objects are considered truthy and undefined is not. This would require restructuring the response received from the API, though.
Using a type along the lines of partField & ({ done: false} | { done: true, ... ). This would not require any changes outside of the interface
The text was updated successfully, but these errors were encountered:
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
abort
method #95, these responses could be taken using different parts of that classdone
could be an object instead of a boolean, where the object contains all the fields which are only accessible whendone
is truthy. This would still allow forif (done)
, since objects are considered truthy andundefined
is not. This would require restructuring the response received from the API, though.partField & ({ done: false} | { done: true, ... )
. This would not require any changes outside of the interfaceThe text was updated successfully, but these errors were encountered: