feat: adding provider icon to agent (#6741)
* adding provider icon to agent * Update model_input_constants.py * fix: lint issues * [autofix.ci] apply automated fixes --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
99057143ad
commit
8046008b50
13 changed files with 34 additions and 15 deletions
|
|
@ -18,6 +18,7 @@ class ModelProvidersDict(TypedDict):
|
|||
inputs: list[InputTypes]
|
||||
prefix: str
|
||||
component_class: LCModelComponent
|
||||
icon: str
|
||||
|
||||
|
||||
def get_filtered_inputs(component_class):
|
||||
|
|
@ -169,6 +170,7 @@ try:
|
|||
"inputs": openai_inputs,
|
||||
"prefix": "",
|
||||
"component_class": OpenAIModelComponent(),
|
||||
"icon": OpenAIModelComponent.icon,
|
||||
}
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -180,6 +182,7 @@ try:
|
|||
"inputs": azure_inputs,
|
||||
"prefix": "",
|
||||
"component_class": AzureChatOpenAIComponent(),
|
||||
"icon": AzureChatOpenAIComponent.icon,
|
||||
}
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -191,6 +194,7 @@ try:
|
|||
"inputs": groq_inputs,
|
||||
"prefix": "",
|
||||
"component_class": GroqModel(),
|
||||
"icon": GroqModel.icon,
|
||||
}
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -202,6 +206,7 @@ try:
|
|||
"inputs": anthropic_inputs,
|
||||
"prefix": "",
|
||||
"component_class": AnthropicModelComponent(),
|
||||
"icon": AnthropicModelComponent.icon,
|
||||
}
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -213,6 +218,7 @@ try:
|
|||
"inputs": nvidia_inputs,
|
||||
"prefix": "",
|
||||
"component_class": NVIDIAModelComponent(),
|
||||
"icon": NVIDIAModelComponent.icon,
|
||||
}
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -224,6 +230,7 @@ try:
|
|||
"inputs": bedrock_inputs,
|
||||
"prefix": "",
|
||||
"component_class": AmazonBedrockComponent(),
|
||||
"icon": AmazonBedrockComponent.icon,
|
||||
}
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -235,6 +242,7 @@ try:
|
|||
"inputs": google_generative_ai_inputs,
|
||||
"prefix": "",
|
||||
"component_class": GoogleGenerativeAIComponent(),
|
||||
"icon": GoogleGenerativeAIComponent.icon,
|
||||
}
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -246,6 +254,7 @@ try:
|
|||
"inputs": sambanova_inputs,
|
||||
"prefix": "",
|
||||
"component_class": SambaNovaComponent(),
|
||||
"icon": SambaNovaComponent.icon,
|
||||
}
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
@ -254,3 +263,9 @@ MODEL_PROVIDERS = list(MODEL_PROVIDERS_DICT.keys())
|
|||
ALL_PROVIDER_FIELDS: list[str] = [field for provider in MODEL_PROVIDERS_DICT.values() for field in provider["fields"]]
|
||||
|
||||
MODEL_DYNAMIC_UPDATE_FIELDS = ["api_key", "model", "tool_model_enabled", "base_url", "model_name"]
|
||||
|
||||
|
||||
MODELS_METADATA = {
|
||||
key: {"icon": MODEL_PROVIDERS_DICT[key]["icon"] if key in MODEL_PROVIDERS_DICT else None}
|
||||
for key in MODEL_PROVIDERS_DICT
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ from langflow.base.models.model_input_constants import (
|
|||
ALL_PROVIDER_FIELDS,
|
||||
MODEL_DYNAMIC_UPDATE_FIELDS,
|
||||
MODEL_PROVIDERS_DICT,
|
||||
MODELS_METADATA,
|
||||
)
|
||||
from langflow.base.models.model_utils import get_model_name
|
||||
from langflow.components.helpers import CurrentDateComponent
|
||||
|
|
@ -43,6 +44,7 @@ class AgentComponent(ToolCallingAgentComponent):
|
|||
value="OpenAI",
|
||||
real_time_refresh=True,
|
||||
input_types=[],
|
||||
options_metadata=[MODELS_METADATA[key] for key in sorted(MODELS_METADATA.keys())] + [{"icon": "brain"}],
|
||||
),
|
||||
*MODEL_PROVIDERS_DICT["OpenAI"]["inputs"],
|
||||
MultilineInput(
|
||||
|
|
@ -224,6 +226,8 @@ class AgentComponent(ToolCallingAgentComponent):
|
|||
value="Custom",
|
||||
real_time_refresh=True,
|
||||
input_types=["LanguageModel"],
|
||||
options_metadata=[MODELS_METADATA[key] for key in sorted(MODELS_METADATA.keys())]
|
||||
+ [{"icon": "brain"}],
|
||||
)
|
||||
build_config.update({"agent_llm": custom_component.to_dict()})
|
||||
# Update input types for all fields
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue