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

Embedding does not work for Ollama, Mistral and LM Studio #5636

Closed
entrptaher opened this issue Jan 13, 2025 · 2 comments
Closed

Embedding does not work for Ollama, Mistral and LM Studio #5636

entrptaher opened this issue Jan 13, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@entrptaher
Copy link

Bug Description

This is my mistral embedding flow, which works outside of langflow.
image

Mistral embedding component throws error.
image

This is LM Studio and Ollama embedding flow,

image

Both of them throws error,

Embedding model client not properly initialized

I know they works outside of langflow, and even langflow can access it, otherwise it wouldn't be able to read the model names.

image

I thought okay, maybe all embeddings are broken on my version somehow, but then I tested with cohere and it definitely worked as per this screenshot.

image

Which means those components have issues.

This is the error trace,

warnings.warn(
[2025-01-13 01:09:54,589][ERROR] Error generating embeddings
Traceback (most recent call last):
File "", line 58, in generate_embeddings
AttributeError: 'URL' object has no attribute 'startswith'
[2025-01-13 01:12:12,447][ERROR] Error generating embeddings
Traceback (most recent call last):
File "", line 53, in generate_embeddings
ValueError: Embedding model client not properly initialized

Reproduction

Create a embedding with mistral, ollama or lm studio api.

Expected behavior

Embedding models works without throwing errors like it did with cohere embeddings.

Who can help?

No response

Operating System

Darwin Developers-Mini.lan 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec 6 19:04:03 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8132 arm64

Langflow Version

Version 1.1.1.dev28 from langflowai/langflow-nightly:latest image

Python Version

None

Screenshot

No response

Flow File

No response

@entrptaher entrptaher added the bug Something isn't working label Jan 13, 2025
@entrptaher
Copy link
Author

Not sure what I am missing here, even cloudflare embeddings does not work. So far only cohere worked.

@entrptaher
Copy link
Author

I removed these check for client and it started working.

            # Check if the embedding model has the required attributes
            if not hasattr(embedding_model, "client") or not embedding_model.client:
                msg = "Embedding model client not properly initialized"
                raise ValueError(msg)

            # Ensure the base URL has proper protocol
            if hasattr(embedding_model.client, "base_url"):
                base_url = embedding_model.client.base_url
                if not base_url.startswith(("http://", "https://")):
                    embedding_model.client.base_url = f"https://{base_url}"

Result:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants