LLM Wrappers package

The package provides wrappers for generative and embedding LLMs provided by OpenAI and WatsonX platforms. Those LLMs can then be used in creation of document retrievers, or for blending and generating explanations based on various process perspectives

Submodules

sax.core.synthesis.llms.base_llm module

class sax.core.synthesis.llms.base_llm.BaseLLM(model_name, temperature)

Bases: object

BaseLLM is a base class for all LLMs wrappers. It provides basic functionality such as setting the model name and temperature and returning the wrapper for the chosen model provider. After creating the wrapper can use it to get the pre-configured models for different tasks (generation/embedding)

getEmbeddingModel()

Get the preconfigured embedding model

Returns:

embdedding model

Return type:

Langchain embedding model

getModel()

Get the preconfigured generation model

Returns:

generation model

Return type:

Langchain generation model

static getModelLLM(modelType: ModelTypes, modelName, temperature) BaseLLM

Return the LLM wrapper of the chosen model provider type, with the chosen model name and temperature :param modelType: model provider type :type modelType: ModelTypes :param modelName: the fully qualified name of the generation model which will be supplied by this wrapper :type modelName: str :param temperature: the temperature for the generation model :type temperature: int :raises ValueError: incorrect model type specified :return: Exception :rtype: BaseLLM

class sax.core.synthesis.llms.base_llm.ModelTypes(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum for supported model providers. Currently supported types are OPENAI and BAM (IBM WatsonX)

BAM = 'bam'
OPENAI = 'openai'

sax.core.synthesis.llms.openai module

class sax.core.synthesis.llms.openai.OpenAILLM(model, temperature)

Bases: BaseLLM

OpenAI LLM wrapper, implementation of BaseLLM

sax.core.synthesis.llms.watsonx module

class sax.core.synthesis.llms.watsonx.WatsonXLLM(model, temperature)

Bases: BaseLLM

WatsonX LLM wrapper, implementation of BaseLLM

Module contents