Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't import AbortableAsyncIterator class from ollama library #187

Open
AbdulrhmanGoni opened this issue Jan 3, 2025 · 0 comments · May be fixed by #188
Open

Can't import AbortableAsyncIterator class from ollama library #187

AbdulrhmanGoni opened this issue Jan 3, 2025 · 0 comments · May be fixed by #188

Comments

@AbdulrhmanGoni
Copy link

I tried to pass the returned abortable async iterator from Ollama.chat method
as parameter to another custom function like here 👇🏿

async function handleChatResponse(chatResponse: AbortableAsyncIterator<ChatResponse>) {
    for await (const response of chatResponse) {
        console.log(response.message.content)
    }
};

const chatResponse = await ollama.chat({
    model: "llama3.2",
    messages: [...messages],
    stream: true,
})

handleChatResponse(chatResponse)

But the problem is that ollama library doesn't export AbortableAsyncIterator class as you see here 👇🏿

import type { ChatResponse, AbortableAsyncIterator } from "npm:ollama";
// 'ChatResponse' can be imported ✅, but 'AbortableAsyncIterator' causes 👇🏿 
// "Module 'npm:ollama' has no exported member 'AbortableAsyncIterator'" error.
@AbdulrhmanGoni AbdulrhmanGoni changed the title Can't export AbortableAsyncIterator class from ollama library Can't import AbortableAsyncIterator class from ollama library Jan 3, 2025
@AbdulrhmanGoni AbdulrhmanGoni linked a pull request Jan 3, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant