{"id":20698082,"url":"https://github.com/fly-apps/hello-fly-langchain","last_synced_at":"2025-04-22T21:44:12.933Z","repository":{"id":156155368,"uuid":"632867959","full_name":"fly-apps/hello-fly-langchain","owner":"fly-apps","description":"A minimal example of how to deploy LangChain to Fly.io using Flask","archived":false,"fork":false,"pushed_at":"2023-06-08T09:01:41.000Z","size":12,"stargazers_count":23,"open_issues_count":0,"forks_count":4,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-29T19:11:12.259Z","etag":null,"topics":["deployment","flask","flyio","langchain","llms","python"],"latest_commit_sha":null,"homepage":"https://fly.io/blog/deploying-langchain-to-fly-io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fly-apps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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}},"created_at":"2023-04-26T09:45:34.000Z","updated_at":"2024-12-03T19:37:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"c9b23bec-4800-4e63-93d0-c7c3c62c7085","html_url":"https://github.com/fly-apps/hello-fly-langchain","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fly-apps%2Fhello-fly-langchain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fly-apps%2Fhello-fly-langchain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fly-apps%2Fhello-fly-langchain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fly-apps%2Fhello-fly-langchain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fly-apps","download_url":"https://codeload.github.com/fly-apps/hello-fly-langchain/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250330421,"owners_count":21412979,"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","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":["deployment","flask","flyio","langchain","llms","python"],"created_at":"2024-11-17T00:22:27.089Z","updated_at":"2025-04-22T21:44:12.922Z","avatar_url":"https://github.com/fly-apps.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LangChain Running on Fly.io\n\n![Illustration by Annie Ruygt](https://fly.io/blog/2023-05-08/deploying-langchain-to-fly-io-cover.webp)\nDeploying a minimal Flask + [LangChain](https://github.com/hwchase17/langchain) application on Fly.io.\n\n\u003e You can find the complete guide in this [Blog Post](https://fly.io/blog/deploying-langchain-to-fly-io/).\n\n## App: Best places to eat\n\nThe application will give 3 options where to eat in `\u003cplace\u003e`. The default value is `Berlin`.\n\n**Prompt: `What are the 3 best places to eat in {place}?`**\n\nYou can define your own input variable (`place`) by calling:\n```\nhttps://\u003cyour-app-name\u003e.fly.dev/\u003cplace\u003e\n```\n\nExamples:\n\n#### Country\n- Norway: `https://\u003cyour-app-name\u003e.fly.dev/norway`\n\n#### City\n- Prague: `https://\u003cyour-app-name\u003e.fly.dev/prague`\n\n## Local Development ⚒️\n\n### Create and Activate a Virtual Environment\n\nWe'll be using [venv](https://flask.palletsprojects.com/en/2.3.x/installation/#create-an-environment), but you can choose any virtual environment to manage the dependencies (e.g. virtualenv).\n```shell\n# Unix/macOS\n$ python3 -m venv venv\n$ . venv/bin/activate\n\n# Windows\n$ py -3 -m venv venv\n$ venv\\Scripts\\activate\n```\n\n### Install Dependencies from `requirements.txt`\n\n```shell\npython -m pip install -r requirements.txt\n```\n\n### Set Up `.env` file\n\nThe environment variables are stored in the `.env` file.\n\nRename the `.env.dist` file to `.env`. Update the `OPENAI_API_KEY` environment variable with your own secret key:\n```dotenv\nFLASK_APP=hello\nOPENAI_API_KEY=\u003cyour-openai-api-secret-key\u003e\n```\n\nThe OpenAI API uses API keys for authentication. \nVisit your [OpenAI API Key](https://platform.openai.com/account/api-keys) page to retrieve the API key you'll use in your requests.\n\n### Run the project\n\n```shell\nflask run\n```\n\n## Deploying to Fly.io 🚀\n\n[flyctl](https://fly.io/docs/hands-on/install-flyctl/) is the command-line utility provided by Fly.io.\n\nIf not installed yet, follow these [instructions](https://fly.io/docs/hands-on/install-flyctl/), [sign up](https://fly.io/docs/hands-on/sign-up/) and [log in](https://fly.io/docs/hands-on/sign-in/) to Fly.io.\n\n### Launching Our App\n\n`fly launch` will detect our Python (Flask) App.\n\n```shell\nfly launch\n```\n\nDuring the launch you will:\n- Choose an app name\n- Select Organization\n- Choose a region for deployment\n\nThe `Procfile` already exists in this project - a new one will be generated for you if your project doesn't have one.\n\n\u003e More details on `fly launch` can be found [here](https://fly.io/docs/languages-and-frameworks/python/#configure-the-app-for-fly).\n\n### Set Environment Variables\n\nSet the `OPENAI_API_KEY` environment variable:\n```shell\nfly secrets set OPENAI_API_KEY=\u003cyour-openai-api-secret-key\u003e\n```\n\n### Deploy to Fly.io\n\n```shell\nfly deploy\n```\n\n\u003e More details on `fly deploy` can be found [here](https://fly.io/docs/languages-and-frameworks/python/#deploying-to-fly).\n\n### Visit Your App\n\n```shell\nfly open\n```\n\nFor detailed documentation on how to deploy a Flask application on [Fly.io](https://fly.io/), check [Run a Python App](https://fly.io/docs/languages-and-frameworks/python/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffly-apps%2Fhello-fly-langchain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffly-apps%2Fhello-fly-langchain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffly-apps%2Fhello-fly-langchain/lists"}