Get a /chat
API up and running in under 5 minutes with LangChain, FastAPI, and OpenAI.
- Cookiecutter >= 2.6.0
- uv >= 0.5.11
- OpenAI API Key
- From the terminal, run
cookiecutter https://github.com/jolfr/langchain-application-template
- Follow on-screen prompts to configure the project. Paste in the OpenAI API key when prompted.
- Wait for the project to generate then
cd <project_slug>
into the project folder. - Take a look at the
README.md
. It has useful commands to help you get up and running. - Fire up a development server with
uv run bash scripts/dev.sh
- Navigate to
localhost:8000/docs
for the Swagger documentation. - Test the
/chat
endpoint by clicking the "Try it out" button and entering a message.
- Service definition with FastAPI
- Preconfigured
/chat
endpoint - Basic LangChain chain using OpenAI model provider
- Testing with pytest
- Production builds with Docker
- Environment management with uv