Skip to content

Commit

Permalink
feat: Integrate Ollama for LLM queries and improve timestamp parsing
Browse files Browse the repository at this point in the history
This change integrates Ollama as the LLM provider and improves the robustness of timestamp parsing in the LLMModelsManager. The Ollama instance URL is now configurable via an environment variable. Additionally, error logging for timestamp parsing failures has been enhanced to include more context.
  • Loading branch information
psyray committed Feb 11, 2025
1 parent ffa1283 commit 1497111
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .env-dist
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ INSTALL_TYPE=prebuilt
DJANGO_SUPERUSER_USERNAME=rengine
[email protected]
DJANGO_SUPERUSER_PASSWORD=Sm7IJG.IfHAFw9snSKv

# Ollama Configuration
#OLLAMA_INSTANCE=http://ollama:11434
5 changes: 4 additions & 1 deletion web/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3196,7 +3196,10 @@ def parse_date(date_str):
continue

# If no format matches, log error and return current time
logger.error(f"Could not parse date: {date_str}")
logger.error(f"Could not parse timestamp: {date_str}", extra={
"timestamp": date_str,
"parsing_formats": formats
})
return datetime.now()

all_models.extend([{
Expand Down
11 changes: 11 additions & 0 deletions web/reNgine/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
from pathlib import Path
from .settings import RENGINE_WORDLISTS
import os

###############################################################################
# TOOLS DEFINITIONS
Expand Down Expand Up @@ -439,3 +440,13 @@

# OSINT GooFuzz Path
GOFUZZ_EXEC_PATH = 'GooFuzz'

###############################################################################
# LLM DEFINITIONS
###############################################################################

# Default Ollama instance URL if not set in environment
DEFAULT_OLLAMA_INSTANCE = 'http://ollama:11434'

# Get Ollama instance URL from environment or use default
OLLAMA_INSTANCE = os.getenv('OLLAMA_INSTANCE', DEFAULT_OLLAMA_INSTANCE)
3 changes: 1 addition & 2 deletions web/reNgine/llm/config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from typing import Dict, Any
from reNgine.definitions import OLLAMA_INSTANCE

###############################################################################
# OLLAMA DEFINITIONS
###############################################################################

OLLAMA_INSTANCE = 'http://ollama:11434'

###############################################################################
# LLM SYSTEM PROMPTS
###############################################################################
Expand Down

0 comments on commit 1497111

Please sign in to comment.