Files
julius_baer_onboarding/app.py

51 lines
1.5 KiB
Python
Raw Normal View History

2025-04-12 16:37:06 +02:00
from dto.requests import GameStartRequestDTO
from services.extractor import run_extraction_chain
from services.julius_baer_api_client import JuliusBaerApiClient
from validation.from_passport import FromPassport
2025-04-12 16:37:06 +02:00
from services.player import Player
from utils.parsers import process_passport
2025-04-11 22:42:54 +02:00
from flask import Flask
import config
2025-04-12 02:15:19 +02:00
2025-04-11 22:42:54 +02:00
app = Flask(__name__)
@app.route('/')
2025-04-12 16:37:06 +02:00
def hello_world():
2025-04-11 22:42:54 +02:00
return 'Hello World!'
if __name__ == '__main__':
2025-04-12 16:37:06 +02:00
jb_client = JuliusBaerApiClient()
game_start_request = GameStartRequestDTO(player_name=config.API_TEAM)
res = jb_client.start_game(game_start_request)
passport_data = res.client_data.get("passport")
prompt_template = (
"Extract the following information from the provided passport text.\n"
"Return only JSON matching this format:\n{format_instructions}\n\n"
"Pay special attention to the passport number and signature.\n"
"Passport text:\n{processed_text}"
)
result = run_extraction_chain(
raw_file_data=passport_data,
file_processor=process_passport,
pydantic_model=FromPassport,
prompt_template=prompt_template,
)
print(result)
player = Player()
player.play_on_separate_thread()
2025-04-12 02:15:19 +02:00
2025-04-11 22:42:54 +02:00
app.run()
2025-04-12 16:37:06 +02:00
# res.session_id
# UUID('fde19363-a3d5-432e-8b87-54a6dd54f0dd')
# second test UUID('e3d58302-400a-4bc6-9772-ae50de43c9f4')
# UUID('f8b2a0a6-d4e0-45e6-900f-8ecb3c28f993')
# UUID('f8b2a0a6-d4e0-45e6-900f-8ecb3c28f993')