Spaces:
Running
Running
updated model_selector to choose model based on runtime/env to create agents
Browse files- src/config/model_selector.py +21 -0
src/config/model_selector.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from src.utils.runtime_selector import detect_runtime_environment
|
| 2 |
+
import os
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
load_dotenv()
|
| 5 |
+
|
| 6 |
+
#Placeholders
|
| 7 |
+
MODEL_MAP = {
|
| 8 |
+
"gpu": "gemini-2.5-pro-exp-03-25",
|
| 9 |
+
"cpu-local": "gemini-2.0-flash",
|
| 10 |
+
"cloud-only": "gemini-2.0-flash"
|
| 11 |
+
}
|
| 12 |
+
def choose_best_model():
|
| 13 |
+
runtime_env = detect_runtime_environment()
|
| 14 |
+
print(f"[DEBUG] Runtime env: {runtime_env}")
|
| 15 |
+
print(f"[DEBUG] API key exists: {'Yes' if os.environ.get('GEMINI_KEY') else 'No'}")
|
| 16 |
+
if runtime_env == "cpu-local":
|
| 17 |
+
if os.environ.get("GEMINI_KEY"):
|
| 18 |
+
return "gemini-2.0-flash"
|
| 19 |
+
else:
|
| 20 |
+
print("[WARN] No GEMINI_KEY set, falling back to llama3.2.")
|
| 21 |
+
return "llama3.2"
|