File size: 1,260 Bytes
9344f01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""Cross-platform task runner. Run via `invoke <task>` after `pip install invoke`.

Replaces the role of a Makefile so Windows/Mac/Linux users get the same UX.
"""
from __future__ import annotations

from invoke import task


@task
def install(c):
    """Editable install with dev + llm extras."""
    c.run('pip install -e ".[dev,llm]"')


@task
def lint(c):
    c.run("ruff check src/ tests/")


@task
def fmt(c):
    c.run("ruff format src/ tests/")


@task
def test(c):
    c.run("pytest tests/ -v")


@task(help={"q": "Question to send through the pipeline"})
def smoke(c, q="매장 CCTV 안내문구 어떻게 써요?"):
    """Run a single end-to-end smoke through the RAG pipeline."""
    c.run(f'python -m kpaa smoke "{q}"')


@task
def evalq(c):
    """Run golden-question evaluation."""
    c.run("python -m kpaa eval")


@task
def serve(c):
    """Start the FastAPI backend on :8000."""
    c.run("python -m kpaa serve")


@task
def up(c):
    c.run("docker compose up -d")


@task
def down(c):
    c.run("docker compose down")


@task(help={"since": "YYYY-MM-DD; only fetch cases registered after this date"})
def refresh_cases(c, since=""):
    cmd = "python -m kpaa refresh-cases"
    if since:
        cmd += f" --since {since}"
    c.run(cmd)