Spaces:
Build error
Build error
File size: 1,222 Bytes
7461cd0 352f525 7461cd0 352f525 7461cd0 352f525 7461cd0 352f525 7461cd0 352f525 7461cd0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import os
from dotenv import find_dotenv, load_dotenv
from smolagents import LiteLLMModel, TransformersModel
class ModelFactory:
@staticmethod
def create_model():
"""
Creates and returns a LiteLLMModel instance configured with environment variables.
Returns:
LiteLLMModel: A configured instance of LiteLLMModel
"""
# Load environment variables
load_dotenv(find_dotenv())
# Get configuration from environment variables
api_base = os.getenv("API_BASE")
api_key = os.getenv("API_KEY")
model_id = os.getenv("MODEL_ID")
# Create and return the model
# return LiteLLMModel(
# api_base=api_base,
# api_key=api_key,
# model_id=model_id,
# )
return TransformersModel(
# max_new_tokens=5000,
max_new_tokens=256,
model_id="HuggingFaceTB/SmolLM2-135M-Instruct",
# model_id="HuggingFaceTB/SmolLM2-360M-Instruct",
# model_id="HuggingFaceTB/SmolLM2-1.7B-Instruct",
# model_id="HuggingFaceTB/SmolVLM2-256M-Video-Instruct",
# model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
)
|