- Introduction of preferred contact time form
- Logging asset usage in TRAICIE_SELECTION_SPECIALIST
This commit is contained in:
@@ -11,6 +11,7 @@ from common.models.interaction import EveAIAsset
|
||||
from common.models.user import Tenant
|
||||
from common.services.utils.human_answer_services import HumanAnswerServices
|
||||
from common.services.utils.translation_services import TranslationServices
|
||||
from common.utils.business_event_context import current_event
|
||||
from common.utils.eveai_exceptions import EveAISpecialistExecutionError
|
||||
from eveai_chat_workers.definitions.language_level.language_level_v1_0 import LANGUAGE_LEVEL
|
||||
from eveai_chat_workers.definitions.tone_of_voice.tone_of_voice_v1_0 import TONE_OF_VOICE
|
||||
@@ -21,7 +22,7 @@ from eveai_chat_workers.specialists.crewai_base_classes import EveAICrewAICrew,
|
||||
from eveai_chat_workers.specialists.crewai_base_specialist import CrewAIBaseSpecialistExecutor
|
||||
from eveai_chat_workers.specialists.specialist_typing import SpecialistResult, SpecialistArguments
|
||||
|
||||
INITIALISATION_MESSAGE = "Let's start the selection process by asking you a few important questions."
|
||||
INITIALISATION_MESSAGE = "Thank you for showing your interest! Let's start the selection process by asking you a few important questions."
|
||||
START_SELECTION_QUESTION = "Do you want to start the selection procedure?"
|
||||
INSUFFICIENT_INFORMATION_MESSAGE = (
|
||||
"We do not have the necessary information to provide you with the requested answers. "
|
||||
@@ -163,11 +164,9 @@ class SpecialistExecutor(CrewAIBaseSpecialistExecutor):
|
||||
def execute_start_selection_procedure_state(self, arguments: SpecialistArguments, formatted_context, citations,
|
||||
start_message=None) -> SpecialistResult:
|
||||
|
||||
answer = ""
|
||||
if start_message:
|
||||
initialisation_message = TranslationServices.translate(self.tenant_id, INITIALISATION_MESSAGE,
|
||||
arguments.language)
|
||||
answer = f"{start_message}\n\n{initialisation_message}"
|
||||
initialisation_message = TranslationServices.translate(self.tenant_id, INITIALISATION_MESSAGE,
|
||||
arguments.language)
|
||||
answer = f"{start_message}\n\n{initialisation_message}"
|
||||
|
||||
ko_questions = self._get_ko_questions()
|
||||
fields = {}
|
||||
@@ -440,6 +439,21 @@ class SpecialistExecutor(CrewAIBaseSpecialistExecutor):
|
||||
raise EveAISpecialistExecutionError(self.tenant_id, self.specialist_id, self.session_id,
|
||||
"No KO criteria questions found")
|
||||
|
||||
# Register Asset Usage
|
||||
prompt_tokens = ko_questions_asset.prompt_tokens
|
||||
completion_tokens = ko_questions_asset.completion_tokens
|
||||
total_tokens = prompt_tokens + completion_tokens
|
||||
|
||||
metrics = {
|
||||
'total_tokens': total_tokens,
|
||||
'prompt_tokens': prompt_tokens,
|
||||
'completion_tokens': completion_tokens,
|
||||
'time_elapsed': 0,
|
||||
'interaction_type': 'ASSET',
|
||||
}
|
||||
|
||||
current_event.log_llm_metrics(metrics)
|
||||
|
||||
ko_questions_data = minio_client.download_asset_file(self.tenant_id, ko_questions_asset.bucket_name,
|
||||
ko_questions_asset.object_name)
|
||||
ko_questions = KOQuestions.from_json(ko_questions_data)
|
||||
|
||||
Reference in New Issue
Block a user