TO CHECK - description chunker implementation
This commit is contained in:
@ -121,6 +121,8 @@ class Advisor:
|
|||||||
{profile}
|
{profile}
|
||||||
|
|
||||||
**Description Document:**
|
**Description Document:**
|
||||||
|
The following is a single physical document, structured into multiple thematic sections. Each section starts with a heading followed by relevant content.
|
||||||
|
|
||||||
{description}
|
{description}
|
||||||
|
|
||||||
**Account Document:**
|
**Account Document:**
|
||||||
|
@ -13,25 +13,10 @@ from validation.from_passport import FromPassport
|
|||||||
from validation.from_profile import FromProfile
|
from validation.from_profile import FromProfile
|
||||||
from validation.from_description import FromDescription
|
from validation.from_description import FromDescription
|
||||||
|
|
||||||
def extract_description(client_data: dict[str, Any]) -> FromDescription:
|
def extract_description(client_data: dict[str, Any]) -> dict[str, str]:
|
||||||
passport_data = client_data.get("description")
|
description_data = client_data.get("description")
|
||||||
|
parsed_data = process_description(description_data)
|
||||||
prompt_template = (
|
return parsed_data
|
||||||
"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\n"
|
|
||||||
"Passport text:\n{processed_text}"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
result = __run_extraction_chain(
|
|
||||||
raw_file_data=passport_data,
|
|
||||||
file_processor=process_description,
|
|
||||||
pydantic_model=FromDescription,
|
|
||||||
prompt_template=prompt_template,
|
|
||||||
)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def extract_account(client_data: dict[str, Any])-> FromAccount:
|
def extract_account(client_data: dict[str, Any])-> FromAccount:
|
||||||
account_data = client_data.get("account")
|
account_data = client_data.get("account")
|
||||||
|
Reference in New Issue
Block a user