Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[run]
source = server

[report]
omit =
*/__init__.py
server/test/*
server/utilities/constants/*

exclude_lines =
^\s*(import|from)\b.* #match import statements
39 changes: 39 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test and Coverage

on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r server/requirements.txt

- name: Run tests with coverage
run: |
python -m pytest --cov=server server/test
env:
OPENAI_API_KEY: "DUMMY KEY"
ANTHROPIC_API_KEY: "DUMMY KEY"
GOOGLE_AI_API_KEY: "DUMMY KEY"
DEEPSEEK_API_KEY: "DUMMY KEY"
DASHSCOPE_API_KEY: "DUMMY KEY"
ALL_GOOGLE_API_KEYS: "DUMMY KEY"

- name: Upload coverage to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
coveralls
44 changes: 0 additions & 44 deletions server/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
from fastapi import FastAPI, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from services.client_factory import ClientFactory
from utilities.batch_job import (create_batch_input_file,
download_batch_job_output_file,
upload_and_run_batch_job)
from utilities.config import PATH_CONFIG
from utilities.constants.LLM_enums import LLMType, ModelType
from utilities.constants.prompts_enums import PromptType
Expand Down Expand Up @@ -81,35 +78,6 @@ async def test_cost_estimations():
raise HTTPException(status_code=500, detail=str(e))


@app.post("/process_batch_job")
async def process_batch_job(request: BatchJobRequest):
try:
messages = []

create_msg = create_batch_input_file(
prompt_type_with_shots = {
request.prompt_type: request.shots,
PromptType.DAIL_SQL: 5
},
model=request.model,
temperature=request.temperature,
max_tokens=request.max_tokens,
database_name=request.database_name
)
if create_msg.get('success'):
messages.append(create_msg['success'])

input_file_id, batch_job_id = upload_and_run_batch_job(request.database_name)

download_msg = download_batch_job_output_file(batch_job_id, request.database_name)
if download_msg.get('success'):
messages.append(download_msg['success'])

return {'success': messages}

except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

@app.post("/queries/generate-and-execute/")
async def generate_and_execute_sql_query(body: QueryGenerationRequest):
question = body.question
Expand Down Expand Up @@ -224,18 +192,6 @@ def mask_single_question_and_query(request: MaskRequest):
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

@app.post("/masking/file/")
def mask_question_and_answer_file_by_filename(request: MaskFileRequest):
try:
table_and_column_names = get_array_of_table_and_column_name(PATH_CONFIG.sqlite_path())
masked_file_name = mask_question_and_answer_files(database_name=request.database_name, table_and_column_names=table_and_column_names)

return {
"masked_file_name": masked_file_name
}

except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

@app.post("/prompts/generate/")
async def generate_prompt(request: PromptGenerationRequest):
Expand Down
5 changes: 4 additions & 1 deletion server/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ tiktoken==0.8.0
tqdm==4.67.0
uvicorn==0.34.0
onnxruntime==1.16.3
pre-commit==3.7.0
pre-commit==3.7.0
pytest==8.3.5
pytest-cov==6.1.1
coveralls==4.0.1
78 changes: 0 additions & 78 deletions server/scripts/download_batch_output.py

This file was deleted.

132 changes: 0 additions & 132 deletions server/scripts/generate_batch_file.py

This file was deleted.

Loading