Skip to content

Commit

Permalink
reorder folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
geovalexis committed Jun 14, 2024
1 parent 07d6bc6 commit a48078d
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 85 deletions.
File renamed without changes.
6 changes: 2 additions & 4 deletions .github/workflows/main_laia-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:

env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: 'src' # set this to the path to your web app project, defaults to the repository root
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
PYTHON_VERSION: '3.11' # set this to the python version to use (supports 3.6, 3.7, 3.8)

jobs:
Expand All @@ -37,9 +37,7 @@ jobs:
# Optional: Add step to run tests here

- name: Zip artifact for deployment
run: |
cp requirements.txt src/
zip release.zip ./data/* ./index/* ./prompts/* ./src/* -r
run: zip release.zip ./* -r -x .git/\* -x .github/\* -x venv/\*

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"azureFunctions.deploySubpath": "src",
"azureFunctions.deploySubpath": "",
"azureFunctions.scmDoBuildDuringDeployment": true,
"azureFunctions.projectLanguage": "Python",
"azureFunctions.projectRuntime": "~4",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"problemMatcher": "$func-python-watch",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/src"
"cwd": "${workspaceFolder}"
}
}
]
Expand Down
29 changes: 29 additions & 0 deletions function_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import logging

import azure.functions as func
from llama_index.core.llms import ChatMessage

from laia.llamaindex import generate_response

logger = logging.getLogger(__name__)


app = func.FunctionApp()


@app.function_name(name="generate")
@app.route(route="generate", auth_level=func.AuthLevel.ANONYMOUS)
def test_function(req: func.HttpRequest) -> func.HttpResponse:
logger.info(f"Python HTTP trigger function processed a request: {req}")
req_body = req.get_json()
logger.info(f"Request body: {req_body}")
try:
messages = [
ChatMessage(role=item["role"], content=item["content"])
for item in req_body["messages"]
]
response = generate_response(messages)
return func.HttpResponse(str(response), status_code=200)
except Exception as e:
logger.error(e)
return func.HttpResponse("Internal Server Error", status_code=500)
File renamed without changes.
Empty file added laia/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
79 changes: 0 additions & 79 deletions src/function_app.py

This file was deleted.

0 comments on commit a48078d

Please sign in to comment.