
AWS Lambda + REST calling assistance
- or -
Post a project like this£10(approx. $13)
- Posted:
- Proposals: 4
- Remote
- #4250947
- Expired
Description
Experience Level: Entry
I have a lambda function that works fine in calling a REST endpoint and returning exactly what i need. When i introduce a filter (for PDF's with tags in S3) as below, it shoots an error.
Need a fresh pair of eyes on it.
def retrieve(input_text, kbId):
print("Retrieving information for:", input_text, "from KB:", kb)
try:
response = bedrock_agent_runtime_client.retrieve(
knowledgeBaseId=kbId,
retrievalQuery={
'text': input_text
},
retrievalConfiguration={
"vectorSearchConfiguration": {
"numberOfResults": 5,
"filter": {
"andAll": [
{
"equals": {
"key": "Customer",
"value": "Apple"
}
}
]
}
}
}
)
return response
except Exception as e:
print(f"Error retrieving lambda data: {e}")
return {"error": str(e)}
Need a fresh pair of eyes on it.
def retrieve(input_text, kbId):
print("Retrieving information for:", input_text, "from KB:", kb)
try:
response = bedrock_agent_runtime_client.retrieve(
knowledgeBaseId=kbId,
retrievalQuery={
'text': input_text
},
retrievalConfiguration={
"vectorSearchConfiguration": {
"numberOfResults": 5,
"filter": {
"andAll": [
{
"equals": {
"key": "Customer",
"value": "Apple"
}
}
]
}
}
}
)
return response
except Exception as e:
print(f"Error retrieving lambda data: {e}")
return {"error": str(e)}

Dev M.
100% (16)Projects Completed
14
Freelancers worked with
14
Projects awarded
25%
Last project
29 Oct 2024
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
Hi to you
I can see an kbld as one of arguments retrieve function and be used as kb in first ptint command.
I can see also a “)” as a closed bracket i see it as a syntax error
1105820
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies