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

null fields in GenerateEmbeddingResponse #11

Closed
manglemix opened this issue Dec 15, 2023 · 4 comments
Closed

null fields in GenerateEmbeddingResponse #11

manglemix opened this issue Dec 15, 2023 · 4 comments

Comments

@manglemix
Copy link

I am using the ollama-rs library with a remote server running the latest mistral. Fairly frequently, I get these errors:
An error occurred with ollama-rs: invalid type: null, expected a sequence at line 1 column 17
It is always this error on the same line and column. Most of the responses are fine though. Is it because some values in the embedding are NaN which encodes to null in json? If so, could it be fine for the response to deserialize correctly and just convert these nulls back to NaN?

@pepperoni21
Copy link
Owner

Hey, thanks for reporting this issue. It seems to be a rather old issue of serde serde-rs/json#202. I tried to fix that by replacing f64 with Option<f64>, which should cause NaN to be deserialized to None.
I was not able to reproduce the issue so feel free to test the change
ollama-rs = { git = "https://github.com/pepperoni21/ollama-rs", branch = "issue-embeddings"}

@manglemix
Copy link
Author

Funnily enough my mistral server stopped producing NaNs and idk why. There was no change. If there is another person facing this issue in a more predictable way, this branch would probably be more helpful to them. Thank you for doing this though!

@manglemix
Copy link
Author

Actually I faced the issue again. This branch does not fix it. The error is exactly the same.

@manglemix manglemix reopened this Dec 15, 2023
@pepperoni21
Copy link
Owner

Actually I faced the issue again. This branch does not fix it. The error is exactly the same.

I think NaN is encoded to "NaN" in json, not "null", so using Option doesn't fix it. I added json5 which handles NaN values in issue-embeddings, let me know if it works.

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

2 participants