SDK Reference
Model
Creating Nomadic Models
Overview
This document provides an overview of three key model classes used in the SDK: Model
, OpenAIModel
, and SagemakerModel
. These classes are designed to facilitate the integration and usage of various LLMs in your applications. Each class inherits from the base Model
class, which provides a consistent interface for setting up and running models with specific API keys and hyperparameters.
- The
Model
class is an abstract class and cannot be instantiated directly. Subclasses likeOpenAIModel
andSagemakerModel
provide specific implementations for their respective platforms. - The
api_keys
parameter is essential and must be provided for the model to function correctly. - Each subclass is responsible for handling the specific setup and execution of its respective platform’s model.
Fields (Model
Class)
Parameter | Type | Default | Description | Required |
---|---|---|---|---|
api_keys | Dict[str, str] | N/A | API keys needed to run the model. | Yes |
llm | Optional[LLM] | None , Nomadic creates the LlamaIndex LLM for you. However, you can also define any LlamaIndex LLM here. | The language model (LLM) instance used to run the experiment | No |
required_api_keys | ClassVar[Set[str]] | set() | A set of API keys that the model expects to receive. | No |
hyperparameters | ClassVar[Dict] | DEFAULT_HYPERPARAMETER_SEARCH_SPACE | A dictionary defining the hyperparameters that can be tuned for the model. | No |
name | str | "my model" | The name of the model. | No |
client_id | Optional[str] | None | ID of Model on the Nomadic Workspace, if synched | No |
Methods
get_required_api_keys() -> Set[str]
: Returns the set of expected API keys for the model.get_hyperparameters() -> Dict
: Returns the hyperparameters that can be tuned for the model.run(**kwargs) -> RunResult
: Abstract method that must be implemented by subclasses to execute the model with the provided parameters and return aRunResult
object.