stackgen-sdk 0.1.7__tar.gz → 0.1.8__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.
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/PKG-INFO +1 -1
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/_version.py +2 -2
- stackgen_sdk-0.1.8/src/stackgen/aiden/models.py +225 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/aiden/namespace.py +2 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/config.py +4 -1
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/.gitignore +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/README.md +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/pyproject.toml +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/__init__.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/_http.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/aiden/__init__.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/aiden/ask.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/aiden/run_status.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/aiden/runs.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/aiden/sessions.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/aiden/webhook.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/aiden/webhook_ops.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/aiden/workflow_builder.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/aiden/workflow_publish.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/cli.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/client.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/errors.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/.openapi-generator/FILES +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/.openapi-generator/VERSION +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/.openapi-generator-ignore +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/__init__.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/api/__init__.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/api/aiden_api.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/api/sre_api.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/api_client.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/api_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/configuration.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/exceptions.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/__init__.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/agent_status.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_analysis_status.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_attention.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_categorization_summary.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_role.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_sort_by.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_status.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_summary.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_sync_run_status.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_v1.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/artifact_info.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/ask_guild_request.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/ask_guild_start_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/candidate_type.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/dag_edge.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/dag_node.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/entity_ref.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/error_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/execution_list_item.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/execution_meta.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/execution_structured_output.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigate_alert_request.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigate_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_evidence.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_evidence_kind.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_evidence_source.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_hypothesis.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_plain_summary.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_prior_incident.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_recommended_next_step.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_ref.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_status.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_structured_hypothesis_entry.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_structured_limitation_entry.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_structured_rca.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_triage_metadata.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/json_error.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/list_alerts_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/list_investigations_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/pagination.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/prior_session_policy.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/qualified_candidate.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/register_agent_request.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/register_agent_request_auto_approve_tools_inner.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/register_agent_request_hitl.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/schedule_run_status.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/schedule_target_type.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session_export.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session_export_part.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session_export_part_kind.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session_list_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session_responder_kind.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session_summary.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/signal_severity.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/stage_binding_write.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/sync_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/terminate_session_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/trace_dag_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/trigger_webhook202_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/webhook_run.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/webhook_run_detail.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/webhook_run_list_response.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/workflow.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/workflow_stage_write.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/workflow_write.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/rest.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/sre/__init__.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/sre/namespace.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/vault/__init__.py +0 -0
- {stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/vault/namespace.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: stackgen-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: StackGen SDK — Aiden, SRE, and Vault from one client
|
|
5
5
|
Project-URL: Homepage, https://appcd-dev.github.io/stackgen-sdk/
|
|
6
6
|
Project-URL: Documentation, https://appcd-dev.github.io/stackgen-sdk/
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.1.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 1,
|
|
21
|
+
__version__ = version = '0.1.8'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 1, 8)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"""Aiden model registry — providers and registered models.
|
|
2
|
+
|
|
3
|
+
Hand-written facade over Guild ``/guild/api/v1/model-providers`` and
|
|
4
|
+
``/guild/api/v1/models`` (see stackgen-guild ``api-docs/openapi.yml``).
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import urllib.parse
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from stackgen import _http
|
|
14
|
+
from stackgen.config import StackgenConfig
|
|
15
|
+
from stackgen.errors import HttpError
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ModelRegistry:
|
|
19
|
+
"""CRUD helpers for OpenAI-compatible (and other) model providers/models."""
|
|
20
|
+
|
|
21
|
+
def __init__(self, config: StackgenConfig) -> None:
|
|
22
|
+
self._config = config
|
|
23
|
+
|
|
24
|
+
def _org(self) -> str:
|
|
25
|
+
org = (self._config.org_id or "").strip()
|
|
26
|
+
if not org:
|
|
27
|
+
raise ValueError("org_id is required for model registry calls")
|
|
28
|
+
return org
|
|
29
|
+
|
|
30
|
+
def _url(self, path: str) -> str:
|
|
31
|
+
return f"{self._config.aiden_url()}/api/v1{path}{_http.query(self._org())}"
|
|
32
|
+
|
|
33
|
+
def _json(
|
|
34
|
+
self,
|
|
35
|
+
method: str,
|
|
36
|
+
path: str,
|
|
37
|
+
body: dict[str, Any] | None = None,
|
|
38
|
+
) -> Any:
|
|
39
|
+
payload = None
|
|
40
|
+
content_type = None
|
|
41
|
+
if body is not None:
|
|
42
|
+
payload = json.dumps(body).encode("utf-8")
|
|
43
|
+
content_type = "application/json"
|
|
44
|
+
return _http.request(
|
|
45
|
+
self._url(path),
|
|
46
|
+
self._config.api_token,
|
|
47
|
+
method=method,
|
|
48
|
+
body=payload,
|
|
49
|
+
content_type=content_type,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def list_providers(self) -> list[dict[str, Any]]:
|
|
53
|
+
"""GET /guild/api/v1/model-providers."""
|
|
54
|
+
return _http.as_list(self._json("GET", "/model-providers"))
|
|
55
|
+
|
|
56
|
+
def get_provider(self, name: str) -> dict[str, Any]:
|
|
57
|
+
"""GET /guild/api/v1/model-providers/{name}."""
|
|
58
|
+
enc = urllib.parse.quote(name, safe="")
|
|
59
|
+
out = self._json("GET", f"/model-providers/{enc}")
|
|
60
|
+
if not isinstance(out, dict):
|
|
61
|
+
raise HttpError(f"unexpected provider payload for {name!r}")
|
|
62
|
+
return out
|
|
63
|
+
|
|
64
|
+
def create_provider(
|
|
65
|
+
self,
|
|
66
|
+
*,
|
|
67
|
+
name: str,
|
|
68
|
+
provider_type: str = "openai",
|
|
69
|
+
host: str = "",
|
|
70
|
+
token_reference: str = "",
|
|
71
|
+
) -> dict[str, Any]:
|
|
72
|
+
"""POST /guild/api/v1/model-providers."""
|
|
73
|
+
body: dict[str, Any] = {"name": name, "provider_type": provider_type}
|
|
74
|
+
if host:
|
|
75
|
+
body["host"] = host.rstrip("/")
|
|
76
|
+
if token_reference:
|
|
77
|
+
body["token_reference"] = token_reference
|
|
78
|
+
out = self._json("POST", "/model-providers", body)
|
|
79
|
+
if not isinstance(out, dict):
|
|
80
|
+
raise HttpError(f"unexpected create provider payload for {name!r}")
|
|
81
|
+
return out
|
|
82
|
+
|
|
83
|
+
def update_provider(
|
|
84
|
+
self,
|
|
85
|
+
name: str,
|
|
86
|
+
*,
|
|
87
|
+
host: str | None = None,
|
|
88
|
+
token_reference: str | None = None,
|
|
89
|
+
provider_type: str | None = None,
|
|
90
|
+
) -> dict[str, Any]:
|
|
91
|
+
"""PUT /guild/api/v1/model-providers/{name}."""
|
|
92
|
+
body: dict[str, Any] = {}
|
|
93
|
+
if host is not None:
|
|
94
|
+
body["host"] = host.rstrip("/")
|
|
95
|
+
if token_reference is not None:
|
|
96
|
+
body["token_reference"] = token_reference
|
|
97
|
+
if provider_type is not None:
|
|
98
|
+
body["provider_type"] = provider_type
|
|
99
|
+
enc = urllib.parse.quote(name, safe="")
|
|
100
|
+
out = self._json("PUT", f"/model-providers/{enc}", body)
|
|
101
|
+
if not isinstance(out, dict):
|
|
102
|
+
raise HttpError(f"unexpected update provider payload for {name!r}")
|
|
103
|
+
return out
|
|
104
|
+
|
|
105
|
+
def ensure_provider(
|
|
106
|
+
self,
|
|
107
|
+
*,
|
|
108
|
+
name: str,
|
|
109
|
+
host: str,
|
|
110
|
+
provider_type: str = "openai",
|
|
111
|
+
token_reference: str = "",
|
|
112
|
+
) -> dict[str, Any]:
|
|
113
|
+
"""Create provider if missing, then set host (and optional token_reference)."""
|
|
114
|
+
try:
|
|
115
|
+
self.create_provider(
|
|
116
|
+
name=name,
|
|
117
|
+
provider_type=provider_type,
|
|
118
|
+
host=host,
|
|
119
|
+
token_reference=token_reference,
|
|
120
|
+
)
|
|
121
|
+
except HttpError as err:
|
|
122
|
+
if err.status_code != 409:
|
|
123
|
+
raise
|
|
124
|
+
return self.update_provider(
|
|
125
|
+
name,
|
|
126
|
+
host=host,
|
|
127
|
+
token_reference=token_reference or None,
|
|
128
|
+
provider_type=provider_type,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
def list_models(self, *, provider_name: str = "") -> list[dict[str, Any]]:
|
|
132
|
+
"""GET /guild/api/v1/models."""
|
|
133
|
+
base = f"{self._config.aiden_url()}/api/v1/models"
|
|
134
|
+
params: dict[str, str] = {"orgId": self._org()}
|
|
135
|
+
if provider_name:
|
|
136
|
+
params["provider_name"] = provider_name
|
|
137
|
+
q = urllib.parse.urlencode(params)
|
|
138
|
+
return _http.as_list(
|
|
139
|
+
_http.request(
|
|
140
|
+
f"{base}?{q}",
|
|
141
|
+
self._config.api_token,
|
|
142
|
+
method="GET",
|
|
143
|
+
)
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
def get_model(self, name: str) -> dict[str, Any]:
|
|
147
|
+
"""GET /guild/api/v1/models/{name}."""
|
|
148
|
+
enc = urllib.parse.quote(name, safe="")
|
|
149
|
+
out = self._json("GET", f"/models/{enc}")
|
|
150
|
+
if not isinstance(out, dict):
|
|
151
|
+
raise HttpError(f"unexpected model payload for {name!r}")
|
|
152
|
+
return out
|
|
153
|
+
|
|
154
|
+
def create_model(
|
|
155
|
+
self,
|
|
156
|
+
*,
|
|
157
|
+
name: str,
|
|
158
|
+
provider_name: str,
|
|
159
|
+
model_id: str,
|
|
160
|
+
thinking: bool = False,
|
|
161
|
+
) -> dict[str, Any]:
|
|
162
|
+
"""POST /guild/api/v1/models (live-probes the provider host)."""
|
|
163
|
+
body: dict[str, Any] = {
|
|
164
|
+
"name": name,
|
|
165
|
+
"provider_name": provider_name,
|
|
166
|
+
"model_id": model_id,
|
|
167
|
+
"thinking": thinking,
|
|
168
|
+
}
|
|
169
|
+
out = self._json("POST", "/models", body)
|
|
170
|
+
if not isinstance(out, dict):
|
|
171
|
+
raise HttpError(f"unexpected create model payload for {name!r}")
|
|
172
|
+
return out
|
|
173
|
+
|
|
174
|
+
def ensure_model(
|
|
175
|
+
self,
|
|
176
|
+
*,
|
|
177
|
+
name: str,
|
|
178
|
+
provider_name: str,
|
|
179
|
+
model_id: str,
|
|
180
|
+
thinking: bool = False,
|
|
181
|
+
) -> dict[str, Any]:
|
|
182
|
+
"""Return existing model or create it (requires reachable provider host)."""
|
|
183
|
+
try:
|
|
184
|
+
return self.get_model(name)
|
|
185
|
+
except HttpError as err:
|
|
186
|
+
if err.status_code != 404:
|
|
187
|
+
raise
|
|
188
|
+
try:
|
|
189
|
+
return self.create_model(
|
|
190
|
+
name=name,
|
|
191
|
+
provider_name=provider_name,
|
|
192
|
+
model_id=model_id,
|
|
193
|
+
thinking=thinking,
|
|
194
|
+
)
|
|
195
|
+
except HttpError as err:
|
|
196
|
+
if err.status_code == 409:
|
|
197
|
+
return self.get_model(name)
|
|
198
|
+
raise
|
|
199
|
+
|
|
200
|
+
def ensure_openai_peft_model(
|
|
201
|
+
self,
|
|
202
|
+
*,
|
|
203
|
+
serve_url: str,
|
|
204
|
+
model_name: str = "sre-slm-qwen3-32b",
|
|
205
|
+
provider_name: str = "sre-slm-peft",
|
|
206
|
+
model_id: str = "sre-slm-qwen3-32b",
|
|
207
|
+
token_reference: str = "",
|
|
208
|
+
) -> dict[str, Any]:
|
|
209
|
+
"""Ensure OpenAI-compatible provider + model pointed at a PEFT serve URL.
|
|
210
|
+
|
|
211
|
+
``serve_url`` should look like ``http://<ip>:8000/v1``. Create model
|
|
212
|
+
live-probes the host, so PEFT serve must already be up.
|
|
213
|
+
"""
|
|
214
|
+
provider = self.ensure_provider(
|
|
215
|
+
name=provider_name,
|
|
216
|
+
host=serve_url,
|
|
217
|
+
provider_type="openai",
|
|
218
|
+
token_reference=token_reference,
|
|
219
|
+
)
|
|
220
|
+
model = self.ensure_model(
|
|
221
|
+
name=model_name,
|
|
222
|
+
provider_name=provider_name,
|
|
223
|
+
model_id=model_id,
|
|
224
|
+
)
|
|
225
|
+
return {"provider": provider, "model": model}
|
|
@@ -6,6 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
from typing import Any
|
|
7
7
|
|
|
8
8
|
from stackgen.aiden.ask import AskArtifactJourney, AskArtifactResult
|
|
9
|
+
from stackgen.aiden.models import ModelRegistry
|
|
9
10
|
from stackgen.aiden.run_status import RunStatus, build_run_status, require_run_ids
|
|
10
11
|
from stackgen.aiden.webhook import WebhookReportJourney, WebhookReportResult
|
|
11
12
|
from stackgen.aiden.webhook_ops import WebhookOps
|
|
@@ -24,6 +25,7 @@ class AidenNamespace:
|
|
|
24
25
|
self._ask = AskArtifactJourney(config)
|
|
25
26
|
self._workflows = WorkflowPublishJourney(config)
|
|
26
27
|
self._webhook_ops = WebhookOps(config)
|
|
28
|
+
self.models = ModelRegistry(config)
|
|
27
29
|
|
|
28
30
|
def run_webhook_and_download_report(
|
|
29
31
|
self,
|
|
@@ -58,7 +58,10 @@ class StackgenConfig:
|
|
|
58
58
|
"""
|
|
59
59
|
base = os.environ.get("STACKGEN_URL", "").strip()
|
|
60
60
|
token = os.environ.get("STACKGEN_TOKEN", "").strip()
|
|
61
|
-
project =
|
|
61
|
+
project = (
|
|
62
|
+
os.environ.get("STACKGEN_PROJECT", "").strip()
|
|
63
|
+
or os.environ.get("STACKGEN_ORG_ID", "").strip()
|
|
64
|
+
)
|
|
62
65
|
if not base:
|
|
63
66
|
raise ValueError("STACKGEN_URL is required")
|
|
64
67
|
if not token:
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_analysis_status.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/alert_sync_run_status.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/ask_guild_request.py
RENAMED
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/ask_guild_start_response.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/execution_list_item.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigate_alert_request.py
RENAMED
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigate_response.py
RENAMED
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_evidence.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_hypothesis.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_ref.py
RENAMED
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/investigation_status.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/list_alerts_response.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/prior_session_policy.py
RENAMED
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/qualified_candidate.py
RENAMED
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/register_agent_request.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/schedule_run_status.py
RENAMED
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/schedule_target_type.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session_export_part.py
RENAMED
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session_export_part_kind.py
RENAMED
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session_list_response.py
RENAMED
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/session_responder_kind.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/stage_binding_write.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/trace_dag_response.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/webhook_run_detail.py
RENAMED
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/webhook_run_list_response.py
RENAMED
|
File without changes
|
|
File without changes
|
{stackgen_sdk-0.1.7 → stackgen_sdk-0.1.8}/src/stackgen/generated/models/workflow_stage_write.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|