Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kimtth/azure-functions-sse-chainlit
⛲Server-Sent Events implementation in Azure Functions (backend) and Chainlit (UI).
https://github.com/kimtth/azure-functions-sse-chainlit
Last synced: 1 day ago
JSON representation
⛲Server-Sent Events implementation in Azure Functions (backend) and Chainlit (UI).
- Host: GitHub
- URL: https://github.com/kimtth/azure-functions-sse-chainlit
- Owner: kimtth
- Created: 2024-06-12T10:03:25.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-12T10:09:40.000Z (7 months ago)
- Last Synced: 2024-06-12T15:54:05.517Z (7 months ago)
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Azure Functions with SSE
- This sample application demonstrates how to implement SSE (Server-Sent Events) in Azure Functions.
- The UI code has been created using Chainlit.
- The backend is developed using the Azure Function App Python SDK.
- The SDK and implementation use Azure Function Programming model v2.## Endpoint: HTTP Trigger
- azure: `https://.azurewebsites.net/api/`
- local: `http://localhost:/api/`
- [GET] http://localhost:7071/api/stream-openai## Code and test Azure Functions locally
- [Code and test Azure Functions locally](https://learn.microsoft.com/en-us/azure/azure-functions/functions-develop-local)
- [Develop Azure Functions locally using Core Tools](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local)- Install the Azure Functions Core Tools & Visual Code : Azure Extension
- Rename `local.settings.template.json` to `local.settings.json` - Fill your values in `local.settings.json`
- The command must be run in a virtual environment.
- Functions: `func start`
- UI application: `chainlit run ui_app.py -w`
- [Optional] Change venv path > .vscode > settings.json > "azureFunctions.pythonVenv": "venv"## Publish your local code to a function app in Azure
- cmd: `func azure functionapp publish `
## SSE(Server-Sent Events)
- [Azure Functions: Support for HTTP Streams in Python is now in Preview!](https://techcommunity.microsoft.com/t5/azure-compute-blog/azure-functions-support-for-http-streams-in-python-is-now-in/ba-p/4146697)
- When deploying, add the following application settings: "PYTHON_ENABLE_INIT_INDEXING": "1". If you are deploying to Linux Consumption, also add "PYTHON_ISOLATE_WORKER_DEPENDENCIES": "1". When running locally, you also need to add these same settings to the local.settings.json project file.