Refactor instantiate_custom_component function signature
This commit refactors the function signature of the `instantiate_custom_component` function in `loading.py`. The `class_object` parameter is now annotated with the `Type["CustomComponent"]` type hint to improve type safety.
This commit is contained in:
parent
7a3d057a50
commit
0c16cbed04
1 changed files with 2 additions and 2 deletions
|
|
@ -119,8 +119,8 @@ async def instantiate_based_on_type(class_object, base_type, node_type, params,
|
|||
|
||||
async def instantiate_custom_component(node_type, class_object, params, user_id):
|
||||
params_copy = params.copy()
|
||||
class_object: "CustomComponent" = eval_custom_component_code(params_copy.pop("code"))
|
||||
custom_component = class_object(user_id=user_id)
|
||||
class_object: Type["CustomComponent"] = eval_custom_component_code(params_copy.pop("code"))
|
||||
custom_component: "CustomComponent" = class_object(user_id=user_id)
|
||||
|
||||
if "retriever" in params_copy and hasattr(params_copy["retriever"], "as_retriever"):
|
||||
params_copy["retriever"] = params_copy["retriever"].as_retriever()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue