rusticai-api 0.0.1__tar.gz → 0.0.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.
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/PKG-INFO +5 -4
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/README.md +1 -1
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/pyproject.toml +13 -4
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/guilds/service.py +11 -2
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/main.py +12 -5
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/__init__.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/api_dependency_manager.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/catalog/__init__.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/catalog/catalog_store.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/catalog/models.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/catalog/router.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/guilds/__init__.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/guilds/comms_manager.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/guilds/router.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/guilds/schema.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/guilds/socket.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/guilds/system_comms_manager.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/logging/__init__.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/logging/config.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/logging/format.py +0 -0
- {rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/main_debug.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rusticai-api
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: API Server for Rustic AI
|
|
5
5
|
Home-page: https://www.rustic.ai/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -11,14 +11,15 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Provides-Extra: test
|
|
14
15
|
Requires-Dist: fastapi (>=0.115.8,<0.116.0)
|
|
15
16
|
Requires-Dist: griffe (>=1.7.2,<2.0.0)
|
|
16
17
|
Requires-Dist: opentelemetry-distro (>=0.52b1,<0.53)
|
|
17
18
|
Requires-Dist: psycopg (>=3.2.6,<4.0.0)
|
|
18
19
|
Requires-Dist: ptvsd (>=4.3.2,<5.0.0)
|
|
19
20
|
Requires-Dist: python-multipart (>=0.0.20,<0.0.21)
|
|
20
|
-
Requires-Dist: rusticai-core (>=0.0.
|
|
21
|
-
Requires-Dist: rusticai-ray (>=0.0.
|
|
21
|
+
Requires-Dist: rusticai-core (>=0.0.4,<0.1.0)
|
|
22
|
+
Requires-Dist: rusticai-ray (>=0.0.3,<0.1.0)
|
|
22
23
|
Requires-Dist: starlette (>=0.45.3,<0.46.0)
|
|
23
24
|
Requires-Dist: uvicorn (>=0.34.0,<0.35.0)
|
|
24
25
|
Requires-Dist: websockets (>=15.0.1,<16.0.0)
|
|
@@ -48,7 +49,7 @@ poetry shell
|
|
|
48
49
|
2. Start the server:
|
|
49
50
|
```shell
|
|
50
51
|
# If using an external SQL database, expose RUSTIC_METASTORE to the corresponding url
|
|
51
|
-
# For example, if
|
|
52
|
+
# For example, if using postgres, export RUSTIC_METASTORE=postgresql+psycopg://user:pwd@localhost:5432
|
|
52
53
|
./scripts/dev_server.sh
|
|
53
54
|
```
|
|
54
55
|
|
|
@@ -20,7 +20,7 @@ poetry shell
|
|
|
20
20
|
2. Start the server:
|
|
21
21
|
```shell
|
|
22
22
|
# If using an external SQL database, expose RUSTIC_METASTORE to the corresponding url
|
|
23
|
-
# For example, if
|
|
23
|
+
# For example, if using postgres, export RUSTIC_METASTORE=postgresql+psycopg://user:pwd@localhost:5432
|
|
24
24
|
./scripts/dev_server.sh
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "rusticai-api"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.3"
|
|
8
8
|
description = "API Server for Rustic AI"
|
|
9
9
|
authors = ["Dragonscale Industries Inc. <dev@dragonscale.ai>"]
|
|
10
10
|
license = "Apache-2.0"
|
|
@@ -18,8 +18,8 @@ packages = [{ include = "rustic_ai", from = "src" }]
|
|
|
18
18
|
|
|
19
19
|
[tool.poetry.dependencies]
|
|
20
20
|
python = "^3.12"
|
|
21
|
-
rusticai-core = { version = "0.0.
|
|
22
|
-
rusticai-ray = { version = "0.0.
|
|
21
|
+
rusticai-core = { version = "0.0.4"}
|
|
22
|
+
rusticai-ray = { version = "0.0.3"}
|
|
23
23
|
fastapi = "^0.115.8"
|
|
24
24
|
starlette = "^0.45.3"
|
|
25
25
|
uvicorn = "^0.34.0"
|
|
@@ -32,6 +32,10 @@ psycopg = "^3.2.6"
|
|
|
32
32
|
|
|
33
33
|
[tool.poetry-monorepo.deps]
|
|
34
34
|
|
|
35
|
+
|
|
36
|
+
[tool.poetry.group.dev]
|
|
37
|
+
optional = true
|
|
38
|
+
|
|
35
39
|
[tool.poetry.group.dev.dependencies]
|
|
36
40
|
pytest = "^8.3.4"
|
|
37
41
|
black = { version = "^24.2.0", extras = ["jupyter"] }
|
|
@@ -41,6 +45,10 @@ isort = "^6.0.0"
|
|
|
41
45
|
mypy = "^1.15.0"
|
|
42
46
|
pytest-asyncio = "^0.25.3"
|
|
43
47
|
httpx = "^0.28.1"
|
|
48
|
+
rusticai-testing = { version = "0.0.0"}
|
|
49
|
+
|
|
50
|
+
[tool.poetry.extras]
|
|
51
|
+
test = ["pytest", "pytest-asyncio", "httpx", "rusticai-testing"]
|
|
44
52
|
|
|
45
53
|
[tool.black]
|
|
46
54
|
line-length = 120
|
|
@@ -70,7 +78,8 @@ explicit_package_bases = true
|
|
|
70
78
|
[tool.isort]
|
|
71
79
|
profile = "black"
|
|
72
80
|
known_third_party = ["pydantic"]
|
|
73
|
-
known_first_party = ["rustic_ai.core", "rustic_ai.ray"
|
|
81
|
+
known_first_party = ["rustic_ai.core", "rustic_ai.ray"]
|
|
82
|
+
known_local_folder = ["rustic_ai.testing"]
|
|
74
83
|
|
|
75
84
|
|
|
76
85
|
[tool.pytest.ini_options]
|
|
@@ -3,7 +3,7 @@ from typing import Optional
|
|
|
3
3
|
from sqlalchemy import Engine
|
|
4
4
|
|
|
5
5
|
from rustic_ai.core.guild import GuildSpec
|
|
6
|
-
from rustic_ai.core.guild.builders import GuildBuilder
|
|
6
|
+
from rustic_ai.core.guild.builders import GuildBuilder, GuildHelper
|
|
7
7
|
from rustic_ai.core.guild.metastore import GuildStore
|
|
8
8
|
|
|
9
9
|
|
|
@@ -13,6 +13,15 @@ class GuildService:
|
|
|
13
13
|
"""
|
|
14
14
|
Creates a new guild and adds it to the database.
|
|
15
15
|
"""
|
|
16
|
+
if guild_spec.get_messaging() is None:
|
|
17
|
+
default_messaging = GuildHelper.get_default_messaging_config()
|
|
18
|
+
guild_spec.set_messaging(**default_messaging)
|
|
19
|
+
|
|
20
|
+
if guild_spec.get_execution_engine() is None:
|
|
21
|
+
guild_spec.set_execution_engine(GuildHelper.get_default_execution_engine())
|
|
22
|
+
|
|
23
|
+
guild_spec.dependency_map = GuildHelper.get_guild_dependency_map(guild_spec)
|
|
24
|
+
|
|
16
25
|
guild = GuildBuilder.from_spec(guild_spec).bootstrap(metastore_url)
|
|
17
26
|
|
|
18
27
|
return guild.id
|
|
@@ -27,4 +36,4 @@ class GuildService:
|
|
|
27
36
|
|
|
28
37
|
guild_spec = guild_model.to_guild_spec() if guild_model else None
|
|
29
38
|
|
|
30
|
-
return guild_spec
|
|
39
|
+
return guild_spec
|
|
@@ -26,15 +26,22 @@ logging.basicConfig(
|
|
|
26
26
|
handlers=[ch],
|
|
27
27
|
)
|
|
28
28
|
|
|
29
|
-
INITIALIZE_RAY_CLUSTER = os.environ.get("RUSTIC_INIT_RAY_CLUSTER", "False")
|
|
30
|
-
|
|
31
|
-
ray.init(include_dashboard=True)
|
|
29
|
+
INITIALIZE_RAY_CLUSTER = os.environ.get("RUSTIC_INIT_RAY_CLUSTER", "False").lower() == "true"
|
|
30
|
+
LAUNCH_RAY_DASHBOARD = os.environ.get("RUSTIC_LAUNCH_RAY_DASHBOARD", "False").lower() == "true"
|
|
32
31
|
|
|
32
|
+
if INITIALIZE_RAY_CLUSTER:
|
|
33
|
+
|
|
34
|
+
logging.info("Initializing Ray cluster")
|
|
35
|
+
ray.init(
|
|
36
|
+
include_dashboard=LAUNCH_RAY_DASHBOARD,
|
|
37
|
+
log_to_driver=False,
|
|
38
|
+
)
|
|
39
|
+
logging.info("Ray cluster initialized")
|
|
40
|
+
logging.info("Ray cluster details: {}".format(ray.get_runtime_context()))
|
|
33
41
|
|
|
34
42
|
if not Metastore.is_initialized():
|
|
35
43
|
rustic_metastore = os.environ.get("RUSTIC_METASTORE", "sqlite:///rustic_app.db")
|
|
36
44
|
Metastore.initialize_engine(rustic_metastore)
|
|
37
|
-
|
|
38
45
|
app = FastAPI(title="Rustic AI API", lifespan=lifespan)
|
|
39
46
|
app.include_router(guilds.router, prefix="/api")
|
|
40
47
|
app.include_router(guilds.socket, prefix="/ws")
|
|
@@ -61,7 +68,7 @@ def health_check():
|
|
|
61
68
|
async def global_exception_handler(request: Request, exc: StarletteHTTPException):
|
|
62
69
|
"""
|
|
63
70
|
Global exception handler function that handles any exception raised in the FastAPI application.
|
|
64
|
-
|
|
71
|
+
The recommended approach is to register an exception handler for Starlette's HTTPException and
|
|
65
72
|
reuse the default exception handlers from fastapi.exception_handlers.
|
|
66
73
|
References:
|
|
67
74
|
https://fastapi.tiangolo.com/tutorial/handling-errors/#fastapis-httpexception-vs-starlettes-httpexception
|
|
File without changes
|
{rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/api_dependency_manager.py
RENAMED
|
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
|
{rusticai_api-0.0.1 → rusticai_api-0.0.3}/src/rustic_ai/api_server/guilds/system_comms_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|