This sample is an endpoint that tells programming jokes and shows how to deploy a flask app that uses Langchain on to AWS via Defang.
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticated with your AWS account
- (Optional - for local development) Docker CLI
- Open the terminal and type
defang login - Set the environment variable
OPENAI_API_KEYby typingdefang config set OPENAI_API_KEY. - Type
defang compose upin the CLI. - Your app will be running within a few minutes.
For development, first clone the project and navigate to its directory. After such, please run the command
docker compose up --build
This will start a Docker container with the flask app which will display the result of the langchain prompt.
Title: Flask & LangChain
Short Description: A sample project demonstrating how to deploy LangChain with Flask on Defang.
Tags: LangChain, Flask, AI, Python
Languages: python
- git pull origin main
- git checkout -b
- edit or add
- git status
- git add
- git commit
- git push origin
- make a PR
- pip install -r requirements.txt
- flask --app app/main.py run
