mirror of
https://github.com/lightbroker/llmsecops-research.git
synced 2026-02-12 22:52:51 +00:00
API: add POST method w/ service; test action
This commit is contained in:
1
.github/workflows/llmsecops-cicd.llm.yml
vendored
1
.github/workflows/llmsecops-cicd.llm.yml
vendored
@@ -60,7 +60,6 @@ jobs:
|
||||
|
||||
- name: 'Run test API request'
|
||||
run: ${{ github.workspace }}/.github/scripts/test_api.sh
|
||||
if: false
|
||||
|
||||
- name: 'Start system monitoring'
|
||||
run: ${{ github.workspace }}/.github/scripts/start_monitoring.sh &
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
"""
|
||||
Usage:
|
||||
$ uvicorn src.api.http_api:app --host 0.0.0.0 --port 9999
|
||||
"""
|
||||
|
||||
from fastapi import FastAPI
|
||||
from pathlib import Path
|
||||
from pydantic import BaseModel
|
||||
from src.llm.llm import Phi3LanguageModel
|
||||
|
||||
|
||||
STATIC_PATH = Path(__file__).parent.absolute() / 'static'
|
||||
|
||||
@@ -19,3 +26,10 @@ class LanguageModelResponse(BaseModel):
|
||||
@app.get('/', response_model=str)
|
||||
async def health_check():
|
||||
return 'success'
|
||||
|
||||
|
||||
@app.post('/api/conversations', response_model=LanguageModelResponse)
|
||||
async def get_llm_conversation_response(request: LanguageModelPrompt):
|
||||
service = Phi3LanguageModel()
|
||||
response = service.invoke(user_input=request.prompt)
|
||||
return LanguageModelResponse(response=response)
|
||||
|
||||
Reference in New Issue
Block a user