NBA_Analysis / config.py
shekkari21's picture
Add NBA analysis project files
ddabbe4
raw
history blame
957 Bytes
"""
Configuration settings for the NBA data analysis project.
"""
import os
from crewai import LLM
# NBA Data Configuration
NBA_DATA_PATH = "nba24-25.csv"
# OpenAI Configuration
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
OPENAI_MODEL = os.getenv("OPENAI_MODEL", "gpt-4o")
# Validate OpenAI API key (only raise error when actually trying to use LLM, not on import)
# This allows the app to load even if API key isn't set yet
def get_llm() -> LLM:
"""
Create and return a CrewAI LLM instance configured for OpenAI.
Returns:
LLM: Configured CrewAI LLM instance for OpenAI
Raises:
ValueError: If OPENAI_API_KEY is not set
"""
if not OPENAI_API_KEY:
raise ValueError(
"OPENAI_API_KEY environment variable is not set. "
"Please set it using: export OPENAI_API_KEY='your-api-key'"
)
return LLM(
model=OPENAI_MODEL,
api_key=OPENAI_API_KEY
)