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
9 changes: 6 additions & 3 deletions backend/python/app/utils/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
from app.utils.aimodels import get_generator_model


async def get_llm(config_service: ConfigurationService, llm_configs = None) -> Tuple[BaseChatModel, dict]:
async def get_llm(
config_service: ConfigurationService, llm_configs=None
) -> Tuple[BaseChatModel, dict]:
if not llm_configs:
ai_models = await config_service.get_config(config_node_constants.AI_MODELS.value,use_cache=False)
ai_models = await config_service.get_config(
config_node_constants.AI_MODELS.value, use_cache=False
)
llm_configs = ai_models["llm"]

if not llm_configs:
Expand All @@ -26,5 +30,4 @@ async def get_llm(config_service: ConfigurationService, llm_configs = None) -> T
if llm:
return llm, config


raise ValueError("No LLM found")
7 changes: 5 additions & 2 deletions backend/python/app/utils/time_conversion.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import time
from datetime import datetime, timezone

MAX_TIMESTAMP_LENGTH = 13


def get_epoch_timestamp_in_ms() -> int:
now = datetime.now(timezone.utc).timestamp()
return int(now * 1000)
return time.time_ns() // 1_000_000


def parse_timestamp(timestamp_str: str) -> int:
# Remove the 'Z' and add '+00:00' for UTC
Expand All @@ -21,6 +23,7 @@ def parse_timestamp(timestamp_str: str) -> int:
# Convert seconds to milliseconds
return timestamp * 1000


def prepare_iso_timestamps(start_time: str, end_time: str) -> tuple[str, str]:
"""Converts start and end time strings to ISO 8601 formatted strings."""
start_timestamp = parse_timestamp(start_time)
Expand Down