Spaces:
Running
Running
Sync from GitHub (tests passed)
Browse files- app/ai_engine.py +2 -49
app/ai_engine.py
CHANGED
|
@@ -139,36 +139,7 @@ Label mapping:
|
|
| 139 |
- otherwise => NEUTRAL
|
| 140 |
"""
|
| 141 |
LLM_SCORING_RESPONSE_FORMAT_V2 = {
|
| 142 |
-
"type": "
|
| 143 |
-
"json_schema": {
|
| 144 |
-
"name": "news_sentiment_scores_v2",
|
| 145 |
-
"strict": True,
|
| 146 |
-
"schema": {
|
| 147 |
-
"type": "array",
|
| 148 |
-
"items": {
|
| 149 |
-
"type": "object",
|
| 150 |
-
"properties": {
|
| 151 |
-
"id": {"type": "integer"},
|
| 152 |
-
"label": {"type": "string", "enum": ["BULLISH", "BEARISH", "NEUTRAL"]},
|
| 153 |
-
"impact_score": {"type": "number", "minimum": -1, "maximum": 1},
|
| 154 |
-
"confidence": {"type": "number", "minimum": 0, "maximum": 1},
|
| 155 |
-
"relevance": {"type": "number", "minimum": 0, "maximum": 1},
|
| 156 |
-
"event_type": {"type": "string", "enum": sorted(LLM_V2_EVENT_TYPES)},
|
| 157 |
-
"reasoning": {"type": "string"},
|
| 158 |
-
},
|
| 159 |
-
"required": [
|
| 160 |
-
"id",
|
| 161 |
-
"label",
|
| 162 |
-
"impact_score",
|
| 163 |
-
"confidence",
|
| 164 |
-
"relevance",
|
| 165 |
-
"event_type",
|
| 166 |
-
"reasoning",
|
| 167 |
-
],
|
| 168 |
-
"additionalProperties": False,
|
| 169 |
-
},
|
| 170 |
-
},
|
| 171 |
-
},
|
| 172 |
}
|
| 173 |
SCORING_V2_VERSION = "commodity_v2"
|
| 174 |
|
|
@@ -374,25 +345,7 @@ Rules:
|
|
| 374 |
|
| 375 |
|
| 376 |
LLM_SCORING_RESPONSE_FORMAT = {
|
| 377 |
-
"type": "
|
| 378 |
-
"json_schema": {
|
| 379 |
-
"name": "news_sentiment_scores",
|
| 380 |
-
"strict": True,
|
| 381 |
-
"schema": {
|
| 382 |
-
"type": "array",
|
| 383 |
-
"items": {
|
| 384 |
-
"type": "object",
|
| 385 |
-
"properties": {
|
| 386 |
-
"id": {"type": "integer"},
|
| 387 |
-
"label": {"type": "string", "enum": ["BULLISH", "BEARISH", "NEUTRAL"]},
|
| 388 |
-
"confidence": {"type": "number", "minimum": 0, "maximum": 1},
|
| 389 |
-
"reasoning": {"type": "string"},
|
| 390 |
-
},
|
| 391 |
-
"required": ["id", "label", "confidence"],
|
| 392 |
-
"additionalProperties": False,
|
| 393 |
-
},
|
| 394 |
-
},
|
| 395 |
-
},
|
| 396 |
}
|
| 397 |
|
| 398 |
LLM_SCORING_PROVIDER_OPTIONS = {"require_parameters": True}
|
|
|
|
| 139 |
- otherwise => NEUTRAL
|
| 140 |
"""
|
| 141 |
LLM_SCORING_RESPONSE_FORMAT_V2 = {
|
| 142 |
+
"type": "json_object",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
}
|
| 144 |
SCORING_V2_VERSION = "commodity_v2"
|
| 145 |
|
|
|
|
| 345 |
|
| 346 |
|
| 347 |
LLM_SCORING_RESPONSE_FORMAT = {
|
| 348 |
+
"type": "json_object",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 349 |
}
|
| 350 |
|
| 351 |
LLM_SCORING_PROVIDER_OPTIONS = {"require_parameters": True}
|