Skip to main content

Configuration Guide

This guide describes the structure and supported parameters for the config.yaml file used by Krypton ML.

Configuration Structure

The configuration file follows this basic structure:

krypton:
models:
- # Model 1 configuration
- # Model 2 configuration
server:
# Server configuration

Supported Parameters

Root Configuration

ParameterTypeDescription
kryptonObjectThe root object containing all configuration

Krypton Configuration

ParameterTypeDescription
modelsList[Model]List of model configurations
serverServerConfig(Optional) Server configuration

Model Configuration

ParameterTypeRequiredDescription
nameStringYesName of the model
typeStringYesType of the model (e.g., "langchain", "custom")
module_pathStringNoPython path to the module containing the model
callableStringNoName of the function or class to call within the module
endpointStringYesAPI endpoint for the model
optionsModelOptionsNoAdditional options for the model
tagsList[String]NoTags associated with the model (defaults to empty list)
descriptionStringNoDescription of the model (defaults to empty string)
hf_model_nameStringNoHugging Face model name (for HuggingFace models only)
hf_taskStringNoHugging Face task type (defaults to "generation")
hf_model_kwargsObjectNoAdditional keyword arguments for HuggingFace model initialization
hf_generation_kwargsObjectNoAdditional keyword arguments for HuggingFace model generation
hf_deviceStringNoDevice to run the HuggingFace model on (defaults to "cpu")

ModelOptions

ParameterTypeDefaultDescription
debugBooleanFalseEnable debug mode for this model

ServerConfig

ParameterTypeDefaultDescription
hostString"0.0.0.0"Host to bind the server to
portInteger8000Port to run the server on
allow_originsList[String][]List of allowed origins for CORS
allow_credentialsBooleanFalseAllow credentials for CORS
allow_methodsList[String][]Allowed HTTP methods for CORS
allow_headersList[String][]Allowed headers for CORS
debugBooleanFalseEnable debug mode for the server

Example Configuration

Here's an example of a complete config.yaml file:

krypton:
models:
# LangChain model example
- name: text-completion
type: langchain
module_path: examples.text_completion
callable: create_chain
endpoint: /complete
options:
debug: true
tags:
- nlp
- completion
description: "A text completion model using LangChain"

# HuggingFace model example
- name: text-generation
type: huggingface
endpoint: /generate
hf_model_name: gpt2
hf_task: text-generation
hf_device: cuda
hf_model_kwargs:
torch_dtype: float16
hf_generation_kwargs:
max_length: 100
do_sample: true
tags:
- nlp
- generation
description: "GPT-2 text generation model"

server:
host: "0.0.0.0"
port: 8080
allow_origins:
- "https://example.com"
allow_credentials: true
allow_methods:
- "GET"
- "POST"
allow_headers:
- "Content-Type"
debug: true

The example above demonstrates:

  1. A LangChain-based model configuration
  2. A HuggingFace model configuration with specific model parameters
  3. Server configuration with CORS settings

Remember to adjust the paths and parameters according to your specific setup and requirements.