- Implementation of specialist execution api, including SSE protocol

- eveai_chat becomes deprecated and should be replaced with SSE
- Adaptation of STANDARD_RAG specialist
- Base class definition allowing to realise specialists with crewai framework
- Implementation of SPIN_SPECIALIST
- Implementation of test app for testing specialists (test_specialist_client). Also serves as an example for future SSE-based client
- Improvements to startup scripts to better handle and scale multiple connections
- Small improvements to the interaction forms and views
- Caching implementation improved and augmented with additional caches
This commit is contained in:
Josako
2025-02-20 05:50:16 +01:00
parent d106520d22
commit 25213f2004
79 changed files with 2791 additions and 347 deletions

View File

@@ -36,7 +36,7 @@ class BaseRetriever(ABC):
current_app.logger.error(f"Failed to setup tuning logger: {str(e)}")
raise
def _log_tuning(self, message: str, data: Dict[str, Any] = None) -> None:
def log_tuning(self, message: str, data: Dict[str, Any] = None) -> None:
if self.tuning and self.tuning_logger:
try:
self.tuning_logger.log_tuning('retriever', message, data)

View File

@@ -1,6 +1,9 @@
from typing import Dict, Any
from flask import current_app
from pydantic import BaseModel, Field, model_validator
from config.type_defs.retriever_types import RETRIEVER_TYPES
from common.extensions import cache_manager
class RetrieverMetadata(BaseModel):
@@ -28,6 +31,7 @@ class RetrieverArguments(BaseModel):
based on RETRIEVER_TYPES configuration.
"""
type: str = Field(..., description="Type of retriever (e.g. STANDARD_RAG)")
type_version: str = Field(..., description="Version of retriever type (e.g. 1.0)")
# Allow any additional fields
model_config = {
@@ -37,7 +41,7 @@ class RetrieverArguments(BaseModel):
@model_validator(mode='after')
def validate_required_arguments(self) -> 'RetrieverArguments':
"""Validate that all required arguments for this retriever type are present"""
retriever_config = RETRIEVER_TYPES.get(self.type)
retriever_config = cache_manager.retrievers_config_cache.get_config(self.type, self.type_version)
if not retriever_config:
raise ValueError(f"Unknown retriever type: {self.type}")

View File

@@ -30,7 +30,7 @@ class StandardRAGRetriever(BaseRetriever):
self.tuning = retriever.tuning
self.model_variables = get_model_variables(self.tenant_id)
self._log_tuning("Standard RAG retriever initialized")
self.log_tuning("Standard RAG retriever initialized")
@property
def type(self) -> str:
@@ -140,7 +140,7 @@ class StandardRAGRetriever(BaseRetriever):
compiled_query = str(query_obj.statement.compile(
compile_kwargs={"literal_binds": True} # This will include the actual values in the SQL
))
self._log_tuning('retrieve', {
self.log_tuning('retrieve', {
"arguments": arguments.model_dump(),
"similarity_threshold": self.similarity_threshold,
"k": self.k,