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

TypeError: o[Symbol.iterator] is not a function #33

Open
astoilkov opened this issue Jan 29, 2024 · 5 comments
Open

TypeError: o[Symbol.iterator] is not a function #33

astoilkov opened this issue Jan 29, 2024 · 5 comments

Comments

@astoilkov
Copy link

Running this code:

const response = await ollama.pull({
  model: props.modelName,
  stream: true
})

for await (const data of response) {
  const percent = data.completed / data.total * 100
  setPercent(percent)
}

Produces this error:

image

@astoilkov
Copy link
Author

Just saw that the same thing happens without stream: true as well.

@da-z
Copy link
Contributor

da-z commented Jan 29, 2024

I have this error too in Chromium and Safari, but Firefox works fine.

@da-z
Copy link
Contributor

da-z commented Jan 31, 2024

One idea is to split the code in 2 libraries. One for browser, without the push/pull stuff and anything that requires fs (call it ollama-js-browser). With just the chat API, model list. (this is what I did essentially - ripped the chat part of the library and vendored the code in https://github.com/da-z/llamazing)

@astoilkov
Copy link
Author

I think Electron should be considered as well. There are both Node and browser APIs.

@dahjson
Copy link

dahjson commented Feb 5, 2024

I'm having the same issue using this within a web app on Chrome. I'm just using the API directly in the meantime, but would prefer to use this package for simplification.

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

No branches or pull requests

3 participants