-
Notifications
You must be signed in to change notification settings - Fork 4
Developer Document
Under Construction.
Note
A GUI feature to switch between LLM models from different providers is planned for future implementation.
As such, the method described here is intended as a temporary solution.
To switch the LLM used in ChatChemTS to another provider's LLM, you will need to make modifications to at least two functions:
-
start()inchatbot_app/app.py -
prepare_chat_model()inchatbot_app/util.py
In the start() function, you define the settings passed to the LLM model that can be adjusted via the GUI. Update these settings to match the requirements of the LLM you wish to use.
Note
Ensure that the setting with id="NumConversationMemory" is retained, as it is a shared requirement across all LLMs.
In the prepare_chat_model() function, update the section where ChatOpenAI() is called.
Modify it to align with the specifications of the chat model you intended to implement.
The settings argument passed to this function contains the configurations defined in start().
For a list of chat models supported by LangChain, refer to the following documentation:
https://python.langchain.com/docs/integrations/chat/
If additional Python packages are required for the new LLM, you must update the following files:
-
pyproject.tomlandpoetry.lockinchatbot_app/
Add the required package to chatbot_app/pyproject.toml, then run the command poetry lock to update the chatbot_app/poetry.lock file. Refer to the Poetry CLI documentation for more details.
If the new LLM requires API keys or other credentials to be defined as environment variables, you need to update the relevant sections in the following files to suit your requirements:
manage_app.shdocker-compose.yaml
Replace the references to OPENAI_API_KEY with the corresponding keys or environment variables for your chosen LLM.
You can inspect the raw logs using the docker logs command if you encounter errors or unexpected behaviors.
docker container ls # List running containers to find the container names related to ChatChemTS
docker logs [CONTAINER_NAME] # Example: chatchemts-chatbot-1 or chatchemts-api_chemtsv2-1