MCPcopy Create free account
hub / github.com/nlweb-ai/NLWeb / get_param

Function get_param

AskAgent/python/core/utils/utils.py:100–121  ·  view source on GitHub ↗
(query_params, param_name, param_type=str, default_value=None)

Source from the content-addressed store, hash-verified

98 return parsed.netloc.replace('www.', '')
99
100def get_param(query_params, param_name, param_type=str, default_value=None):
101 value = query_params.get(param_name, default_value)
102 if (value is not None):
103 if param_type is str:
104 if isinstance(value, list):
105 return value[0] if value else ""
106 return value
107 elif param_type is int:
108 return int(value)
109 elif param_type is float:
110 return float(value)
111 elif param_type is bool:
112 if isinstance(value, list):
113 return value[0].lower() == "true"
114 return value.lower() == "true"
115 elif param_type is list:
116 if isinstance(value, list):
117 return value
118 return [item.strip() for item in value.strip('[]').split(',') if item.strip()]
119 else:
120 raise ValueError(f"Unsupported parameter type: {param_type}")
121 return default_value
122
123def log(message):
124 print(message)

Callers 7

ask_llmFunction · 0.90
__init__Method · 0.90
prepareMethod · 0.90
ask_handlerFunction · 0.90
who_handlerFunction · 0.90
sites_handlerFunction · 0.90

Calls 1

getMethod · 0.80

Tested by

no test coverage detected