🔥 refactor(config.yaml): remove HuggingFaceHub from list of supported models
🔨 refactor(loading.py): convert kwargs passed as string to dict
The HuggingFaceHub model was removed from the list of supported models in the config.yaml file. The model was removed because it is no longer being used in the project. In the loading.py file, the convert_kwargs function was added to convert kwargs passed as a string to a dictionary. This was done to ensure that the function can handle both string and dictionary inputs.
This commit is contained in:
parent
38148677f1
commit
2d52c684c4
2 changed files with 11 additions and 2 deletions
|
|
@ -52,7 +52,6 @@ llms:
|
|||
- OpenAI
|
||||
# - AzureOpenAI
|
||||
- ChatOpenAI
|
||||
- HuggingFaceHub
|
||||
- LlamaCpp
|
||||
- CTransformers
|
||||
- Cohere
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ from langflow.utils import util, validate
|
|||
def instantiate_class(node_type: str, base_type: str, params: Dict) -> Any:
|
||||
"""Instantiate class from module type and key, and params"""
|
||||
params = convert_params_to_sets(params)
|
||||
|
||||
params = convert_kwargs(params)
|
||||
if node_type in CUSTOM_AGENTS:
|
||||
custom_agent = CUSTOM_AGENTS.get(node_type)
|
||||
if custom_agent:
|
||||
|
|
@ -50,6 +50,16 @@ def convert_params_to_sets(params):
|
|||
return params
|
||||
|
||||
|
||||
def convert_kwargs(params):
|
||||
# if *kwargs are passed as a string, convert to dict
|
||||
# first find any key that has kwargs in it
|
||||
kwargs_keys = [key for key in params.keys() if "kwargs" in key]
|
||||
for key in kwargs_keys:
|
||||
if isinstance(params[key], str):
|
||||
params[key] = json.loads(params[key])
|
||||
return params
|
||||
|
||||
|
||||
def instantiate_based_on_type(class_object, base_type, node_type, params):
|
||||
if base_type == "agents":
|
||||
return instantiate_agent(class_object, params)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue