
committed by
GitHub

parent
3f9de128be
commit
bc2ea68332
@ -4,8 +4,10 @@ import time
|
||||
from typing import Literal, Dict, Any
|
||||
import config
|
||||
from dto.requests import GameStartRequestDTO, GameDecisionRequestDTO
|
||||
from services.extractor import extract_profile, extract_passport, extract_description, extract_account
|
||||
from services.julius_baer_api_client import JuliusBaerApiClient
|
||||
from utils.storage.game_files_manager import store_game_round_data, store_decision
|
||||
from utils.storage.game_files_manager import store_game_round_data
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -34,10 +36,10 @@ class Player:
|
||||
start_response = self.client.start_game(payload)
|
||||
log.info('game started, session id: %s', start_response.session_id)
|
||||
|
||||
client_id = start_response.client_id
|
||||
decision = self.make_decision(start_response.client_data)
|
||||
|
||||
decision_counter = 0
|
||||
client_id = start_response.client_id
|
||||
|
||||
is_game_running = True
|
||||
while is_game_running:
|
||||
@ -53,8 +55,6 @@ class Player:
|
||||
|
||||
status = decision_response.status
|
||||
is_game_running = status not in ['gameover', 'complete']
|
||||
if is_game_running:
|
||||
store_decision(str(client_id), decision)
|
||||
client_id = decision_response.client_id
|
||||
|
||||
decision = self.make_decision(decision_response.client_data)
|
||||
@ -71,11 +71,31 @@ class Player:
|
||||
time.sleep(1)
|
||||
|
||||
def make_decision(self, client_data: Dict[str, Any]) -> Literal["Accept", "Reject"]:
|
||||
# Do your magic!
|
||||
# Data extraction
|
||||
profile = extract_profile(client_data)
|
||||
passport = extract_passport(client_data)
|
||||
description = extract_description(client_data)
|
||||
account = extract_account(client_data)
|
||||
|
||||
prompt_template = (
|
||||
"You are a helpful assistant at a private bank.\n"
|
||||
"Your task is to accept or reject a new client's application for private banking.\n\n"
|
||||
"Only reject the application if there is an inconsistency in the data provided.\n"
|
||||
"Inconsistencies include:\n"
|
||||
"- Incorrect data (e.g., mismatched or invalid information)\n"
|
||||
"- Incomplete data (e.g., missing required fields)\n\n"
|
||||
"Return only JSON matching this format:\n"
|
||||
"{format_instructions}\n\n"
|
||||
"Here is the extracted passport text:\n"
|
||||
"{processed_text}\n\n"
|
||||
"Use the extracted profile, description, and account details to check consistency."
|
||||
)
|
||||
|
||||
# You'd insert the format instructions and passport text here before calling the LLM
|
||||
# For example:
|
||||
# final_prompt = prompt_template.format(
|
||||
# format_instructions=your_format_instructions,
|
||||
# processed_text=passport['text']
|
||||
# )
|
||||
|
||||
return 'Accept' # Replace me!!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user