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

[Feature Request]: timeout parameter OllamaEmbeddingFunction #3473

Open
Davidyz opened this issue Jan 12, 2025 · 5 comments · May be fixed by #2946
Open

[Feature Request]: timeout parameter OllamaEmbeddingFunction #3473

Davidyz opened this issue Jan 12, 2025 · 5 comments · May be fixed by #2946
Assignees
Labels
EF Embedding Functions enhancement New feature or request

Comments

@Davidyz
Copy link

Davidyz commented Jan 12, 2025

Describe the problem

When embedding large documents with a not-so-fast Ollama server over a poor network, sometimes the operation times out.

Describe the proposed solution

Add a float type parameter timeout for OllamaEmbeddingFunction, which controls the timeout for the httpx.Client object here.

ref: https://www.python-httpx.org/advanced/timeouts/

Alternatives considered

I was going to submit an PR, but then I saw #2946 which refactors OllamaEmbeddingFunction to use the Ollama python library. I'm not sure when (or whether) this will be merged, but if it ever gets merged, the proposed solution will no longer be appropriate.

Importance

would make my life easier

Additional Information

No response

@Davidyz Davidyz added the enhancement New feature or request label Jan 12, 2025
@tazarov tazarov self-assigned this Jan 14, 2025
@tazarov tazarov added the EF Embedding Functions label Jan 14, 2025
@tazarov
Copy link
Contributor

tazarov commented Jan 14, 2025

@Davidyz, thanks for raising this. I'll review and rebase #2946 and merge it soon.

@tazarov
Copy link
Contributor

tazarov commented Jan 15, 2025

@Davidyz, rabased on latest main and added timeout kwarg to pass to ollama client.

@tazarov tazarov linked a pull request Jan 15, 2025 that will close this issue
1 task
@Davidyz
Copy link
Author

Davidyz commented Jan 15, 2025

Hi, thanks for the update. I tested it and it works, but this needs to be marked as a breaking change because Ollama API doesn't accept 'url' (like http://127.0.0.1:11434/api/embeddings), but rather server host (like http://127.0.0.1:11434). The original configuration simply wouldn't work.

With that said, may I ask what's the estimated time of this being merged into main? (presumably in 0.7?)

EDIT: to be clear, the breaking was due to the shift to Ollama python library, not the addition of timeout.

@tazarov
Copy link
Contributor

tazarov commented Jan 16, 2025

@Davidyz, thanks for testing it out. Indeed, the URL part is a breaking change, and I'll update the docs to reflect this. That said, I've added support for backward compatibility with legacy URLs (e.g. ending with /api/embeddings).

As far as the release goes, possibly in 0.6.4, but once merged, you can always grab the release from main.

@Davidyz
Copy link
Author

Davidyz commented Jan 16, 2025

@Davidyz, thanks for testing it out. Indeed, the URL part is a breaking change, and I'll update the docs to reflect this. That said, I've added support for backward compatibility with legacy URLs (e.g. ending with /api/embeddings).

As far as the release goes, possibly in 0.6.4, but once merged, you can always grab the release from main.

I see. Thanks for the updates. I think I'll still wait for the release so that it's easier to write the version constraints in my pyproject.toml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EF Embedding Functions enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants