This commit introduces several improvements to error handling and fixes minor bugs throughout the application:
- Corrected a typo in
supervisorAgentfromimput_variablestoinput_variables. - Added a startup check in
src/travel_agent.pyto ensureOPENAI_API_KEYis set, raising a ValueError if not. - Enhanced
lambda_handlerinsrc/travel_agent.py:- Added try-except for
json.loadsto handleJSONDecodeErrorand return a 400 error. - Improved missing "question" parameter handling to return a 400 error.
- Wrapped the
getResponsecall in a general try-except block to catch unexpected errors and return a 500 error.
- Added try-except for
- Added try-except blocks around external calls and critical operations in:
researchAgent(foragent_executor.invoke)loadData(forloader.loadandChroma.from_documents)supervisorAgent(forsequence.invoke), ensuring it returns an AIMessage-compatible object on error.
- Reviewed
src/requirements.txtand found it to be satisfactory for the application's dependencies.
These changes make the application more robust and provide clearer feedback in case of errors or misconfiguration.