Skip to content

Commit 527ca13

Browse files
authored
update: llm_register decorator use class
1 parent 4be1bb9 commit 527ca13

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

dingo/model/model.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import importlib
2+
import inspect
23
import os
34
from functools import wraps
45
from typing import Callable, Dict, List, Optional
@@ -198,14 +199,13 @@ def llm_register(cls, llm_id: str) -> Callable:
198199
Args:
199200
llm_id (str): Name of llm model class.
200201
"""
201-
def decorator(root_method):
202-
cls.llm_name_map[llm_id] = root_method
203-
204-
@wraps(root_method)
205-
def wrapped_function(*args, **kwargs):
206-
return root_method(*args, **kwargs)
202+
def decorator(root_class):
203+
cls.llm_name_map[llm_id] = root_class
207204

208-
return wrapped_function
205+
if inspect.isclass(root_class):
206+
return root_class
207+
else:
208+
raise ValueError("root_class must be a class")
209209

210210
return decorator
211211

0 commit comments

Comments
 (0)