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
But the problem is that ollama library doesn't export AbortableAsyncIterator class as you see here 👇🏿
importtype{ChatResponse,AbortableAsyncIterator}from"npm:ollama";// 'ChatResponse' can be imported ✅, but 'AbortableAsyncIterator' causes 👇🏿 // "Module 'npm:ollama' has no exported member 'AbortableAsyncIterator'" error.
The text was updated successfully, but these errors were encountered:
AbdulrhmanGoni
changed the title
Can't export AbortableAsyncIterator class from ollama library
Can't import AbortableAsyncIterator class from ollama library
Jan 3, 2025
@AbdulrhmanGoni I think you are right to ask for AbortableAsyncIterator to be exposed since it is used as a return type of the chat response. I don't know if the maintainers will expose it. In the meantime, in case this might help others, we can use TypeScript's AsyncIterator type combined with an additional abort method to define the return type:
import{ChatResponse}from"ollama/browser";constresponse: Promise<AsyncIterator<ChatResponse>&{abort: ()=>void}>=awaitollama.chat({// model, messages, and other inputsstream: true,});
I tried to pass the returned abortable async iterator from
Ollama.chat
methodas parameter to another custom function like here 👇🏿
But the problem is that
ollama
library doesn't exportAbortableAsyncIterator
class as you see here 👇🏿The text was updated successfully, but these errors were encountered: