asp-chef-cli 0.5.1__tar.gz → 0.5.3__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.
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/PKG-INFO +2 -2
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/asp_chef_cli/server/routers/dumbo.py +33 -33
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/pyproject.toml +2 -2
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/LICENSE +0 -0
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/README.md +0 -0
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/asp_chef_cli/__init__.py +0 -0
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/asp_chef_cli/__main__.py +0 -0
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/asp_chef_cli/cli.py +0 -0
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/asp_chef_cli/server/__init__.py +0 -0
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/asp_chef_cli/server/dependencies.py +0 -0
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/asp_chef_cli/server/main.py +0 -0
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/asp_chef_cli/server/routers/__init__.py +0 -0
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/asp_chef_cli/server/routers/clingo.py +0 -0
- {asp_chef_cli-0.5.1 → asp_chef_cli-0.5.3}/asp_chef_cli/server/routers/opa.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: asp-chef-cli
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
4
4
|
Summary: A simple CLI to run ASP Chef recipes
|
|
5
5
|
Author: Mario Alviano
|
|
6
6
|
Author-email: mario.alviano@gmail.com
|
|
7
7
|
Requires-Python: >=3.13,<4.0
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
-
Requires-Dist: dumbo-asp (>=0.4.
|
|
10
|
+
Requires-Dist: dumbo-asp (>=0.4.2,<0.5.0)
|
|
11
11
|
Requires-Dist: fastapi (>=0.129.0,<0.130.0)
|
|
12
12
|
Requires-Dist: httpx (>=0.28.1,<0.29.0)
|
|
13
13
|
Requires-Dist: opa-python (>=0.0.9,<0.0.10)
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import httpx
|
|
2
1
|
import json as json_module
|
|
3
2
|
import os
|
|
4
3
|
import shutil
|
|
5
4
|
import subprocess
|
|
6
5
|
from collections import defaultdict
|
|
6
|
+
from typing import Optional, Dict, Final
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
7
9
|
from dumbo_asp.primitives.models import Model
|
|
8
10
|
from dumbo_asp.primitives.rules import SymbolicRule
|
|
9
11
|
from dumbo_asp.primitives.templates import Template
|
|
10
12
|
from dumbo_asp.queries import explanation_graph, pack_xasp_navigator_url
|
|
11
|
-
from fastapi import APIRouter,
|
|
12
|
-
from
|
|
13
|
+
from fastapi import APIRouter, Response
|
|
14
|
+
from fastapi.responses import StreamingResponse
|
|
13
15
|
|
|
14
16
|
from ..dependencies import *
|
|
15
17
|
|
|
@@ -274,33 +276,31 @@ OLLAMA_URL = os.getenv("ASP_CHEF_CLI__OLLAMA_URL", "http://127.0.0.1:11434")
|
|
|
274
276
|
|
|
275
277
|
@router.api_route("/ollama/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"])
|
|
276
278
|
async def ollama_proxy(path: str, request: Request):
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
headers=dict(rp_resp.headers)
|
|
306
|
-
)
|
|
279
|
+
url = f"{OLLAMA_URL}/{path.lstrip('/')}"
|
|
280
|
+
method = request.method
|
|
281
|
+
params = request.query_params
|
|
282
|
+
|
|
283
|
+
body = await request.body()
|
|
284
|
+
headers = dict(request.headers)
|
|
285
|
+
headers.pop("host", None)
|
|
286
|
+
headers.pop("content-length", None) # Let httpx recalculate it
|
|
287
|
+
|
|
288
|
+
async def generate_stream():
|
|
289
|
+
async with httpx.AsyncClient(timeout=None) as client:
|
|
290
|
+
async with client.stream(
|
|
291
|
+
method=method,
|
|
292
|
+
url=url,
|
|
293
|
+
params=params,
|
|
294
|
+
headers=headers,
|
|
295
|
+
content=body,
|
|
296
|
+
) as rp_resp:
|
|
297
|
+
async for chunk in rp_resp.aiter_bytes():
|
|
298
|
+
yield chunk
|
|
299
|
+
|
|
300
|
+
try:
|
|
301
|
+
return StreamingResponse(
|
|
302
|
+
generate_stream(),
|
|
303
|
+
media_type="application/octet-stream"
|
|
304
|
+
)
|
|
305
|
+
except httpx.ConnectError:
|
|
306
|
+
return Response(content="Ollama not running", status_code=503)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "asp-chef-cli"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.3"
|
|
4
4
|
description = "A simple CLI to run ASP Chef recipes"
|
|
5
5
|
authors = ["Mario Alviano <mario.alviano@gmail.com>"]
|
|
6
6
|
readme = "README.md"
|
|
@@ -8,7 +8,7 @@ readme = "README.md"
|
|
|
8
8
|
[tool.poetry.dependencies]
|
|
9
9
|
python = ">=3.13,<4.0"
|
|
10
10
|
pytest-playwright = "^0.7.2"
|
|
11
|
-
dumbo-asp = "^0.4.
|
|
11
|
+
dumbo-asp = "^0.4.2"
|
|
12
12
|
uvicorn = "^0.40.0"
|
|
13
13
|
fastapi = "^0.129.0"
|
|
14
14
|
opa-python = "^0.0.9"
|
|
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
|
|
File without changes
|