Skip to content

Releases: diegodemiranda/chatbot-travel-agent-with-gpt

Refactored error handling and bug fixes

26 May 17:56
4bcd437

Choose a tag to compare

This commit introduces several improvements to error handling and fixes minor bugs throughout the application:

  • Corrected a typo in supervisorAgent from imput_variables to input_variables.
  • Added a startup check in src/travel_agent.py to ensure OPENAI_API_KEY is set, raising a ValueError if not.
  • Enhanced lambda_handler in src/travel_agent.py:
    • Added try-except for json.loads to handle JSONDecodeError and return a 400 error.
    • Improved missing "question" parameter handling to return a 400 error.
    • Wrapped the getResponse call in a general try-except block to catch unexpected errors and return a 500 error.
  • Added try-except blocks around external calls and critical operations in:
    • researchAgent (for agent_executor.invoke)
    • loadData (for loader.load and Chroma.from_documents)
    • supervisorAgent (for sequence.invoke), ensuring it returns an AIMessage-compatible object on error.
  • Reviewed src/requirements.txt and 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.