fix: fixes Ollama Embeddings component (#4787)
Update ollama.py removed unwanted parameter temperature for embedding
This commit is contained in:
parent
5ed32cb573
commit
b3b2b2572a
1 changed files with 3 additions and 13 deletions
|
|
@ -2,7 +2,7 @@ from langchain_ollama import OllamaEmbeddings
|
||||||
|
|
||||||
from langflow.base.models.model import LCModelComponent
|
from langflow.base.models.model import LCModelComponent
|
||||||
from langflow.field_typing import Embeddings
|
from langflow.field_typing import Embeddings
|
||||||
from langflow.io import FloatInput, MessageTextInput, Output
|
from langflow.io import MessageTextInput, Output
|
||||||
|
|
||||||
|
|
||||||
class OllamaEmbeddingsComponent(LCModelComponent):
|
class OllamaEmbeddingsComponent(LCModelComponent):
|
||||||
|
|
@ -16,19 +16,13 @@ class OllamaEmbeddingsComponent(LCModelComponent):
|
||||||
MessageTextInput(
|
MessageTextInput(
|
||||||
name="model",
|
name="model",
|
||||||
display_name="Ollama Model",
|
display_name="Ollama Model",
|
||||||
value="llama3.1",
|
value="nomic-embed-text",
|
||||||
),
|
),
|
||||||
MessageTextInput(
|
MessageTextInput(
|
||||||
name="base_url",
|
name="base_url",
|
||||||
display_name="Ollama Base URL",
|
display_name="Ollama Base URL",
|
||||||
value="http://localhost:11434",
|
value="http://localhost:11434",
|
||||||
),
|
),
|
||||||
FloatInput(
|
|
||||||
name="temperature",
|
|
||||||
display_name="Model Temperature",
|
|
||||||
value=0.1,
|
|
||||||
advanced=True,
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
outputs = [
|
outputs = [
|
||||||
|
|
@ -37,11 +31,7 @@ class OllamaEmbeddingsComponent(LCModelComponent):
|
||||||
|
|
||||||
def build_embeddings(self) -> Embeddings:
|
def build_embeddings(self) -> Embeddings:
|
||||||
try:
|
try:
|
||||||
output = OllamaEmbeddings(
|
output = OllamaEmbeddings(model=self.model, base_url=self.base_url)
|
||||||
model=self.model,
|
|
||||||
base_url=self.base_url,
|
|
||||||
temperature=self.temperature,
|
|
||||||
)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = "Could not connect to Ollama API."
|
msg = "Could not connect to Ollama API."
|
||||||
raise ValueError(msg) from e
|
raise ValueError(msg) from e
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue