-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07d6bc6
commit a48078d
Showing
10 changed files
with
33 additions
and
85 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.