Skip to main content

Table of Contents

Module spoon_ai.llm.factory

LLMFactory Objects​

class LLMFactory()

LLM factory class, used to create different LLM instances

register​

@classmethod
def register(cls, provider_name: str)

Register LLM provider

Arguments:

  • provider_name - Provider name

Returns:

Decorator function

create​

@classmethod
def create(cls,
provider: Optional[str] = None,
config_path: str = "config/config.toml",
config_name: str = "llm") -> LLMBase

Create LLM instance

Arguments:

  • provider - Provider name, if None, read from configuration file
  • config_path - Configuration file path
  • config_name - Configuration name

Returns:

  • LLMBase - LLM instance

Raises:

  • ValueError - If provider does not exist