This is a demo project to demonstrate the usage of the LangChain framework.
Currently, this project integrates with the following Large Language Models (LLMs):
- OpenAI (https://openai.com/index/openai-api/)
- AFS (https://docs.twcc.ai/docs/user-guides/twcc/afs/api-and-parameters/conversation-api)
In the future, we plan to add support for additional APIs such as Ollama and others. Stay tuned for updates!
- Poetry
- Pyenv
more details on how to install and setup pyenv and poetry can be found in the appendix (or enable
virtualenvs.prefer-active-python
totrue
)
-
Clone this repository
-
Install dependencies using
poetry
poetry install --no-root
-
Signup for LangSmith
-
Remember the API key from the LangSmith-Personal-API Keys
Checkout Available models:
- OpenAI: https://platform.openai.com/docs/models
- AFS: https://docs.twcc.ai/docs/user-guides/twcc/afs/available-model/
- Modify the
config/config.yaml
file to set themodel
andquestion
fields - Create a
.env
file based on the.env.example
file.cp .env.example .env
- Set all the environment variables in the
.env
file
Run the following command to start the FastAPI server using Uvicorn:
poetry run uvicorn main:app --reload
or
poetry run fastapi dev main.py
If you encounter the following error:
TypeError: 'FieldInfo' object is not a mapping
You can resolve it by installing a specific version of the Pydantic library. Run the following command in your terminal:
pip install pydantic==1.10.2