codemie-sdk-python 0.1.52__py3-none-any.whl → 0.1.258__py3-none-any.whl
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.
Potentially problematic release.
This version of codemie-sdk-python might be problematic. Click here for more details.
- codemie_sdk/__init__.py +114 -2
- codemie_sdk/auth/credentials.py +5 -4
- codemie_sdk/client/client.py +66 -5
- codemie_sdk/models/__init__.py +0 -0
- codemie_sdk/models/assistant.py +137 -12
- codemie_sdk/models/conversation.py +169 -0
- codemie_sdk/models/datasource.py +81 -1
- codemie_sdk/models/file_operation.py +25 -0
- codemie_sdk/models/integration.py +23 -2
- codemie_sdk/models/vendor_assistant.py +187 -0
- codemie_sdk/models/vendor_guardrail.py +152 -0
- codemie_sdk/models/vendor_knowledgebase.py +151 -0
- codemie_sdk/models/vendor_workflow.py +145 -0
- codemie_sdk/models/workflow.py +4 -4
- codemie_sdk/models/workflow_execution_payload.py +21 -0
- codemie_sdk/models/workflow_state.py +6 -3
- codemie_sdk/models/workflow_thoughts.py +26 -0
- codemie_sdk/services/assistant.py +261 -3
- codemie_sdk/services/conversation.py +90 -0
- codemie_sdk/services/datasource.py +81 -6
- codemie_sdk/services/files.py +82 -0
- codemie_sdk/services/integration.py +21 -1
- codemie_sdk/services/vendor_assistant.py +364 -0
- codemie_sdk/services/vendor_guardrail.py +375 -0
- codemie_sdk/services/vendor_knowledgebase.py +270 -0
- codemie_sdk/services/vendor_workflow.py +330 -0
- codemie_sdk/services/webhook.py +41 -0
- codemie_sdk/services/workflow.py +26 -2
- codemie_sdk/services/workflow_execution.py +54 -6
- codemie_sdk/utils/http.py +43 -35
- codemie_sdk_python-0.1.258.dist-info/METADATA +1404 -0
- codemie_sdk_python-0.1.258.dist-info/RECORD +45 -0
- codemie_sdk_python-0.1.52.dist-info/METADATA +0 -809
- codemie_sdk_python-0.1.52.dist-info/RECORD +0 -29
- {codemie_sdk_python-0.1.52.dist-info → codemie_sdk_python-0.1.258.dist-info}/WHEEL +0 -0
codemie_sdk/models/datasource.py
CHANGED
|
@@ -24,6 +24,9 @@ class DataSourceType(str, Enum):
|
|
|
24
24
|
SUMMARY = "summary"
|
|
25
25
|
CHUNK_SUMMARY = "chunk-summary"
|
|
26
26
|
JSON = "knowledge_base_json"
|
|
27
|
+
BEDROCK = "knowledge_base_bedrock"
|
|
28
|
+
PLATFORM = "platform_marketplace_assistant"
|
|
29
|
+
AZURE_DEVOPS_WIKI = "knowledge_base_azure_devops_wiki"
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
class DataSourceStatus(str, Enum):
|
|
@@ -45,6 +48,15 @@ class DataSourceProcessingInfo(BaseModel):
|
|
|
45
48
|
processed_documents_count: Optional[int] = Field(None, alias="documents_count_key")
|
|
46
49
|
|
|
47
50
|
|
|
51
|
+
class ElasticsearchStatsResponse(BaseModel):
|
|
52
|
+
"""Response model for Elasticsearch index statistics."""
|
|
53
|
+
|
|
54
|
+
model_config = ConfigDict(extra="ignore")
|
|
55
|
+
|
|
56
|
+
index_name: str = Field(..., description="Name of the index in Elasticsearch")
|
|
57
|
+
size_in_bytes: int = Field(..., ge=0, description="Size of the index in bytes")
|
|
58
|
+
|
|
59
|
+
|
|
48
60
|
# Base request models
|
|
49
61
|
class Confluence(BaseModel):
|
|
50
62
|
"""Model for Confluence-specific response fields"""
|
|
@@ -88,6 +100,17 @@ class File(BaseModel):
|
|
|
88
100
|
model_config = ConfigDict(extra="ignore")
|
|
89
101
|
|
|
90
102
|
|
|
103
|
+
class AzureDevOpsWiki(BaseModel):
|
|
104
|
+
"""Model for Azure DevOps Wiki-specific response fields"""
|
|
105
|
+
|
|
106
|
+
wiki_query: Optional[str] = None
|
|
107
|
+
organization: Optional[str] = None
|
|
108
|
+
project: Optional[str] = None
|
|
109
|
+
wiki_name: Optional[str] = None
|
|
110
|
+
|
|
111
|
+
model_config = ConfigDict(extra="ignore")
|
|
112
|
+
|
|
113
|
+
|
|
91
114
|
class Code(BaseModel):
|
|
92
115
|
"""Model for code repository datasource creation"""
|
|
93
116
|
|
|
@@ -107,7 +130,7 @@ class BaseDataSourceRequest(BaseModel):
|
|
|
107
130
|
name: str = Field(
|
|
108
131
|
...,
|
|
109
132
|
description="Name must contain only lowercase letters and underscores.",
|
|
110
|
-
max_length=
|
|
133
|
+
max_length=50,
|
|
111
134
|
)
|
|
112
135
|
project_name: str
|
|
113
136
|
description: str = Field(..., max_length=100)
|
|
@@ -188,6 +211,17 @@ class FileDataSourceRequest(BaseDataSourceRequest):
|
|
|
188
211
|
super().__init__(type=DataSourceType.FILE, **data)
|
|
189
212
|
|
|
190
213
|
|
|
214
|
+
class AzureDevOpsWikiDataSourceRequest(BaseDataSourceRequest, AzureDevOpsWiki):
|
|
215
|
+
"""Model for Azure DevOps Wiki datasource creation requests"""
|
|
216
|
+
|
|
217
|
+
def __init__(self, **data):
|
|
218
|
+
super().__init__(type=DataSourceType.AZURE_DEVOPS_WIKI, **data)
|
|
219
|
+
|
|
220
|
+
@classmethod
|
|
221
|
+
def required_fields(cls) -> List[str]:
|
|
222
|
+
return ["wiki_query"]
|
|
223
|
+
|
|
224
|
+
|
|
191
225
|
class BaseUpdateDataSourceRequest(BaseDataSourceRequest):
|
|
192
226
|
"""Mixin update-specific reindex fields"""
|
|
193
227
|
|
|
@@ -258,6 +292,49 @@ class UpdateFileDataSourceRequest(BaseUpdateDataSourceRequest):
|
|
|
258
292
|
super().__init__(type=DataSourceType.FILE, **data)
|
|
259
293
|
|
|
260
294
|
|
|
295
|
+
class UpdateAzureDevOpsWikiDataSourceRequest(
|
|
296
|
+
BaseUpdateDataSourceRequest, AzureDevOpsWiki
|
|
297
|
+
):
|
|
298
|
+
"""Model for Azure DevOps Wiki datasource updates"""
|
|
299
|
+
|
|
300
|
+
def __init__(self, **data):
|
|
301
|
+
super().__init__(type=DataSourceType.AZURE_DEVOPS_WIKI, **data)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
class CodeAnalysisDataSourceRequest(BaseModel):
|
|
305
|
+
"""Model for provider-based datasource creation requests"""
|
|
306
|
+
|
|
307
|
+
model_config = ConfigDict(extra="ignore", populate_by_name=True)
|
|
308
|
+
|
|
309
|
+
name: str = Field(..., description="Datasource name")
|
|
310
|
+
description: Optional[str] = Field(None, description="Datasource description")
|
|
311
|
+
project_name: str = Field(..., description="Project name")
|
|
312
|
+
project_space_visible: bool = Field(False, alias="projectSpaceVisible")
|
|
313
|
+
branch: Optional[str] = Field(None, description="Git branch")
|
|
314
|
+
api_url: str = Field(..., description="Repository URL")
|
|
315
|
+
access_token: str = Field(..., description="Access token for repository")
|
|
316
|
+
analyzer: Optional[str] = Field(
|
|
317
|
+
None, description="Code analyzer type (e.g., Java, Python)"
|
|
318
|
+
)
|
|
319
|
+
datasource_root: str = Field("/", description="Root directory to analyze")
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
class CodeExplorationDataSourceRequest(BaseModel):
|
|
323
|
+
"""Model for CodeExplorationToolkit datasource creation requests"""
|
|
324
|
+
|
|
325
|
+
model_config = ConfigDict(extra="ignore", populate_by_name=True)
|
|
326
|
+
|
|
327
|
+
name: str = Field(..., description="Datasource name")
|
|
328
|
+
description: Optional[str] = Field(None, description="Datasource description")
|
|
329
|
+
project_name: str = Field(..., description="Project name")
|
|
330
|
+
project_space_visible: bool = Field(False, alias="projectSpaceVisible")
|
|
331
|
+
code_analysis_datasource_ids: List[str] = Field(
|
|
332
|
+
...,
|
|
333
|
+
alias="code_analysis_datasource_ids",
|
|
334
|
+
description="List of CodeAnalysisToolkit datasource IDs",
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
|
|
261
338
|
class DataSource(BaseModel):
|
|
262
339
|
model_config = ConfigDict(
|
|
263
340
|
extra="ignore",
|
|
@@ -292,6 +369,8 @@ class DataSource(BaseModel):
|
|
|
292
369
|
confluence: Optional[Confluence] = None
|
|
293
370
|
# Google doc specific fields
|
|
294
371
|
google_doc_link: Optional[str] = None
|
|
372
|
+
# Azure DevOps Wiki specific fields
|
|
373
|
+
azure_devops_wiki: Optional[AzureDevOpsWiki] = None
|
|
295
374
|
|
|
296
375
|
@model_validator(mode="before")
|
|
297
376
|
def before_init(cls, values):
|
|
@@ -308,6 +387,7 @@ class DataSource(BaseModel):
|
|
|
308
387
|
DataSourceType.CONFLUENCE,
|
|
309
388
|
DataSourceType.JIRA,
|
|
310
389
|
DataSourceType.GOOGLE,
|
|
390
|
+
DataSourceType.AZURE_DEVOPS_WIKI,
|
|
311
391
|
]:
|
|
312
392
|
complete_state = values.get("complete_state", 0)
|
|
313
393
|
if complete_state is not None:
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""File operation models."""
|
|
2
|
+
|
|
3
|
+
from typing import Optional, List, Any, Dict
|
|
4
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class FileResponse(BaseModel):
|
|
8
|
+
"""Individual file response model."""
|
|
9
|
+
|
|
10
|
+
model_config = ConfigDict(extra="ignore")
|
|
11
|
+
|
|
12
|
+
file_url: str = Field(..., description="URL or identifier for the uploaded file")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class FileBulkCreateResponse(BaseModel):
|
|
16
|
+
"""Response model for bulk file creation."""
|
|
17
|
+
|
|
18
|
+
model_config = ConfigDict(extra="ignore")
|
|
19
|
+
|
|
20
|
+
files: List[FileResponse] = Field(
|
|
21
|
+
..., description="List of successfully uploaded files with their URLs"
|
|
22
|
+
)
|
|
23
|
+
failed_files: Optional[List[Dict[str, Any]]] = Field(
|
|
24
|
+
None, description="List of files that failed to upload, null if no failures"
|
|
25
|
+
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"""Models for assistant-related data structures."""
|
|
2
2
|
|
|
3
|
+
from datetime import datetime
|
|
3
4
|
from enum import Enum
|
|
4
5
|
from typing import List, Optional, Any
|
|
5
|
-
from datetime import datetime
|
|
6
6
|
|
|
7
7
|
from pydantic import BaseModel, Field, ConfigDict, field_serializer
|
|
8
8
|
|
|
@@ -29,12 +29,14 @@ class CredentialTypes(str, Enum):
|
|
|
29
29
|
SONAR = "Sonar"
|
|
30
30
|
SQL = "SQL"
|
|
31
31
|
TELEGRAM = "Telegram"
|
|
32
|
-
|
|
32
|
+
ZEPHYR_SCALE = "ZephyrScale"
|
|
33
33
|
ZEPHYR_SQUAD = "ZephyrSquad"
|
|
34
34
|
SERVICE_NOW = "ServiceNow"
|
|
35
35
|
DIAL = "DIAL"
|
|
36
36
|
A2A = "A2A"
|
|
37
37
|
MCP = "MCP"
|
|
38
|
+
LITE_LLM = "LiteLLM"
|
|
39
|
+
REPORT_PORTAL = "ReportPortal"
|
|
38
40
|
|
|
39
41
|
|
|
40
42
|
class IntegrationType(str, Enum):
|
|
@@ -68,6 +70,7 @@ class Integration(BaseModel):
|
|
|
68
70
|
project_name: str
|
|
69
71
|
alias: Optional[str] = None
|
|
70
72
|
default: bool = False
|
|
73
|
+
is_global: bool = False
|
|
71
74
|
credential_type: CredentialTypes
|
|
72
75
|
credential_values: List[CredentialValues]
|
|
73
76
|
setting_type: IntegrationType = Field(default=IntegrationType.USER)
|
|
@@ -75,3 +78,21 @@ class Integration(BaseModel):
|
|
|
75
78
|
@field_serializer("date", "update_date")
|
|
76
79
|
def serialize_dt(self, dt: datetime, _info):
|
|
77
80
|
return dt.isoformat()
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class IntegrationTestRequest(BaseModel):
|
|
84
|
+
"""Model for integration test request."""
|
|
85
|
+
|
|
86
|
+
credential_type: str
|
|
87
|
+
credential_values: Optional[List[CredentialValues]] = None
|
|
88
|
+
setting_id: Optional[str] = None
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class IntegrationTestResponse(BaseModel):
|
|
92
|
+
"""Model for integration test response."""
|
|
93
|
+
|
|
94
|
+
def __getitem__(self, key):
|
|
95
|
+
return getattr(self, key)
|
|
96
|
+
|
|
97
|
+
message: str
|
|
98
|
+
success: bool
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"""Models for vendor assistant settings."""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from enum import Enum
|
|
5
|
+
from typing import Optional, List
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class VendorType(str, Enum):
|
|
11
|
+
"""Supported cloud vendor types."""
|
|
12
|
+
|
|
13
|
+
AWS = "aws"
|
|
14
|
+
AZURE = "azure"
|
|
15
|
+
GCP = "gcp"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class VendorAssistantStatus(str, Enum):
|
|
19
|
+
"""Status of vendor assistant."""
|
|
20
|
+
|
|
21
|
+
PREPARED = "PREPARED"
|
|
22
|
+
NOT_PREPARED = "NOT_PREPARED"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class VendorAssistantSetting(BaseModel):
|
|
26
|
+
"""Model representing a vendor assistant setting."""
|
|
27
|
+
|
|
28
|
+
model_config = ConfigDict(extra="ignore")
|
|
29
|
+
|
|
30
|
+
setting_id: str = Field(..., description="Unique identifier for the setting")
|
|
31
|
+
setting_name: str = Field(..., description="Name of the setting")
|
|
32
|
+
project: str = Field(..., description="Project associated with the setting")
|
|
33
|
+
entities: List[str] = Field(
|
|
34
|
+
default_factory=list, description="List of entities associated with the setting"
|
|
35
|
+
)
|
|
36
|
+
invalid: Optional[bool] = Field(None, description="Whether the setting is invalid")
|
|
37
|
+
error: Optional[str] = Field(
|
|
38
|
+
None, description="Error message if the setting is invalid"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class PaginationInfo(BaseModel):
|
|
43
|
+
"""Pagination information for list responses."""
|
|
44
|
+
|
|
45
|
+
model_config = ConfigDict(extra="ignore")
|
|
46
|
+
|
|
47
|
+
total: int = Field(..., description="Total number of items")
|
|
48
|
+
pages: int = Field(..., description="Total number of pages")
|
|
49
|
+
page: int = Field(..., description="Current page number (0-based)")
|
|
50
|
+
per_page: int = Field(..., description="Number of items per page")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class VendorAssistantSettingsResponse(BaseModel):
|
|
54
|
+
"""Response model for vendor assistant settings list."""
|
|
55
|
+
|
|
56
|
+
model_config = ConfigDict(extra="ignore")
|
|
57
|
+
|
|
58
|
+
data: List[VendorAssistantSetting] = Field(
|
|
59
|
+
..., description="List of vendor assistant settings"
|
|
60
|
+
)
|
|
61
|
+
pagination: PaginationInfo = Field(..., description="Pagination information")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class VendorAssistant(BaseModel):
|
|
65
|
+
"""Model representing a vendor assistant."""
|
|
66
|
+
|
|
67
|
+
model_config = ConfigDict(extra="ignore")
|
|
68
|
+
|
|
69
|
+
id: str = Field(..., description="Unique identifier for the assistant")
|
|
70
|
+
name: str = Field(..., description="Name of the assistant")
|
|
71
|
+
status: VendorAssistantStatus = Field(..., description="Status of the assistant")
|
|
72
|
+
description: Optional[str] = Field(None, description="Description of the assistant")
|
|
73
|
+
updatedAt: datetime = Field(
|
|
74
|
+
..., description="Last update timestamp", alias="updatedAt"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class VendorAssistantVersion(BaseModel):
|
|
79
|
+
"""Model representing a specific version of a vendor assistant with detailed information."""
|
|
80
|
+
|
|
81
|
+
model_config = ConfigDict(extra="ignore")
|
|
82
|
+
|
|
83
|
+
id: str = Field(..., description="Unique identifier for the assistant")
|
|
84
|
+
name: str = Field(..., description="Name of the assistant")
|
|
85
|
+
status: VendorAssistantStatus = Field(..., description="Status of the assistant")
|
|
86
|
+
version: str = Field(..., description="Version of the assistant")
|
|
87
|
+
instruction: str = Field(..., description="Instructions for the assistant")
|
|
88
|
+
foundationModel: str = Field(
|
|
89
|
+
...,
|
|
90
|
+
description="ARN or identifier of the foundation model",
|
|
91
|
+
alias="foundationModel",
|
|
92
|
+
)
|
|
93
|
+
description: Optional[str] = Field(None, description="Description of the assistant")
|
|
94
|
+
createdAt: datetime = Field(
|
|
95
|
+
..., description="Creation timestamp", alias="createdAt"
|
|
96
|
+
)
|
|
97
|
+
updatedAt: datetime = Field(
|
|
98
|
+
..., description="Last update timestamp", alias="updatedAt"
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class TokenPagination(BaseModel):
|
|
103
|
+
"""Token-based pagination information."""
|
|
104
|
+
|
|
105
|
+
model_config = ConfigDict(extra="ignore")
|
|
106
|
+
|
|
107
|
+
next_token: Optional[str] = Field(None, description="Token for the next page")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class VendorAssistantsResponse(BaseModel):
|
|
111
|
+
"""Response model for vendor assistants list."""
|
|
112
|
+
|
|
113
|
+
model_config = ConfigDict(extra="ignore")
|
|
114
|
+
|
|
115
|
+
data: List[VendorAssistant] = Field(..., description="List of vendor assistants")
|
|
116
|
+
pagination: TokenPagination = Field(
|
|
117
|
+
..., description="Token-based pagination information"
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class VendorAssistantAlias(BaseModel):
|
|
122
|
+
"""Model representing a vendor assistant alias."""
|
|
123
|
+
|
|
124
|
+
model_config = ConfigDict(extra="ignore")
|
|
125
|
+
|
|
126
|
+
id: str = Field(..., description="Unique identifier for the alias")
|
|
127
|
+
name: str = Field(..., description="Name of the alias")
|
|
128
|
+
status: VendorAssistantStatus = Field(..., description="Status of the alias")
|
|
129
|
+
description: Optional[str] = Field(None, description="Description of the alias")
|
|
130
|
+
version: str = Field(..., description="Version of the alias")
|
|
131
|
+
createdAt: datetime = Field(
|
|
132
|
+
..., description="Creation timestamp", alias="createdAt"
|
|
133
|
+
)
|
|
134
|
+
updatedAt: datetime = Field(
|
|
135
|
+
..., description="Last update timestamp", alias="updatedAt"
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class VendorAssistantAliasesResponse(BaseModel):
|
|
140
|
+
"""Response model for vendor assistant aliases list."""
|
|
141
|
+
|
|
142
|
+
model_config = ConfigDict(extra="ignore")
|
|
143
|
+
|
|
144
|
+
data: List[VendorAssistantAlias] = Field(
|
|
145
|
+
..., description="List of vendor assistant aliases"
|
|
146
|
+
)
|
|
147
|
+
pagination: TokenPagination = Field(
|
|
148
|
+
..., description="Token-based pagination information"
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class VendorAssistantInstallRequest(BaseModel):
|
|
153
|
+
"""Model for a single assistant installation request."""
|
|
154
|
+
|
|
155
|
+
model_config = ConfigDict(extra="ignore")
|
|
156
|
+
|
|
157
|
+
id: str = Field(..., description="Assistant ID to install")
|
|
158
|
+
agentAliasId: str = Field(..., description="Alias ID to use for the assistant")
|
|
159
|
+
setting_id: str = Field(..., description="Vendor setting ID")
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class VendorAssistantInstallSummary(BaseModel):
|
|
163
|
+
"""Model for assistant installation summary."""
|
|
164
|
+
|
|
165
|
+
model_config = ConfigDict(extra="ignore")
|
|
166
|
+
|
|
167
|
+
agentId: str = Field(..., description="Installed assistant ID")
|
|
168
|
+
agentAliasId: str = Field(..., description="Alias ID used for installation")
|
|
169
|
+
aiRunId: str = Field(..., description="AI run ID for the installation")
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class VendorAssistantInstallResponse(BaseModel):
|
|
173
|
+
"""Response model for assistant installation."""
|
|
174
|
+
|
|
175
|
+
model_config = ConfigDict(extra="ignore")
|
|
176
|
+
|
|
177
|
+
summary: List[VendorAssistantInstallSummary] = Field(
|
|
178
|
+
..., description="List of installation summaries"
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class VendorAssistantUninstallResponse(BaseModel):
|
|
183
|
+
"""Response model for assistant uninstallation."""
|
|
184
|
+
|
|
185
|
+
model_config = ConfigDict(extra="ignore")
|
|
186
|
+
|
|
187
|
+
success: bool = Field(..., description="Whether the uninstallation was successful")
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"""Models for vendor guardrail settings."""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from enum import Enum
|
|
5
|
+
from typing import Optional, List
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
8
|
+
|
|
9
|
+
from .vendor_assistant import PaginationInfo, TokenPagination
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class VendorGuardrailSetting(BaseModel):
|
|
13
|
+
"""Model representing a vendor guardrail setting."""
|
|
14
|
+
|
|
15
|
+
model_config = ConfigDict(extra="ignore")
|
|
16
|
+
|
|
17
|
+
setting_id: str = Field(..., description="Unique identifier for the setting")
|
|
18
|
+
setting_name: str = Field(..., description="Name of the setting")
|
|
19
|
+
project: str = Field(..., description="Project associated with the setting")
|
|
20
|
+
entities: List[str] = Field(
|
|
21
|
+
default_factory=list, description="List of entities associated with the setting"
|
|
22
|
+
)
|
|
23
|
+
invalid: Optional[bool] = Field(None, description="Whether the setting is invalid")
|
|
24
|
+
error: Optional[str] = Field(
|
|
25
|
+
None, description="Error message if the setting is invalid"
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class VendorGuardrailSettingsResponse(BaseModel):
|
|
30
|
+
"""Response model for vendor guardrail settings list."""
|
|
31
|
+
|
|
32
|
+
model_config = ConfigDict(extra="ignore")
|
|
33
|
+
|
|
34
|
+
data: List[VendorGuardrailSetting] = Field(
|
|
35
|
+
..., description="List of vendor guardrail settings"
|
|
36
|
+
)
|
|
37
|
+
pagination: PaginationInfo = Field(..., description="Pagination information")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class VendorGuardrailStatus(str, Enum):
|
|
41
|
+
"""Status of vendor guardrail."""
|
|
42
|
+
|
|
43
|
+
PREPARED = "PREPARED"
|
|
44
|
+
NOT_PREPARED = "NOT_PREPARED"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class VendorGuardrail(BaseModel):
|
|
48
|
+
"""Model representing a vendor guardrail."""
|
|
49
|
+
|
|
50
|
+
model_config = ConfigDict(extra="ignore")
|
|
51
|
+
|
|
52
|
+
id: str = Field(..., description="Unique identifier for the guardrail")
|
|
53
|
+
name: str = Field(..., description="Name of the guardrail")
|
|
54
|
+
status: VendorGuardrailStatus = Field(..., description="Status of the guardrail")
|
|
55
|
+
description: Optional[str] = Field(None, description="Description of the guardrail")
|
|
56
|
+
version: str = Field(..., description="Version of the guardrail")
|
|
57
|
+
createdAt: datetime = Field(
|
|
58
|
+
..., description="Creation timestamp", alias="createdAt"
|
|
59
|
+
)
|
|
60
|
+
updatedAt: datetime = Field(
|
|
61
|
+
..., description="Last update timestamp", alias="updatedAt"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class VendorGuardrailsResponse(BaseModel):
|
|
66
|
+
"""Response model for vendor guardrails list."""
|
|
67
|
+
|
|
68
|
+
model_config = ConfigDict(extra="ignore")
|
|
69
|
+
|
|
70
|
+
data: List[VendorGuardrail] = Field(..., description="List of vendor guardrails")
|
|
71
|
+
pagination: TokenPagination = Field(
|
|
72
|
+
..., description="Token-based pagination information"
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class VendorGuardrailVersion(BaseModel):
|
|
77
|
+
"""Model representing a vendor guardrail version."""
|
|
78
|
+
|
|
79
|
+
model_config = ConfigDict(extra="ignore")
|
|
80
|
+
|
|
81
|
+
id: str = Field(..., description="Unique identifier for the guardrail")
|
|
82
|
+
version: str = Field(..., description="Version of the guardrail")
|
|
83
|
+
name: str = Field(..., description="Name of the guardrail")
|
|
84
|
+
status: VendorGuardrailStatus = Field(..., description="Status of the version")
|
|
85
|
+
description: Optional[str] = Field(None, description="Description of the version")
|
|
86
|
+
blockedInputMessaging: Optional[str] = Field(
|
|
87
|
+
None,
|
|
88
|
+
description="Message to display when input is blocked by guardrail",
|
|
89
|
+
alias="blockedInputMessaging",
|
|
90
|
+
)
|
|
91
|
+
blockedOutputsMessaging: Optional[str] = Field(
|
|
92
|
+
None,
|
|
93
|
+
description="Message to display when output is blocked by guardrail",
|
|
94
|
+
alias="blockedOutputsMessaging",
|
|
95
|
+
)
|
|
96
|
+
createdAt: datetime = Field(
|
|
97
|
+
..., description="Creation timestamp", alias="createdAt"
|
|
98
|
+
)
|
|
99
|
+
updatedAt: datetime = Field(
|
|
100
|
+
..., description="Last update timestamp", alias="updatedAt"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class VendorGuardrailVersionsResponse(BaseModel):
|
|
105
|
+
"""Response model for vendor guardrail versions list."""
|
|
106
|
+
|
|
107
|
+
model_config = ConfigDict(extra="ignore")
|
|
108
|
+
|
|
109
|
+
data: List[VendorGuardrailVersion] = Field(
|
|
110
|
+
..., description="List of vendor guardrail versions"
|
|
111
|
+
)
|
|
112
|
+
pagination: TokenPagination = Field(
|
|
113
|
+
..., description="Token-based pagination information"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class VendorGuardrailInstallRequest(BaseModel):
|
|
118
|
+
"""Model for a single guardrail installation request."""
|
|
119
|
+
|
|
120
|
+
model_config = ConfigDict(extra="ignore")
|
|
121
|
+
|
|
122
|
+
id: str = Field(..., description="Guardrail ID to install")
|
|
123
|
+
version: str = Field(..., description="Version to use for the guardrail")
|
|
124
|
+
setting_id: str = Field(..., description="Vendor setting ID")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class VendorGuardrailInstallSummary(BaseModel):
|
|
128
|
+
"""Model for guardrail installation summary."""
|
|
129
|
+
|
|
130
|
+
model_config = ConfigDict(extra="ignore")
|
|
131
|
+
|
|
132
|
+
guardrailId: str = Field(..., description="Installed guardrail ID")
|
|
133
|
+
version: str = Field(..., description="Version used for installation")
|
|
134
|
+
aiRunId: str = Field(..., description="AI run ID for the installation")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class VendorGuardrailInstallResponse(BaseModel):
|
|
138
|
+
"""Response model for guardrail installation."""
|
|
139
|
+
|
|
140
|
+
model_config = ConfigDict(extra="ignore")
|
|
141
|
+
|
|
142
|
+
summary: List[VendorGuardrailInstallSummary] = Field(
|
|
143
|
+
..., description="List of installation summaries"
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class VendorGuardrailUninstallResponse(BaseModel):
|
|
148
|
+
"""Response model for guardrail uninstallation."""
|
|
149
|
+
|
|
150
|
+
model_config = ConfigDict(extra="ignore")
|
|
151
|
+
|
|
152
|
+
success: bool = Field(..., description="Whether the uninstallation was successful")
|