Skip to content

[CAI-629] Code refactor of chatbot#1857

Open
mdciri wants to merge 38 commits intomainfrom
CAI-629-refactor-chatbot
Open

[CAI-629] Code refactor of chatbot#1857
mdciri wants to merge 38 commits intomainfrom
CAI-629-refactor-chatbot

Conversation

@mdciri
Copy link
Collaborator

@mdciri mdciri commented Nov 21, 2025

List of Changes

This pull request introduces major architectural changes to the chatbot system, focusing on refactoring, modularization, and improved payload handling between components. Key improvements include moving monitoring-related functionality from chatbot to chatbot-monitor, introducing payload compression for SQS communication, and updating dependencies for better compatibility and performance.

Architectural Refactoring and Modularization:

  • Moved Presidio and DynamoDB functions, as well as the Presidio mask library, from chatbot to chatbot-monitor to better separate monitoring and evaluation concerns.
  • Refactored chatbot-evaluate to send score writing operations to chatbot-monitor instead of directly handling them, removing the dependency on Langfuse client code in chatbot-evaluate.

Payload Compression and SQS Communication:

  • Added compression and decompression utilities in codec.py and updated lambda_function.py to compress payloads before sending them to SQS, improving efficiency and reliability of inter-service communication.
  • Introduced SQS queue configuration and utility functions for monitor queue access, enabling streamlined and configurable message passing.

Dependency and Environment Updates:

  • Updated dependencies in pyproject.toml for llama-index and related packages to newer versions, and added jupyter for development.
  • Modified Dockerfile to install git, ensuring build compatibility.

Logging and Monitoring Enhancements:

  • Refactored logger initialization to support configurable log levels and improved log formatting across modules.
  • Added chatbot version tagging to Langfuse for improved traceability.

Documentation and Miscellaneous:

  • Added an architecture diagram reference to the README.md for better developer onboarding and system understanding.
  • Updated changeset files to document the scope and impact of the refactor and logger updates.

Motivation and Context

move presidio masking into the chatbot-monitor lambda to speed-up the chatbot one. As result, the user should get the chatbot generated response in less time.

How Has This Been Tested?

Locally using docker compose in apps/chatbot/docker and in the DEV environment.

Screenshots (if appropriate):

Types of changes

  • Chore (nothing changes by a user perspective)
  • 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)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@changeset-bot
Copy link

changeset-bot bot commented Nov 21, 2025

🦋 Changeset detected

Latest commit: b47cf8c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
chatbot-evaluate Minor
chatbot-monitor Major
chatbot-index Patch
chatbot Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mdciri mdciri requested a review from batdevis November 21, 2025 11:01
mdciri and others added 4 commits November 21, 2025 12:01
* save query and evaluate functions refactoring

* dynamodb query put

* presidio

* changeset

* Update chatbot app queries

* Update chatbot-monitor scripts

* Update chatbot-monitor scripts

* Update chatbot queries.py

---------

Co-authored-by: mdciri <marco.cirillo@uqido.com>
Co-authored-by: Marco Domenico Cirillo <59966344+mdciri@users.noreply.github.com>
@github-actions
Copy link
Contributor

This pull request is stale because it has been open for 14 days with no activity. If the pull request is still valid, please update it within 21 days to keep it open or merge it, otherwise it will be closed automatically.

@github-actions github-actions bot added the stale label Dec 15, 2025
mdciri and others added 2 commits December 16, 2025 13:58
* save query and evaluate functions refactoring

* dynamodb query put

* presidio

* changeset

* Update chatbot app queries

* Update chatbot-evaluator modules

* Update poetry files

* Update lambda function

* Update chatbot monitor scripts

* Update chatbot-evaluate scripts

* Update chatbot-evaluate lamda function

* Update chatbot-monitor lambda function

* Add changeset

* Update chatbot-monitor monitor.py

* Update chatbot-monitor monitor.py

* Align to CAI-629

* Update lambda function to consider only unique records

* Update lambda function in chatbot-monitor

* Update chatbot-evaluate lambda function

* Update chatbot-evaluate tests

* Update loggers in chatbot monitor, index, and evaluate

* Update loggers in chatbot, monitor, index, and evaluate

* Update dockerfile for tests

* Add new changeset

* fix: logger param

* fix: comment langfuse add score. We will use SQS queue in another pr

* comment calls to presidio. In a future pr we will use SQS for them

---------

Co-authored-by: batdevis <devis.battisti@uqido.com>
@github-actions github-actions bot removed the stale label Dec 22, 2025
@github-actions
Copy link
Contributor

This pull request is stale because it has been open for 14 days with no activity. If the pull request is still valid, please update it within 21 days to keep it open or merge it, otherwise it will be closed automatically.

* run Docker as normal user

* user home

* changeset

* user home

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: marcobottaro <39835990+marcobottaro@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

Jira Pull Request Link

This Pull Request refers to the following Jira issue CAI-629

@github-actions
Copy link
Contributor

Branch is not up to date with base branch

@marcobottaro it seems this Pull Request is not updated with base branch.
Please proceed with a merge or rebase to solve this.

@github-actions
Copy link
Contributor

This PR exceeds the recommended size of 800 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants