Closed upasana-mittal closed 1 month ago
Hi @upasana-mittal. Thanks for your interest in Private AI. We are currently looking into this and will get back to you shortly.
Hey @upasana-mittal!
Instead of passing a dictionary, can you try creating a request_objects.file_base64_obj
and pass it to request_object
?
i.e;
instead of doing
response = client.process_files_base64(
request_object={
'file': {
'data': encoded_pdf,
'content_type': 'application/pdf'
},
'entity_detection': {
"entity_types": ['NAME', 'NAME_GIVEN', 'NAME_FAMILY', 'DOB', 'LOCATION', 'ACCOUNT_NUMBER', 'DATE',
'EMAIL_ADDRESS',
'HEALTHCARE_NUMBER', 'LOCATION_ADDRESS', 'ORGANIZATION_MEDICAL_FACILITY']
}
})
try
request_obj = request_objects.file_base64_obj(
file=request_objects.file_obj(
data=encoded_pdf,
content_type='application/pdf'
),
entity_detection=entity_detection
)
response = client.process_files_base64(request_object=request_obj)
if you still want to use a dictionary, the correct format for entity_detection
would be:
response = client.process_files_base64(
request_object={
"file": {
"data": encoded_pdf,
"content_type": "application/pdf"
},
"entity_detection": {
"entity_types": [
{
"type": "ENABLE",
"value": [
"NAME",
"NAME_GIVEN",
"NAME_FAMILY",
"DOB",
"LOCATION",
"ACCOUNT_NUMBER",
"DATE",
"EMAIL_ADDRESS",
"HEALTHCARE_NUMBER",
"LOCATION_ADDRESS",
"ORGANIZATION_MEDICAL_FACILITY"
]
}
]
}
})
Also, note that in your current code entity_detection
object is not being used anywhere.
Hey @upasana-mittal!
Instead of passing a dictionary, can you try creating a
request_objects.file_base64_obj
and pass it torequest_object
?i.e;
instead of doing
response = client.process_files_base64( request_object={ 'file': { 'data': encoded_pdf, 'content_type': 'application/pdf' }, 'entity_detection': { "entity_types": ['NAME', 'NAME_GIVEN', 'NAME_FAMILY', 'DOB', 'LOCATION', 'ACCOUNT_NUMBER', 'DATE', 'EMAIL_ADDRESS', 'HEALTHCARE_NUMBER', 'LOCATION_ADDRESS', 'ORGANIZATION_MEDICAL_FACILITY'] } })
try
request_obj = request_objects.file_base64_obj( file=request_objects.file_obj( data=encoded_pdf, content_type='application/pdf' ), entity_detection=entity_detection ) response = client.process_files_base64(request_object=request_obj)
if you still want to use a dictionary, the correct format for
entity_detection
would be:response = client.process_files_base64( request_object={ "file": { "data": encoded_pdf, "content_type": "application/pdf" }, "entity_detection": { "entity_types": [ { "type": "ENABLE", "value": [ "NAME", "NAME_GIVEN", "NAME_FAMILY", "DOB", "LOCATION", "ACCOUNT_NUMBER", "DATE", "EMAIL_ADDRESS", "HEALTHCARE_NUMBER", "LOCATION_ADDRESS", "ORGANIZATION_MEDICAL_FACILITY" ] } ] } })
Also, note that in your current code
entity_detection
object is not being used anywhere.
Thanks @letmerecall This worked for me!! I will close this issue
)
)
)
Getting this server error. Please help