Skip to content

Commit

Permalink
fix: plugin register management
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulter committed Mar 12, 2024
1 parent 9984abd commit 80b18a4
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions util/plugin_dev/api/v1/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ def register_platform(platform_name: str, platform_instance: Platform, context:
if platform.platform_name == platform_name:
raise ValueError(f"Platform {platform_name} has been registered.")

# check
should_attrs = Platform.__dir__()
has_attrs = platform_instance.__dir__()

if not all([attr in has_attrs for attr in should_attrs]):
raise ValueError(f"Platform {platform_name} should implement all methods in LLMProvider.")

context.platforms.append(RegisteredPlatform(platform_name, platform_instance))

def register_llm(llm_name: str, llm_instance: LLMProvider, context: GlobalObject) -> None:
Expand All @@ -43,13 +36,6 @@ def register_llm(llm_name: str, llm_instance: LLMProvider, context: GlobalObject
if llm.llm_name == llm_name:
raise ValueError(f"LLMProvider {llm_name} has been registered.")

# check
should_attrs = LLMProvider.__dir__()
has_attrs = llm_instance.__dir__()

if not all([attr in has_attrs for attr in should_attrs]):
raise ValueError(f"LLMProvider {llm_name} should implement all methods in LLMProvider.")

context.llms.append(RegisteredLLM(llm_name, llm_instance))

def unregister_platform(platform_name: str, context: GlobalObject) -> None:
Expand Down

0 comments on commit 80b18a4

Please sign in to comment.