aws-samples / aws-genai-llm-chatbot

A modular and comprehensive solution to deploy a Multi-LLM and Multi-RAG powered chatbot (Amazon Bedrock, Anthropic, HuggingFace, OpenAI, Meta, AI21, Cohere, Mistral) using AWS CDK on AWS
https://aws-samples.github.io/aws-genai-llm-chatbot/
MIT No Attribution
1.09k stars 328 forks source link

Centralize and Internationalize System Prompts Across Adapter #571

Open michel-heon opened 1 month ago

michel-heon commented 1 month ago

Description :

Currently, system prompts are scattered throughout the codebase and are only available in English. This setup makes it difficult to manage and internationalize prompts, especially when scaling to new languages or integrating multiple adapters. We propose centralizing the system prompts into a single module for easier management and allowing for internationalization.


Objective :


Affected Adapters:


Proposed Solution:

These methods will fetch the system prompts from the new system_prompts.py class to centralize and simplify prompt management.


Steps for Implementation:

  1. Create a new module system_prompts.py to store all system prompts.
  2. Refactor the aforementioned methods to pull prompts from the system_prompts.py class.
  3. Add support for multiple languages by enabling the selection of language-specific prompts in system_prompts.py.
  4. Update all adapters to use the new prompt management system.

Expected Outcome:


Environment Information:


Additional Information:


Cela permet d'expliquer clairement la problématique, l'objectif, et la solution envisagée pour les contributeurs du projet.

charles-marion commented 1 month ago

Hi @michel-heon , Thank you for the details.

I recently merged the following which reduces the prompts for Bedrock by using a common solution for various models. It might help your use case in the short term https://github.com/aws-samples/aws-genai-llm-chatbot/pull/569 https://github.com/aws-samples/aws-genai-llm-chatbot/blob/main/lib/model-interfaces/langchain/functions/request-handler/adapters/bedrock/base.py#L49

Regarding the update of prompts. An other issue is also suggesting a way to modify the prompts but using a registry: https://github.com/aws-samples/aws-genai-llm-chatbot/issues/334

michel-heon commented 1 month ago

Hello @charles-marion I've just noticed the change. I'm going to migrate to the latest commit for my work. I will also take this change into account for https://github.com/aws-samples/aws-genai-llm-chatbot/issues/572

michel-heon commented 1 month ago

Hi @charles-marion see PR https://github.com/aws-samples/aws-genai-llm-chatbot/pull/576