Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add exception handler #417

Merged
merged 7 commits into from
Oct 28, 2024
Merged

feat: add exception handler #417

merged 7 commits into from
Oct 28, 2024

Conversation

NingLu
Copy link
Collaborator

@NingLu NingLu commented Oct 28, 2024

Fixes #

🤖 AI-Generated PR Description (Powered by Amazon Bedrock)

Description

This pull request includes modifications to the response handling utilities and the main entry point for the online lambda function. Additionally, it updates the requirements for the BCE embedding model.

The changes in response_utils.py aim to improve the formatting and structure of the responses sent from the online lambda function. The modifications in main.py and common_entry.py are related to integrating the updated response utilities and ensuring consistent response handling across different entry points.

The update to requirements.txt for the BCE embedding model ensures that the necessary dependencies are installed for the model to function correctly.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

File Stats Summary

File number involved in this PR: 4, unfold to see the details:

The file changes summary is as follows:

Files
Changes
Change Summary
source/lambda/online/common_logic/common_utils/response_utils.py 1 added, 1 removed The code change handles a potential KeyError by safely accessing nested dictionaries using the get method with a default value.
source/model/bce_embedding/code/requirements.txt 2 added, 1 removed The code changes update the FlagEmbedding library to version 1.2.5, keep BCEmbedding at 0.1.3, and enforce a version constraint on the transformers library to be less than 4.46.0.
source/lambda/online/lambda_main/main_utils/online_entries/common_entry.py 1 added, 2 removed The code changes remove a redundant logging statement from the format_intention_output function and modify the condition for registering RAG tools to only consider the QD (Question Answering) index type.
source/lambda/online/lambda_main/main.py 212 added, 150 removed This code change involves modifications to the Lambda function handler and introduces new functions for handling different types of events. Here's a summary:
  • Introduces create_ddb_history_obj function to create a DynamoDBChatMessageHistory object.
  • Adds compose_connect_body function to compose the body for Amazon Connect API requests.
  • Introduces assemble_event_body function to assemble the event body with relevant information.
  • Adds connect_case_event_handler function to handle Amazon Connect case events.
  • Adds restapi_event_handler function to handle Restful API requests.
  • Adds default_event_handler function to handle default events (WebSocket API).
  • Modifies the lambda_handler function to route events to appropriate handlers based on event source and stream status. |
🤖 AI-Generated PR Description (Powered by Amazon Bedrock)

Description

This pull request includes changes to the online lambda function and the BCE embedding model. The modifications to the response_utils.py file aim to improve the handling of responses in the common logic module. The updates to main.py and common_entry.py are related to enhancing the online entry processing and overall functionality of the lambda function. Additionally, the requirements.txt file for the BCE embedding model has been updated to ensure the correct dependencies are installed.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

File Stats Summary

File number involved in this PR: 4, unfold to see the details:

The file changes summary is as follows:

Files
Changes
Change Summary
source/lambda/online/common_logic/common_utils/response_utils.py 1 added, 1 removed The code change handles a potential KeyError by using a dictionary get method with a default empty dictionary when accessing the 'ddb_additional_kwargs' and 'figure' keys.
source/model/bce_embedding/code/requirements.txt 2 added, 1 removed The code change updates the version of the FlagEmbedding package to 1.2.5, keeps the BCEmbedding package at 0.1.3, and adds a version constraint for the transformers package to be less than 4.46.0.
source/lambda/online/lambda_main/main_utils/online_entries/common_entry.py 1 added, 2 removed The code changes involve removing a logging statement from the format_intention_output function and modifying the condition in the register_rag_tool_from_config function to register RAG tools only for the QD (Question Answering) index type.
source/lambda/online/lambda_main/main.py 211 added, 149 removed This code change modifies the logic for handling different types of events (Amazon Connect case events, REST API events, and WebSocket API events) in the Lambda function. It introduces new functions for assembling the event body, creating a DynamoDB chat message history object, and handling each event type separately. The main changes are:
  1. Introduced assemble_event_body to extract and generate event details from the original event body.
  2. Introduced create_ddb_history_obj to create a DynamoDB chat message history object.
  3. Separated event handling logic into connect_case_event_handler, restapi_event_handler, and default_event_handler.
  4. Refactored error handling by catching exceptions and returning error responses. |

@NingLu NingLu merged commit dab8084 into dev Oct 28, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant