Skip to content

feat: Ollama model name can be selected with a text input node #7282

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/backend/base/langflow/components/models/ollama.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class ChatOllamaComponent(LCModelComponent):
refresh_button=True,
real_time_refresh=True,
),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
),
combobox=True
),

MessageTextInput(
name="external_model_name",
display_name="External Model Name",
info="Provide an external model name to override the dropdown selection.",
value="",
),
SliderInput(
name="temperature",
display_name="Temperature",
Expand Down Expand Up @@ -146,10 +152,18 @@ def build_model(self) -> LanguageModel: # type: ignore[type-var]
mirostat_eta = self.mirostat_eta
mirostat_tau = self.mirostat_tau

# Determine which model name to use
# If external_model_name is provided and not empty, use it
model_to_use = (
self.external_model_name
if hasattr(self, "external_model_name") and self.external_model_name
else self.model_name
)

# Mapping system settings to their corresponding values
llm_params = {
"base_url": self.base_url,
"model": self.model_name,
"model": model_to_use,
"mirostat": mirostat_value,
"format": self.format,
"metadata": self.metadata,
Expand Down
Loading