civerson916 commited on
Commit
4ad97e9
·
verified ·
1 Parent(s): 476b409

Upload models.py

Browse files

Type safety and enum-like behavior in Python 3.10

Files changed (1) hide show
  1. models.py +12 -3
models.py CHANGED
@@ -1,18 +1,27 @@
1
- from enum import StrEnum
 
2
  from pydantic import BaseModel, ConfigDict
3
 
4
 
5
- class GoogleModelID(StrEnum):
6
  GEMINI_2_0_FLASH = "gemini-2.0-flash"
7
  GEMINI_2_5_FLASH_PREVIEW = "gemini-2.5-flash-preview"
 
 
 
 
8
 
9
- class OpenRouterModelID(StrEnum):
10
  QWEN_3_14B_FREE = "openrouter/qwen/qwen3-14b:free"
11
  GPT_4_1_MINI = "openrouter/openai/gpt-4.1-mini"
12
  GPT_O4_MINI = "openrouter/openai/o4-mini"
13
  GROK_3_MINI_BETA = "openrouter/x-ai/grok-3-mini-beta"
14
  GROK_3_BETA = "openrouter/x-ai/grok-3-beta"
15
 
 
 
 
 
16
  class Question(BaseModel):
17
  model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
18
  task_id: str
 
1
+ # from enum import StrEnum
2
+ from enum import Enum
3
  from pydantic import BaseModel, ConfigDict
4
 
5
 
6
+ class GoogleModelID(Enum):
7
  GEMINI_2_0_FLASH = "gemini-2.0-flash"
8
  GEMINI_2_5_FLASH_PREVIEW = "gemini-2.5-flash-preview"
9
+
10
+ # Type safety and enum-like behavior in Python 3.10
11
+ def __str__(self):
12
+ return self.value
13
 
14
+ class OpenRouterModelID(Enum):
15
  QWEN_3_14B_FREE = "openrouter/qwen/qwen3-14b:free"
16
  GPT_4_1_MINI = "openrouter/openai/gpt-4.1-mini"
17
  GPT_O4_MINI = "openrouter/openai/o4-mini"
18
  GROK_3_MINI_BETA = "openrouter/x-ai/grok-3-mini-beta"
19
  GROK_3_BETA = "openrouter/x-ai/grok-3-beta"
20
 
21
+ # Type safety and enum-like behavior in Python 3.10
22
+ def __str__(self):
23
+ return self.value
24
+
25
  class Question(BaseModel):
26
  model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
27
  task_id: str