ailtir-cli 1.0.4__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ailtir_cli-1.0.4/src/ailtir_cli.egg-info → ailtir_cli-2.0.0}/PKG-INFO +1 -1
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/pyproject.toml +1 -1
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/src/ailtir_cli/app.py +5 -0
- ailtir_cli-2.0.0/src/ailtir_cli/commands/__init__.py +3 -0
- ailtir_cli-2.0.0/src/ailtir_cli/commands/agents/__init__.py +5 -0
- ailtir_cli-2.0.0/src/ailtir_cli/commands/agents/research.py +36 -0
- ailtir_cli-2.0.0/src/ailtir_cli/commands/kbs/__init__.py +8 -0
- {ailtir_cli-1.0.4/src/ailtir_cli/commands → ailtir_cli-2.0.0/src/ailtir_cli/commands/kbs}/analyse.py +4 -4
- {ailtir_cli-1.0.4/src/ailtir_cli/commands → ailtir_cli-2.0.0/src/ailtir_cli/commands/kbs}/chat.py +3 -3
- {ailtir_cli-1.0.4/src/ailtir_cli/commands → ailtir_cli-2.0.0/src/ailtir_cli/commands/kbs}/list_kbs.py +3 -3
- {ailtir_cli-1.0.4/src/ailtir_cli/commands → ailtir_cli-2.0.0/src/ailtir_cli/commands/kbs}/upload.py +3 -3
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/src/ailtir_cli/config.py +1 -1
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0/src/ailtir_cli.egg-info}/PKG-INFO +1 -1
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/src/ailtir_cli.egg-info/SOURCES.txt +8 -5
- ailtir_cli-1.0.4/src/ailtir_cli/commands/__init__.py +0 -5
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/LICENSE +0 -0
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/README.md +0 -0
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/setup.cfg +0 -0
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/src/ailtir_cli/__init__.py +0 -0
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/src/ailtir_cli/commands/version.py +0 -0
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/src/ailtir_cli/main.py +0 -0
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/src/ailtir_cli.egg-info/dependency_links.txt +0 -0
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/src/ailtir_cli.egg-info/entry_points.txt +0 -0
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/src/ailtir_cli.egg-info/requires.txt +0 -0
- {ailtir_cli-1.0.4 → ailtir_cli-2.0.0}/src/ailtir_cli.egg-info/top_level.txt +0 -0
|
@@ -3,10 +3,15 @@ import sys
|
|
|
3
3
|
import typer
|
|
4
4
|
from rich.console import Console
|
|
5
5
|
|
|
6
|
+
from ailtir_cli.commands.agents import agents_app
|
|
7
|
+
from ailtir_cli.commands.kbs import kbs_app
|
|
8
|
+
|
|
6
9
|
_console = Console(stderr=True)
|
|
7
10
|
_DOCS_URL = "https://team-ailtir.github.io/ailtir-cli/"
|
|
8
11
|
|
|
9
12
|
app = typer.Typer(name="ailtir", help="The Ailtir CLI", no_args_is_help=True)
|
|
13
|
+
app.add_typer(kbs_app, name="kbs")
|
|
14
|
+
app.add_typer(agents_app, name="agents")
|
|
10
15
|
|
|
11
16
|
|
|
12
17
|
@app.callback()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import httpx
|
|
2
|
+
import structlog
|
|
3
|
+
import typer
|
|
4
|
+
from rich.console import Console
|
|
5
|
+
|
|
6
|
+
from ailtir_cli.commands.agents import agents_app
|
|
7
|
+
from ailtir_cli.config import settings
|
|
8
|
+
|
|
9
|
+
_log = structlog.get_logger(__name__)
|
|
10
|
+
_console = Console()
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@agents_app.command()
|
|
14
|
+
def research(
|
|
15
|
+
topic: str = typer.Argument(..., help="The topic to research."),
|
|
16
|
+
) -> None:
|
|
17
|
+
"""Run the research agent on a given topic."""
|
|
18
|
+
_console.print(f"Researching: [bold]{topic}[/bold]...")
|
|
19
|
+
|
|
20
|
+
token = settings.ailtir_cli_secret
|
|
21
|
+
|
|
22
|
+
with httpx.Client(base_url=settings.cli_api_url, timeout=120.0) as http:
|
|
23
|
+
try:
|
|
24
|
+
resp = http.post(
|
|
25
|
+
"/agents/research",
|
|
26
|
+
json={"topic": topic},
|
|
27
|
+
headers={"Authorization": f"Bearer {token}"},
|
|
28
|
+
)
|
|
29
|
+
resp.raise_for_status()
|
|
30
|
+
except httpx.HTTPStatusError as exc:
|
|
31
|
+
_console.print(f"[red]Error: {exc.response.status_code}[/red]")
|
|
32
|
+
raise typer.Exit(1) from exc
|
|
33
|
+
|
|
34
|
+
data = resp.json()
|
|
35
|
+
_log.info("agents.research.complete", topic=topic)
|
|
36
|
+
_console.print(data.get("result", "No result returned."))
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
kbs_app = typer.Typer(name="kbs", help="Manage knowledge bases.", no_args_is_help=True)
|
|
4
|
+
|
|
5
|
+
import ailtir_cli.commands.kbs.analyse # noqa: F401, E402
|
|
6
|
+
import ailtir_cli.commands.kbs.chat # noqa: F401, E402
|
|
7
|
+
import ailtir_cli.commands.kbs.list_kbs # noqa: F401, E402
|
|
8
|
+
import ailtir_cli.commands.kbs.upload # noqa: F401, E402
|
{ailtir_cli-1.0.4/src/ailtir_cli/commands → ailtir_cli-2.0.0/src/ailtir_cli/commands/kbs}/analyse.py
RENAMED
|
@@ -3,14 +3,14 @@ import structlog
|
|
|
3
3
|
import typer
|
|
4
4
|
from rich.console import Console
|
|
5
5
|
|
|
6
|
-
from ailtir_cli.
|
|
6
|
+
from ailtir_cli.commands.kbs import kbs_app
|
|
7
7
|
from ailtir_cli.config import settings
|
|
8
8
|
|
|
9
9
|
_log = structlog.get_logger(__name__)
|
|
10
10
|
_console = Console()
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@
|
|
13
|
+
@kbs_app.command()
|
|
14
14
|
def analyse(kb_id: str = typer.Argument(..., help="The knowledge base ID to analyse.")) -> None:
|
|
15
15
|
"""Trigger analysis and Knowledge Base creation for an uploaded ZIP."""
|
|
16
16
|
_console.print(f"Starting analysis for kb_id: [bold]{kb_id}[/bold]...")
|
|
@@ -20,7 +20,7 @@ def analyse(kb_id: str = typer.Argument(..., help="The knowledge base ID to anal
|
|
|
20
20
|
with httpx.Client(base_url=settings.cli_api_url, timeout=30.0) as http:
|
|
21
21
|
try:
|
|
22
22
|
resp = http.post(
|
|
23
|
-
f"/
|
|
23
|
+
f"/kbs/{kb_id}/analyse",
|
|
24
24
|
headers={"Authorization": f"Bearer {token}"},
|
|
25
25
|
)
|
|
26
26
|
resp.raise_for_status()
|
|
@@ -31,5 +31,5 @@ def analyse(kb_id: str = typer.Argument(..., help="The knowledge base ID to anal
|
|
|
31
31
|
_log.info("analyse.started", kb_id=kb_id)
|
|
32
32
|
_console.print(
|
|
33
33
|
f"[green]Analysis started[/green] for kb_id: [bold]{kb_id}[/bold]. "
|
|
34
|
-
"This typically takes a few minutes. Use [bold]ailtir list[/bold] to check status."
|
|
34
|
+
"This typically takes a few minutes. Use [bold]ailtir kbs list[/bold] to check status."
|
|
35
35
|
)
|
{ailtir_cli-1.0.4/src/ailtir_cli/commands → ailtir_cli-2.0.0/src/ailtir_cli/commands/kbs}/chat.py
RENAMED
|
@@ -3,14 +3,14 @@ import structlog
|
|
|
3
3
|
import typer
|
|
4
4
|
from rich.console import Console
|
|
5
5
|
|
|
6
|
-
from ailtir_cli.
|
|
6
|
+
from ailtir_cli.commands.kbs import kbs_app
|
|
7
7
|
from ailtir_cli.config import settings
|
|
8
8
|
|
|
9
9
|
_log = structlog.get_logger(__name__)
|
|
10
10
|
_console = Console()
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@
|
|
13
|
+
@kbs_app.command()
|
|
14
14
|
def chat(
|
|
15
15
|
kb_id: str = typer.Argument(..., help="The knowledge base ID to query."),
|
|
16
16
|
question: str = typer.Argument(..., help="Your natural-language question."),
|
|
@@ -23,7 +23,7 @@ def chat(
|
|
|
23
23
|
with httpx.Client(base_url=settings.cli_api_url, timeout=60.0) as http:
|
|
24
24
|
try:
|
|
25
25
|
resp = http.post(
|
|
26
|
-
f"/
|
|
26
|
+
f"/kbs/{kb_id}/chat",
|
|
27
27
|
json={"question": question},
|
|
28
28
|
headers={"Authorization": f"Bearer {token}"},
|
|
29
29
|
)
|
|
@@ -7,7 +7,7 @@ import typer
|
|
|
7
7
|
from rich.console import Console
|
|
8
8
|
from rich.table import Table
|
|
9
9
|
|
|
10
|
-
from ailtir_cli.
|
|
10
|
+
from ailtir_cli.commands.kbs import kbs_app
|
|
11
11
|
from ailtir_cli.config import settings
|
|
12
12
|
|
|
13
13
|
_log = structlog.get_logger(__name__)
|
|
@@ -21,7 +21,7 @@ class OutputFormat(StrEnum):
|
|
|
21
21
|
json = "json"
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
@
|
|
24
|
+
@kbs_app.command(name="list")
|
|
25
25
|
def list_kbs(
|
|
26
26
|
output: OutputFormat = _OUTPUT_OPTION,
|
|
27
27
|
) -> None:
|
|
@@ -30,7 +30,7 @@ def list_kbs(
|
|
|
30
30
|
|
|
31
31
|
with httpx.Client(base_url=settings.cli_api_url, timeout=30.0) as http:
|
|
32
32
|
try:
|
|
33
|
-
resp = http.get("/
|
|
33
|
+
resp = http.get("/kbs", headers={"Authorization": f"Bearer {token}"})
|
|
34
34
|
resp.raise_for_status()
|
|
35
35
|
except httpx.HTTPStatusError as exc:
|
|
36
36
|
_console.print(f"[red]Error: {exc.response.status_code}[/red]")
|
{ailtir_cli-1.0.4/src/ailtir_cli/commands → ailtir_cli-2.0.0/src/ailtir_cli/commands/kbs}/upload.py
RENAMED
|
@@ -5,14 +5,14 @@ import structlog
|
|
|
5
5
|
import typer
|
|
6
6
|
from rich.console import Console
|
|
7
7
|
|
|
8
|
-
from ailtir_cli.
|
|
8
|
+
from ailtir_cli.commands.kbs import kbs_app
|
|
9
9
|
from ailtir_cli.config import settings
|
|
10
10
|
|
|
11
11
|
_log = structlog.get_logger(__name__)
|
|
12
12
|
_console = Console()
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
@
|
|
15
|
+
@kbs_app.command()
|
|
16
16
|
def upload(
|
|
17
17
|
file_path: str = typer.Argument(..., help="Absolute path to the ZIP file to upload."),
|
|
18
18
|
) -> None:
|
|
@@ -36,7 +36,7 @@ def upload(
|
|
|
36
36
|
with httpx.Client(base_url=settings.cli_api_url, timeout=30.0) as http:
|
|
37
37
|
try:
|
|
38
38
|
reg_resp = http.post(
|
|
39
|
-
"/
|
|
39
|
+
"/kbs",
|
|
40
40
|
json={"file_name": path.name},
|
|
41
41
|
headers={"Authorization": f"Bearer {token}"},
|
|
42
42
|
)
|
|
@@ -4,7 +4,7 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
4
4
|
|
|
5
5
|
class Settings(BaseSettings):
|
|
6
6
|
ailtir_cli_secret: str = Field(default="")
|
|
7
|
-
cli_api_url: str = Field(default="https://app.ailtir.ai/cli
|
|
7
|
+
cli_api_url: str = Field(default="https://app.ailtir.ai/api-cli")
|
|
8
8
|
log_format: str = Field(default="console")
|
|
9
9
|
log_level: str = Field(default="INFO")
|
|
10
10
|
|
|
@@ -12,8 +12,11 @@ src/ailtir_cli.egg-info/entry_points.txt
|
|
|
12
12
|
src/ailtir_cli.egg-info/requires.txt
|
|
13
13
|
src/ailtir_cli.egg-info/top_level.txt
|
|
14
14
|
src/ailtir_cli/commands/__init__.py
|
|
15
|
-
src/ailtir_cli/commands/
|
|
16
|
-
src/ailtir_cli/commands/
|
|
17
|
-
src/ailtir_cli/commands/
|
|
18
|
-
src/ailtir_cli/commands/
|
|
19
|
-
src/ailtir_cli/commands/
|
|
15
|
+
src/ailtir_cli/commands/version.py
|
|
16
|
+
src/ailtir_cli/commands/agents/__init__.py
|
|
17
|
+
src/ailtir_cli/commands/agents/research.py
|
|
18
|
+
src/ailtir_cli/commands/kbs/__init__.py
|
|
19
|
+
src/ailtir_cli/commands/kbs/analyse.py
|
|
20
|
+
src/ailtir_cli/commands/kbs/chat.py
|
|
21
|
+
src/ailtir_cli/commands/kbs/list_kbs.py
|
|
22
|
+
src/ailtir_cli/commands/kbs/upload.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|