Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion forecasting_tools/data_models/questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,16 @@ def from_metaculus_api_json(cls, post_api_json: dict) -> MetaculusQuestion:

try:
history = question_json["my_forecasts"]["history"]
is_forecasted = history is not None and len(history) > 0
has_history = history is not None and len(history) > 0
current_utc_time = datetime.now(timezone.utc)
previous_forecast = history[-1] if has_history else None
end_time = (
datetime.fromtimestamp(previous_forecast["end_time"], tz=timezone.utc)
if previous_forecast
else None
)
is_forecasted = not (end_time and end_time > current_utc_time)

except Exception:
is_forecasted = False

Expand Down
26 changes: 11 additions & 15 deletions forecasting_tools/forecast_bots/official_bots/fall_template_bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import argparse
import asyncio
import logging
from datetime import datetime, timezone
from datetime import datetime
from typing import Literal

from forecasting_tools.agents_and_tools.research.smart_searcher import SmartSearcher
Expand Down Expand Up @@ -205,25 +205,21 @@ async def _get_question_prediction_info(

previous_forecasts = question.previous_forecasts
if (
question_type in ["parent", "child"]
question.already_forecasted
and question_type in ["parent", "child"]
and previous_forecasts
and question_type not in self.force_reforecast_in_conditional
):
# TODO: add option to not affirm current parent/child forecasts, create new forecast
previous_forecast = previous_forecasts[-1]
current_utc_time = datetime.now(timezone.utc)
if (
previous_forecast.timestamp_end is None
or previous_forecast.timestamp_end > current_utc_time
):
pretty_value = DataOrganizer.get_readable_prediction(previous_forecast)
return (
ReasonedPrediction(
prediction_value=PredictionAffirmed(),
reasoning=f"Already existing forecast reaffirmed at {pretty_value}.",
),
research,
)
pretty_value = DataOrganizer.get_readable_prediction(previous_forecast)
return (
ReasonedPrediction(
prediction_value=PredictionAffirmed(),
reasoning=f"Already existing forecast reaffirmed at {pretty_value}.",
),
research,
)
info = await self._make_prediction(question, research)
full_research = self._add_reasoning_to_research(research, info, question_type)
return info, full_research
Expand Down