Skip to content

Commit

Permalink
Fix session ID handling and add exception handling for query parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
FloRul committed Mar 21, 2024
1 parent 8953148 commit 04df6f6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lambdas/inference/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ def invoke_model(
@tracer.capture_lambda_handler
def lambda_handler(event, context):
response = "this is a dummy response"
source = event.get("queryStringParameters", {}).get("source", "message")
embedding_collection_name = event["queryStringParameters"]["collectionName"]
try:
source = event.get("queryStringParameters", {}).get("source", "message")
embedding_collection_name = event["queryStringParameters"]["collectionName"]

sessionId = str(uuid.uuid1())
sessionId = str(uuid.uuid1())

if "sessionId" in event["queryStringParameters"]:
sessionId = event["queryStringParameters"]["sessionId"]
if "sessionId" in event["queryStringParameters"]:
sessionId = event["queryStringParameters"]["sessionId"]

history = History(session_id=sessionId)
history = History(session_id=sessionId)

try:
query = event["queryStringParameters"]["query"]
docs = []

Expand Down

0 comments on commit 04df6f6

Please sign in to comment.