{"id":22929944,"url":"https://github.com/genocs/langchain-chainlit-lab","last_synced_at":"2025-09-11T12:38:22.446Z","repository":{"id":203830951,"uuid":"710489310","full_name":"Genocs/langchain-chainlit-lab","owner":"Genocs","description":"Chainlit langchain with docker support","archived":false,"fork":false,"pushed_at":"2024-01-18T16:07:37.000Z","size":691,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T16:54:13.606Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Genocs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"genocs","custom":["https://www.buymeacoffee.com/genocs"]}},"created_at":"2023-10-26T19:53:09.000Z","updated_at":"2025-02-12T07:08:33.000Z","dependencies_parsed_at":"2025-02-07T11:02:19.315Z","dependency_job_id":null,"html_url":"https://github.com/Genocs/langchain-chainlit-lab","commit_stats":null,"previous_names":["genocs/langchain-chainlit-lab"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Genocs/langchain-chainlit-lab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genocs%2Flangchain-chainlit-lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genocs%2Flangchain-chainlit-lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genocs%2Flangchain-chainlit-lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genocs%2Flangchain-chainlit-lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Genocs","download_url":"https://codeload.github.com/Genocs/langchain-chainlit-lab/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Genocs%2Flangchain-chainlit-lab/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269606761,"owners_count":24446259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T10:19:46.544Z","updated_at":"2025-08-09T17:21:22.005Z","avatar_url":"https://github.com/Genocs.png","language":"Python","funding_links":["https://opencollective.com/genocs","https://www.buymeacoffee.com/genocs","https://www.buymeacoffee.com/genocs)!"],"categories":[],"sub_categories":[],"readme":"# 📖 LangChain Chainlit Docker Deployment App\n\n[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://langchain-chainlit-lab.herokuapp.com/)\n\n![Logo](./assets/genocs-library-logo.png?raw=true)\n\n## 🔧 Features\n\n- Basic Skeleton App configured with `openai` API\n- A ChatBot using LangChain and Chainlit\n- Integration with langchain csv_agent\n- poetry integration for python dependency handler\n- Docker Support with Optimisation Cache etc\n- Deployment on Google Cloud App Engine\n- Deployment on Google Cloud using `Cloud Run`\n\n\u003e Reference repository: https://github.com/Genocs/langchain-streamlit-docker-template\n\nThis repo contains an `main.py` file which has a template for a chatbot implementation.\n\n## Adding your chain\n\nTo add your chain, you need to change the `load_chain` function in `main.py`.\nDepending on the type of your chain, you may also need to change the inputs/outputs that occur later on.\n\n## 💻 Running Locally\n\n1. Clone the repository📂\n\n```bash\ngit clone https://github.com/Genocs/langchain-chainlit-lab\n```\n\n2. Install dependencies with [Poetry](https://python-poetry.org/) and activate virtual environment🔨\n\nIf you don't have poetry installed, you can install it with `pip install poetry`.\nAdd `poetry` to your path.\n\n```bash\n# To check if poetry is installed\npoetry --version\n\n# To reevaluate the dependencies run\npoetry lock\n\n# To install the dependencies\npoetry install\n\n# To activate the virtual environment\npoetry shell\n```\n\n3. Run the Chainlit server🚀\n\n```bash\nchainlit run src/main.py\n```\n\nRun App using Docker\n\n--------------------\n\nThis project includes `dockerfile` to run the app in Docker container. In order to optimise the Docker Image\nsize and building time with cache techniques, I have follow tricks in below [Article on Medium](\nhttps://medium.com/@albertazzir/blazing-fast-python-docker-builds-with-poetry-a78a66f5aed0)\n\nBuild the docker container\n\n```bash\ndocker build -t langchain-chainlit-chat-app:latest .\n```\n\nTo generate Image with `DOCKER_BUILDKIT`, follow below command\n\n```bash\nDOCKER_BUILDKIT=1 docker build -t langchain-chainlit-chat-app:latest --target=runtime .\n```\n\n1. Run the docker container directly\n\n```bash\ndocker run -d --name langchain-chainlit-chat-app -p 8000:8000 langchain-chainlit-chat-app \n```\n\n2. Run the docker container using docker-compose (Recommended)\n\n```bash\ndocker-compose up\n```\n\nDeploy App on Google App Engine\n\n--------------------\n\nThis app can be deployed on Google App Engine following below steps.\n\n## Prerequisites\n\nFollow below guide on basic Instructions.\n[How to deploy Streamlit apps to Google App Engine](https://dev.to/whitphx/how-to-deploy-streamlit-apps-to-google-app-engine-407o)\n\nBelow the configurations files:\n\n1. `app.yaml`: A Configuration file for `gcloud`\n2. `.gcloudignore` : Configure the file to ignore file / folders to be uploaded\n\nI have adopted `dockerfile` to deploy the app on GCP APP Engine.\n\n```bash\n# 1. Initialise \u0026 Configure the App\ngcloud app create --project=[YOUR_PROJECT_ID]\n\n# 2. Deploy the App using\ngcloud app deploy\n\n```\n\n3. Access the App using\n\nhttps://langchain-chat-app-ex6cbrefpq-ts.a.run.app/\n\nDeploy App on Google Cloud using Cloud Run (RECOMMENDED)\n\n--------------------\n\nThis app can be deployed on Google Cloud using Cloud Run following below steps.\n\n## Prerequisites\n\nFollow below guide on basic Instructions.\n\n[How to deploy Streamlit apps to Google App Engine](https://dev.to/whitphx/how-to-deploy-streamlit-apps-to-google-app-engine-407o)\n\nWe added below tow configurations files \n\n1. `cloudbuild.yaml`: A Configuration file for `gcloud`\n2. `.gcloudignore` : Configure the file to ignore file / folders to be uploaded\n\nwe are going to use `dockerfile` to deploy the app using Google Cloud Run.\n\n1. Initialise \u0026 Configure the Google Project using Command Prompt\n\n```bash\ngcloud app create --project=[YOUR_PROJECT_ID]\n```\n\n2. Enable Services for the Project\n\n```bash\ngcloud services enable cloudbuild.googleapis.com\ngcloud services enable run.googleapis.com\n```\n\n3. Create Service Account\n\n```bash\ngcloud iam service-accounts create langchain-app-cr \\\n    --display-name=\"langchain-app-cr\"\n\ngcloud projects add-iam-policy-binding langchain-chat \\\n    --member=\"serviceAccount:langchain-app-cr@langchain-chat.iam.gserviceaccount.com\" \\\n    --role=\"roles/run.invoker\"\n\ngcloud projects add-iam-policy-binding langchain-chat \\\n    --member=\"serviceAccount:langchain-app-cr@langchain-chat.iam.gserviceaccount.com\" \\\n    --role=\"roles/serviceusage.serviceUsageConsumer\"\n\ngcloud projects add-iam-policy-binding langchain-chat \\\n    --member=\"serviceAccount:langchain-app-cr@langchain-chat.iam.gserviceaccount.com\" \\\n    --role=\"roles/run.admin\"\n```\n\n4. Generate the Docker\n\n```bash\nDOCKER_BUILDKIT=1 docker build --target=runtime . -t australia-southeast1-docker.pkg.dev/langchain-chat/clapp/langchain-chainlit-chat-app:latest\n```\n\n5. Push Image to Google Artifact's Registry\n\nCreate the repository with name `clapp`\n\n```bash\ngcloud artifacts repositories create clapp \\\n    --repository-format=docker \\\n    --location=australia-southeast1 \\\n    --description=\"A Langachain Chainlit App\" \\\n    --async\n```\n\nConfigure-docker\n\n```bash\ngcloud auth configure-docker australia-southeast1-docker.pkg.dev\n```\n\nIn order to push the `docker-image` to Artifact registry, first create app in the region of choice. \n\nCheck the artifacts locations\n\n```bash\ngcloud artifacts locations list\n```\n\nOnce ready, let us push the image to location\n\n```bash\ndocker push australia-southeast1-docker.pkg.dev/langchain-chat/clapp/langchain-chainlit-chat-app:latest\n```\n\n6. Deploy using Cloud Run\n\nOnce image is pushed to Google Cloud Artifacts Registry. Let us deploy the image.\n\n```bash\ngcloud run deploy langchain-chat-app --image=australia-southeast1-docker.pkg.dev/langchain-chat/clapp/langchain-chainlit-chat-app:latest \\\n    --region=australia-southeast1 \\\n    --service-account=langchain-app-cr@langchain-chat.iam.gserviceaccount.com \\\n    --port=8000\n```\n\n7. Test the App Yourself\n\nYou can try the app using below link\n\nhttps://langchain-chat-app-ex6cbrefpq-ts.a.run.app/\n\n## Report Feedbacks\n\nAs `langchain-chainlit-lab` is a template project with minimal example. Report issues if you face any.\n\n## DISCLAIMER\n\nThis is a template App, when using with openai_api key, you will be charged a nominal fee depending\non number of prompts etc.\n\n## License\n\nThis project is licensed with the [MIT license](LICENSE).\n\n## Changelogs\n\nView Complete [Changelog](https://github.com/Genocs/langchain-chainlit-lab/blob/main/CHANGELOG.md).\n\n## Community\n\n- Discord [@genocs](https://discord.com/invite/fWwArnkV)\n- Facebook Page [@genocs](https://facebook.com/Genocs)\n- Youtube Channel [@genocs](https://youtube.com/c/genocs)\n\n## Support\n\nHas this Project helped you learn something New? or Helped you at work?\nHere are a few ways by which you can support.\n\n- ⭐ Leave a star!\n- 🥇 Recommend this project to your colleagues.\n- 🦸 Do consider endorsing me on LinkedIn for ASP.NET Core - [Connect via LinkedIn](https://www.linkedin.com/in/giovanni-emanuele-nocco-b31a5169/)\n- ☕ If you want to support this project in the long run, [consider buying me a coffee](https://www.buymeacoffee.com/genocs)!\n\n[![buy-me-a-coffee](https://raw.githubusercontent.com/Genocs/langchain-chainlit-lab/main/assets/buy-me-a-coffee.png \"buy me a coffee\")](https://www.buymeacoffee.com/genocs)\n\n## Code Contributors\n\nThis project exists thanks to all the people who contribute. [Submit your PR and join the team!](CONTRIBUTING.md)\n\n[![genocs contributors](https://contrib.rocks/image?repo=Genocs/langchain-chainlit-lab \"genocs contributors\")](https://github.com/Genocs/langchain-chainlit-lab/graphs/contributors)\n\n## Financial Contributors\n\nBecome a financial contributor and help me sustain the project.\n\n**Support the Project** on [Opencollective](https://opencollective.com/genocs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenocs%2Flangchain-chainlit-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenocs%2Flangchain-chainlit-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenocs%2Flangchain-chainlit-lab/lists"}