{"id":20175038,"url":"https://github.com/xukecheng/langchain_poe_api_with_search","last_synced_at":"2026-03-19T14:22:13.075Z","repository":{"id":189868999,"uuid":"681465021","full_name":"xukecheng/langchain_poe_api_with_search","owner":"xukecheng","description":null,"archived":false,"fork":false,"pushed_at":"2023-08-22T09:22:31.000Z","size":111,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T16:19:44.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Bicep","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/xukecheng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-22T04:38:51.000Z","updated_at":"2023-08-24T02:50:21.000Z","dependencies_parsed_at":"2023-08-22T05:44:02.680Z","dependency_job_id":null,"html_url":"https://github.com/xukecheng/langchain_poe_api_with_search","commit_stats":null,"previous_names":["xukecheng/langchain_poe_api_with_search"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xukecheng%2Flangchain_poe_api_with_search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xukecheng%2Flangchain_poe_api_with_search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xukecheng%2Flangchain_poe_api_with_search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xukecheng%2Flangchain_poe_api_with_search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xukecheng","download_url":"https://codeload.github.com/xukecheng/langchain_poe_api_with_search/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241610996,"owners_count":19990507,"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":[],"created_at":"2024-11-14T01:44:38.605Z","updated_at":"2026-03-04T22:31:36.730Z","avatar_url":"https://github.com/xukecheng.png","language":"Bicep","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\npage_type: sample\nlanguages:\n- python\nproducts:\n- azure\n- azure-functions\ndescription: \"This is a sample Azure Function app created with the FastAPI framework.\"\ntitle: Using FastAPI Framework with Azure Functions\nauthor: shreyabatra4, vrdmr\nurlFragment: azure-functions-python-create-fastapi-app\n---\n\n# Using FastAPI Framework with Azure Functions\n\nAzure Functions supports WSGI and ASGI-compatible frameworks with HTTP-triggered Python functions. This can be helpful if you are familiar with a particular framework, or if you have existing code you would like to reuse to create the Function app. The following is an example of creating an Azure Function app using FastAPI.\n\n## Prerequisites\n\nYou can develop and deploy a function app using either Visual Studio Code or the Azure CLI. Make sure you have the required prerequisites for your preferred environment:\n\n* [Prerequisites for VS Code](https://docs.microsoft.com/azure/azure-functions/create-first-function-vs-code-python#configure-your-environment)\n* [Prerequisites for Azure CLI](https://docs.microsoft.com/azure/azure-functions/create-first-function-cli-python#configure-your-local-environment)\n\n## Setup\n\nClone or download [this sample's repository](https://github.com/Azure-Samples/fastapi-on-azure-functions/), and open the `fastapi-on-azure-functions` folder in Visual Studio Code or your preferred editor (if you're using the Azure CLI).\n\n## Using FastAPI Framework in an Azure Function App\n\nThe code in the sample folder has already been updated to support use of the FastAPI. Let's walk through the changed files.\n\nThe `requirements.txt` file has an additional dependency of the `fastapi` module:\n\n```\nazure-functions\nfastapi\n```\n\n\nThe file host.json includes the a `routePrefix` key with a value of empty string.\n\n```json\n{\n  \"version\": \"2.0\",\n  \"extensions\": {\n    \"http\": {\n        \"routePrefix\": \"\"\n    }\n  }\n}\n```\n\n\nThe root folder contains `function_app.py` which initializes an `AsgiFunctionApp` using the imported `FastAPI` app:\n\n```python\nimport azure.functions as func\n\nfrom WrapperFunction import app as fastapi_app\n\napp = func.AsgiFunctionApp(app=fastapi_app, http_auth_level=func.AuthLevel.ANONYMOUS)\n```\n\nIn the `WrapperFunction` folder, the `__init__.py` file defines a FastAPI app in the typical way (no changes needed):\n\n```python\nimport azure.functions as func\n\nimport fastapi\n\napp = fastapi.FastAPI()\n\n@app.get(\"/sample\")\nasync def index():\n    return {\n        \"info\": \"Try /hello/Shivani for parameterized route.\",\n    }\n\n\n@app.get(\"/hello/{name}\")\nasync def get_name(name: str):\n    return {\n        \"name\": name,\n    }\n```\n\n## Running the sample\n\n### Testing locally\n\n1. Create a [Python virtual environment](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments) and activate it.\n\n2. Run the command below to install the necessary requirements.\n\n    ```log\n    python3 -m pip install -r requirements.txt\n    ```\n\n3. If you are using VS Code for development, click the \"Run and Debug\" button or follow [the instructions for running a function locally](https://docs.microsoft.com/azure/azure-functions/create-first-function-vs-code-python#run-the-function-locally). Outside of VS Code, follow [these instructions for using Core Tools commands directly to run the function locally](https://docs.microsoft.com/azure/azure-functions/functions-run-local?tabs=v4%2Cwindows%2Cpython%2Cportal%2Cbash#start).\n\n4. Once the function is running, test the function at the local URL displayed in the Terminal panel:\n=======\n```log\nFunctions:\n        http_app_func: [GET,POST,DELETE,HEAD,PATCH,PUT,OPTIONS] http://localhost:7071//{*route}\n```\n\n    ```log\n    Functions:\n            WrapperFunction: [GET,POST] http://localhost:7071/{*route}\n    ```\n\n    Try out URLs corresponding to the handlers in the app, both the simple path and the parameterized path:\n\n    ```\n    http://localhost:7071/sample\n    http://localhost:7071/hello/YourName\n    ```\n\n### Deploying to Azure\n\nThere are three main ways to deploy this to Azure:\n\n* [Deploy with the VS Code Azure Functions extension](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-python#publish-the-project-to-azure). \n* [Deploy with the Azure CLI](https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-python?tabs=azure-cli%2Cbash%2Cbrowser#create-supporting-azure-resources-for-your-function).\n* Deploy with the Azure Developer CLI: After [installing the `azd` tool](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd?tabs=localinstall%2Cwindows%2Cbrew), run `azd up` in the root of the project. You can also run `azd pipeline config` to set up a CI/CD pipeline for deployment.\n\nAll approaches will provision a Function App, Storage account (to store the code), and a Log Analytics workspace.\n\n![Azure resources created by the deployment: Function App, Storage Account, Log Analytics workspace](./readme_diagram.png)\n\n### Testing in Azure\n\nOnce deployed, test different paths on the deployed URL, using either a browser or a tool like Postman.\n\n```\nhttp://\u003cFunctionAppName\u003e.azurewebsites.net/sample\nhttp://\u003cFunctionAppName\u003e.azurewebsites.net/hello/Foo\n```\n\n## Next Steps\n\nNow you have a simple Azure Function App using the FastAPI framework, and you can continue building on it to develop more sophisticated applications.\n\nTo learn more about leveraging WSGI and ASGI-compatible frameworks, see [Web frameworks](https://docs.microsoft.com/azure/azure-functions/functions-reference-python?tabs=asgi%2Cazurecli-linux%2Capplication-level#web-frameworks).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxukecheng%2Flangchain_poe_api_with_search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxukecheng%2Flangchain_poe_api_with_search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxukecheng%2Flangchain_poe_api_with_search/lists"}