Models factory

The Models factory class is a flexible way to create and manage a model configuration with its initialization settings.

After defining it in a JSON file named 'models.json', you can create the model by simply referring to its name, for example:

Models.setup("../../models")

model = Models.create("openai:gpt-4-development")

The first line calls Models.setup() to initialize the Models factory with the folder where model files and configs ("models.json" and "formats.json") are located.

The second line calls Models.create() to create a model from the name "openai:gpt-4-development". In this case we created a remote model, but we could as well create a local model based in a GGUF file.

The names should be in the format "provider:model_name" and Sibila currently supports the following providers:

Provider Type Creates object of type
llamacpp Local GGUF model LlamaCppModel
anthropic Remote model AnthropicModel
fireworks Remote model FireworksModel
groq Remote model GroqModel
mistral Remote model MistralModel
openai Remote model OpenAIModel
together Remote model TogetherModel

The name part, after the "provider:", must either be:

  • A remote model name, like "gpt-4": "openai:gpt-4"
  • For llamacpp, a local model name, defined in a models.json file, like "openchat": "llamacpp:openchat"
  • Also for llamacpp, name can be the actual filename of a model in the "models" folder: "llamacpp:openchat-3.5-1210.Q4_K_M.gguf".

Although you can use filenames as model names, it's generally a better idea, for continued use, to create an entry in the "models.json" file - this allows future model replacement to be much easier.

See Managing models to learn how to register these model names.