codemie-sdk-python 0.1.226__py3-none-any.whl → 0.1.273__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.
- codemie_sdk/__init__.py +27 -1
- codemie_sdk/client/client.py +14 -0
- codemie_sdk/models/assistant.py +54 -0
- codemie_sdk/models/datasource.py +79 -0
- codemie_sdk/models/integration.py +1 -1
- codemie_sdk/models/vendor_guardrail.py +152 -0
- codemie_sdk/models/workflow_execution_payload.py +4 -0
- codemie_sdk/services/assistant.py +214 -0
- codemie_sdk/services/datasource.py +67 -0
- codemie_sdk/services/files.py +21 -0
- codemie_sdk/services/vendor_guardrail.py +375 -0
- codemie_sdk/services/workflow.py +10 -1
- codemie_sdk/services/workflow_execution.py +26 -4
- codemie_sdk/utils/http.py +21 -7
- {codemie_sdk_python-0.1.226.dist-info → codemie_sdk_python-0.1.273.dist-info}/METADATA +636 -171
- {codemie_sdk_python-0.1.226.dist-info → codemie_sdk_python-0.1.273.dist-info}/RECORD +17 -15
- {codemie_sdk_python-0.1.226.dist-info → codemie_sdk_python-0.1.273.dist-info}/WHEEL +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: codemie-sdk-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.273
|
|
4
4
|
Summary: CodeMie SDK for Python
|
|
5
5
|
Author: Vadym Vlasenko
|
|
6
6
|
Author-email: vadym_vlasenko@epam.com
|
|
@@ -25,6 +25,8 @@ Python SDK for CodeMie services. This SDK provides a comprehensive interface to
|
|
|
25
25
|
- [Assistant Service](#assistant-service)
|
|
26
26
|
- [Core Methods](#core-methods)
|
|
27
27
|
- [Advanced Features](#advanced-features)
|
|
28
|
+
- [Prompt Variables Support](#prompt-variables-support)
|
|
29
|
+
- [Assistant Versioning](#assistant-versioning)
|
|
28
30
|
- [Datasource Service](#datasource-service)
|
|
29
31
|
- [Supported Datasource Types](#supported-datasource-types)
|
|
30
32
|
- [Core Methods](#core-methods-1)
|
|
@@ -43,30 +45,35 @@ Python SDK for CodeMie services. This SDK provides a comprehensive interface to
|
|
|
43
45
|
- [Workflow Status Monitoring](#workflow-status-monitoring)
|
|
44
46
|
- [Conversation Service](#conversation-service)
|
|
45
47
|
- [Core Methods](#core-methods-4)
|
|
46
|
-
- [
|
|
48
|
+
- [File Service](#file-service)
|
|
47
49
|
- [Core Methods](#core-methods-5)
|
|
48
|
-
- [
|
|
49
|
-
|
|
50
|
-
- [
|
|
51
|
-
|
|
50
|
+
- [User Service](#user-service)
|
|
51
|
+
- [Core Methods](#core-methods-6)
|
|
52
|
+
- [Task Service](#task-service)
|
|
53
|
+
- [Core Methods](#core-methods-7)
|
|
54
|
+
- [Webhook Service](#webhook-service)
|
|
55
|
+
- [Core Methods](#core-methods-8)
|
|
56
|
+
- [Vendor Services](#vendor-services)
|
|
57
|
+
- [Vendor Assistant Service](#vendor-assistant-service)
|
|
58
|
+
- [Vendor Workflow Service](#vendor-workflow-service)
|
|
59
|
+
- [Vendor Knowledge Base Service](#vendor-knowledge-base-service)
|
|
60
|
+
- [Vendor Guardrail Service](#vendor-guardrail-service)
|
|
52
61
|
- [Error Handling](#error-handling-1)
|
|
53
62
|
- [Authentication](#authentication)
|
|
54
63
|
- [Required Parameters](#required-parameters)
|
|
55
64
|
- [Usage Examples](#usage-examples)
|
|
56
65
|
- [Best Practices](#best-practices-1)
|
|
57
66
|
- [Support](#support)
|
|
67
|
+
- [Development](#development)
|
|
68
|
+
- [Setup](#setup)
|
|
69
|
+
- [Code Quality](#code-quality)
|
|
70
|
+
- [Building Package](#building-package)
|
|
58
71
|
|
|
59
72
|
## Installation
|
|
60
73
|
|
|
61
74
|
```sh
|
|
62
75
|
pip install codemie-sdk-python
|
|
63
76
|
```
|
|
64
|
-
OR
|
|
65
|
-
```sh
|
|
66
|
-
poetry install
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### If you want to run only tests, go to ## Running tests section
|
|
70
77
|
|
|
71
78
|
## Usage
|
|
72
79
|
|
|
@@ -89,30 +96,25 @@ client = CodeMieClient(
|
|
|
89
96
|
|
|
90
97
|
### LLM Service
|
|
91
98
|
|
|
92
|
-
The LLM service provides access to language models and embedding models
|
|
99
|
+
The LLM service provides access to language models and embedding models.
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
```python
|
|
96
|
-
llm_models = client.llm.list(token=client.token)
|
|
97
|
-
```
|
|
101
|
+
**Available Methods:**
|
|
98
102
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
embedding_models = client.llm.list_embeddings(token=client.token)
|
|
102
|
-
```
|
|
103
|
+
1. **list()** - Retrieves a list of available LLM models
|
|
104
|
+
2. **list_embeddings()** - Retrieves a list of available embedding models
|
|
103
105
|
|
|
104
|
-
Each LLM model contains
|
|
106
|
+
Each LLM model contains:
|
|
105
107
|
- Model identifier
|
|
106
108
|
- Model capabilities
|
|
107
109
|
- Configuration parameters
|
|
108
110
|
|
|
109
|
-
Example
|
|
111
|
+
**Example:**
|
|
110
112
|
```python
|
|
111
113
|
# List available LLM models
|
|
112
|
-
llm_models = client.
|
|
114
|
+
llm_models = client.llms.list()
|
|
113
115
|
|
|
114
116
|
# List available embedding models
|
|
115
|
-
embedding_models = client.
|
|
117
|
+
embedding_models = client.llms.list_embeddings()
|
|
116
118
|
```
|
|
117
119
|
|
|
118
120
|
### Assistant Service
|
|
@@ -123,7 +125,7 @@ The Assistant service allows you to manage and interact with CodeMie assistants:
|
|
|
123
125
|
|
|
124
126
|
1. **List Assistants**
|
|
125
127
|
```python
|
|
126
|
-
assistants = client.
|
|
128
|
+
assistants = client.assistants.list(
|
|
127
129
|
minimal_response=True, # Return minimal assistant info
|
|
128
130
|
scope="visible_to_user", # or "created_by_user"
|
|
129
131
|
page=0,
|
|
@@ -135,10 +137,10 @@ assistants = client.assistant.list(
|
|
|
135
137
|
2. **Get Assistant Details**
|
|
136
138
|
```python
|
|
137
139
|
# By ID
|
|
138
|
-
assistant = client.
|
|
140
|
+
assistant = client.assistants.get("assistant-id")
|
|
139
141
|
|
|
140
142
|
# By Slug
|
|
141
|
-
assistant = client.
|
|
143
|
+
assistant = client.assistants.get_by_slug("assistant-slug")
|
|
142
144
|
```
|
|
143
145
|
|
|
144
146
|
3. **Create Assistant**
|
|
@@ -152,7 +154,7 @@ request = AssistantCreateRequest(
|
|
|
152
154
|
tools=["tool1", "tool2"],
|
|
153
155
|
# Additional parameters as needed
|
|
154
156
|
)
|
|
155
|
-
new_assistant = client.
|
|
157
|
+
new_assistant = client.assistants.create(request)
|
|
156
158
|
```
|
|
157
159
|
|
|
158
160
|
4. **Update Assistant**
|
|
@@ -164,29 +166,54 @@ request = AssistantUpdateRequest(
|
|
|
164
166
|
description="Updated description",
|
|
165
167
|
# Other fields to update
|
|
166
168
|
)
|
|
167
|
-
updated_assistant = client.
|
|
169
|
+
updated_assistant = client.assistants.update("assistant-id", request)
|
|
168
170
|
```
|
|
169
171
|
|
|
170
172
|
5. **Delete Assistant**
|
|
171
173
|
```python
|
|
172
|
-
result = client.
|
|
174
|
+
result = client.assistants.delete("assistant-id")
|
|
173
175
|
```
|
|
174
176
|
|
|
175
177
|
#### Advanced Features
|
|
176
178
|
|
|
177
|
-
6. **Chat with Assistant**
|
|
179
|
+
6. **Chat with Assistant (with MCP header propagation)**
|
|
178
180
|
```python
|
|
179
181
|
from codemie_sdk.models.assistant import AssistantChatRequest
|
|
180
182
|
|
|
181
183
|
chat_request = AssistantChatRequest(
|
|
182
184
|
text="Your message here",
|
|
183
185
|
stream=False, # Set to True for streaming response
|
|
184
|
-
#
|
|
186
|
+
propagate_headers=True, # Enable propagation of X-* headers to MCP servers
|
|
187
|
+
)
|
|
188
|
+
# Pass X-* headers to forward to MCP servers
|
|
189
|
+
response = client.assistants.chat(
|
|
190
|
+
"assistant-id",
|
|
191
|
+
chat_request,
|
|
192
|
+
headers={
|
|
193
|
+
"X-Tenant-ID": "tenant-abc-123",
|
|
194
|
+
"X-User-ID": "user-456",
|
|
195
|
+
"X-Request-ID": "req-123",
|
|
196
|
+
},
|
|
197
|
+
)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
7. **Chat with Assistant by slug (with MCP header propagation)**
|
|
201
|
+
```python
|
|
202
|
+
chat_request = AssistantChatRequest(
|
|
203
|
+
text="Your message here",
|
|
204
|
+
propagate_headers=True,
|
|
205
|
+
)
|
|
206
|
+
response = client.assistants.chat_by_slug(
|
|
207
|
+
"assistant-slug",
|
|
208
|
+
chat_request,
|
|
209
|
+
headers={
|
|
210
|
+
"X-Environment": "production",
|
|
211
|
+
"X-Feature-Flag-Beta": "true",
|
|
212
|
+
},
|
|
185
213
|
)
|
|
186
|
-
response = client.assistant.chat("assistant-id", chat_request)
|
|
187
214
|
```
|
|
188
215
|
|
|
189
|
-
|
|
216
|
+
8. **Utilize structured outputs with Assistant**
|
|
190
217
|
```python
|
|
191
218
|
from pydantic import BaseModel
|
|
192
219
|
|
|
@@ -195,8 +222,8 @@ class OutputSchema(BaseModel):
|
|
|
195
222
|
|
|
196
223
|
chat_request = AssistantChatRequest(
|
|
197
224
|
text="Your message here",
|
|
198
|
-
stream=False,
|
|
199
|
-
output_schema=OutputSchema
|
|
225
|
+
stream=False,
|
|
226
|
+
output_schema=OutputSchema,
|
|
200
227
|
# Additional parameters
|
|
201
228
|
)
|
|
202
229
|
|
|
@@ -220,27 +247,110 @@ output_schema = {
|
|
|
220
247
|
|
|
221
248
|
chat_request = AssistantChatRequest(
|
|
222
249
|
text="Your message here",
|
|
223
|
-
stream=False,
|
|
224
|
-
output_schema=output_schema
|
|
250
|
+
stream=False,
|
|
251
|
+
output_schema=output_schema,
|
|
225
252
|
# Additional parameters
|
|
226
253
|
)
|
|
227
254
|
|
|
228
255
|
response = client.assistants.chat("id", chat_request)
|
|
229
|
-
# response.generated is a dict
|
|
256
|
+
# response.generated is a dict corresponding to the JSON schema
|
|
230
257
|
```
|
|
231
258
|
|
|
232
|
-
|
|
259
|
+
9. **Work with Prebuilt Assistants**
|
|
233
260
|
```python
|
|
234
261
|
# List prebuilt assistants
|
|
235
|
-
prebuilt = client.
|
|
262
|
+
prebuilt = client.assistants.get_prebuilt()
|
|
236
263
|
|
|
237
264
|
# Get specific prebuilt assistant
|
|
238
|
-
prebuilt_assistant = client.
|
|
265
|
+
prebuilt_assistant = client.assistants.get_prebuilt_by_slug("assistant-slug")
|
|
239
266
|
```
|
|
240
267
|
|
|
241
|
-
|
|
268
|
+
10. **Get Available Tools**
|
|
242
269
|
```python
|
|
243
|
-
tools = client.
|
|
270
|
+
tools = client.assistants.get_tools()
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
#### Prompt Variables Support
|
|
274
|
+
|
|
275
|
+
The SDK supports assistant-level prompt variables that the backend already exposes via the `prompt_variables` field.
|
|
276
|
+
|
|
277
|
+
Create and update an assistant with prompt variables:
|
|
278
|
+
```python
|
|
279
|
+
from codemie_sdk.models.assistant import AssistantCreateRequest, AssistantUpdateRequest, PromptVariable
|
|
280
|
+
|
|
281
|
+
# Create
|
|
282
|
+
create_req = AssistantCreateRequest(
|
|
283
|
+
name="My Assistant",
|
|
284
|
+
description="Assistant description",
|
|
285
|
+
system_prompt="Instructions. Use {{project_name}} in responses.",
|
|
286
|
+
toolkits=[],
|
|
287
|
+
project="my_project",
|
|
288
|
+
llm_model_type="gpt-4o",
|
|
289
|
+
context=[],
|
|
290
|
+
conversation_starters=[],
|
|
291
|
+
mcp_servers=[],
|
|
292
|
+
assistant_ids=[],
|
|
293
|
+
prompt_variables=[
|
|
294
|
+
PromptVariable(key="project_name", default_value="Delta", description="Current project"),
|
|
295
|
+
PromptVariable(key="region", default_value="eu"),
|
|
296
|
+
],
|
|
297
|
+
)
|
|
298
|
+
client.assistants.create(create_req)
|
|
299
|
+
|
|
300
|
+
# Update
|
|
301
|
+
update_req = AssistantUpdateRequest(
|
|
302
|
+
**create_req.model_dump(),
|
|
303
|
+
prompt_variables=[
|
|
304
|
+
PromptVariable(key="project_name", default_value="Delta-Updated"),
|
|
305
|
+
PromptVariable(key="region", default_value="us"),
|
|
306
|
+
],
|
|
307
|
+
)
|
|
308
|
+
client.assistants.update("assistant-id", update_req)
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
#### Assistant Versioning
|
|
312
|
+
|
|
313
|
+
The SDK provides full assistant versioning capabilities.
|
|
314
|
+
|
|
315
|
+
1. **List Versions**
|
|
316
|
+
```python
|
|
317
|
+
# Get all versions of an assistant
|
|
318
|
+
versions = client.assistants.list_versions("assistant-id", page=0, per_page=20)
|
|
319
|
+
for version in versions:
|
|
320
|
+
print(f"Version {version.version_number}")
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
2. **Get Specific Version**
|
|
324
|
+
```python
|
|
325
|
+
# Get details of a specific version
|
|
326
|
+
version = client.assistants.get_version("assistant-id", version_number=2)
|
|
327
|
+
print(version.system_prompt)
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
3. **Compare Versions**
|
|
331
|
+
```python
|
|
332
|
+
from codemie_sdk.models.assistant import AssistantVersionDiff
|
|
333
|
+
|
|
334
|
+
# Compare two versions to see what changed
|
|
335
|
+
diff = client.assistants.compare_versions("assistant-id", version1=1, version2=3)
|
|
336
|
+
print(diff.summary)
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
4. **Rollback to Version**
|
|
340
|
+
```python
|
|
341
|
+
# Rollback assistant to a previous version
|
|
342
|
+
response = client.assistants.rollback_to_version("assistant-id", version_number=2)
|
|
343
|
+
print(f"Rolled back to version {response.version_number}")
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
5. **Chat with Specific Version**
|
|
347
|
+
```python
|
|
348
|
+
from codemie_sdk.models.assistant import AssistantChatRequest
|
|
349
|
+
|
|
350
|
+
# Chat with a specific version of the assistant
|
|
351
|
+
request = AssistantChatRequest(text="Hi", stream=False)
|
|
352
|
+
response = client.assistants.chat_with_version("assistant-id", version_number=2, request)
|
|
353
|
+
print(response.generated)
|
|
244
354
|
```
|
|
245
355
|
|
|
246
356
|
### Datasource Service
|
|
@@ -254,6 +364,7 @@ The Datasource service enables managing various types of data sources in CodeMie
|
|
|
254
364
|
- `JIRA`: Jira knowledge base
|
|
255
365
|
- `FILE`: File-based knowledge base
|
|
256
366
|
- `GOOGLE`: Google documents
|
|
367
|
+
- `AZURE_DEVOPS_WIKI`: Azure DevOps Wiki knowledge base (requires Azure DevOps integration)
|
|
257
368
|
|
|
258
369
|
#### Core Methods
|
|
259
370
|
|
|
@@ -263,7 +374,8 @@ from codemie_sdk.models.datasource import (
|
|
|
263
374
|
CodeDataSourceRequest,
|
|
264
375
|
ConfluenceDataSourceRequest,
|
|
265
376
|
JiraDataSourceRequest,
|
|
266
|
-
GoogleDataSourceRequest
|
|
377
|
+
GoogleDataSourceRequest,
|
|
378
|
+
AzureDevOpsWikiDataSourceRequest
|
|
267
379
|
)
|
|
268
380
|
|
|
269
381
|
# Create Code Datasource
|
|
@@ -279,7 +391,7 @@ code_request = CodeDataSourceRequest(
|
|
|
279
391
|
summarization_model="gpt-4", # optional
|
|
280
392
|
docs_generation=False # optional
|
|
281
393
|
)
|
|
282
|
-
result = client.
|
|
394
|
+
result = client.datasources.create(code_request)
|
|
283
395
|
|
|
284
396
|
# Create Confluence Datasource
|
|
285
397
|
confluence_request = ConfluenceDataSourceRequest(
|
|
@@ -292,7 +404,7 @@ confluence_request = ConfluenceDataSourceRequest(
|
|
|
292
404
|
include_attachments=True,
|
|
293
405
|
include_comments=True
|
|
294
406
|
)
|
|
295
|
-
result = client.
|
|
407
|
+
result = client.datasources.create(confluence_request)
|
|
296
408
|
|
|
297
409
|
# Create Jira Datasource
|
|
298
410
|
jira_request = JiraDataSourceRequest(
|
|
@@ -301,7 +413,7 @@ jira_request = JiraDataSourceRequest(
|
|
|
301
413
|
description="Jira project",
|
|
302
414
|
jql="project = 'MYPROJECT'"
|
|
303
415
|
)
|
|
304
|
-
result = client.
|
|
416
|
+
result = client.datasources.create(jira_request)
|
|
305
417
|
|
|
306
418
|
# Create Google Doc Datasource
|
|
307
419
|
google_request = GoogleDataSourceRequest(
|
|
@@ -310,12 +422,39 @@ google_request = GoogleDataSourceRequest(
|
|
|
310
422
|
description="Google document",
|
|
311
423
|
google_doc="document_url"
|
|
312
424
|
)
|
|
313
|
-
result = client.
|
|
425
|
+
result = client.datasources.create(google_request)
|
|
426
|
+
|
|
427
|
+
# Create Azure DevOps Wiki Datasource
|
|
428
|
+
# Note: Requires Azure DevOps integration to be configured
|
|
429
|
+
ado_wiki_request = AzureDevOpsWikiDataSourceRequest(
|
|
430
|
+
name="ado_wiki",
|
|
431
|
+
project_name="my_project",
|
|
432
|
+
description="Azure DevOps Wiki",
|
|
433
|
+
setting_id="azure-devops-integration-id", # Integration ID with ADO credentials
|
|
434
|
+
wiki_query="*", # Path filter (see wiki_query format below)
|
|
435
|
+
wiki_name="MyProject.wiki" # Optional: specific wiki name (leave empty for all wikis)
|
|
436
|
+
)
|
|
437
|
+
result = client.datasources.create(ado_wiki_request)
|
|
438
|
+
|
|
439
|
+
# Important: wiki_query Path Format
|
|
440
|
+
# The page path should NOT include "/Overview/Wiki" and must start from the page level.
|
|
441
|
+
#
|
|
442
|
+
# Example: If your Azure DevOps breadcrumbs show:
|
|
443
|
+
# "ProjectName/WikiName/Overview/Wiki/Page1/Page2"
|
|
444
|
+
#
|
|
445
|
+
# Then use: "/Page1/*" as the path
|
|
446
|
+
#
|
|
447
|
+
# Build the path using breadcrumb values, NOT the page URL.
|
|
448
|
+
#
|
|
449
|
+
# Common patterns:
|
|
450
|
+
# - "*" - Index all pages in the wiki
|
|
451
|
+
# - "/Engineering/*" - Index all pages under /Engineering folder
|
|
452
|
+
# - "/Engineering/Architecture" - Index only the Architecture page
|
|
314
453
|
```
|
|
315
454
|
|
|
316
455
|
2. **Update Datasource**
|
|
317
456
|
```python
|
|
318
|
-
from codemie_sdk.models.datasource import UpdateCodeDataSourceRequest
|
|
457
|
+
from codemie_sdk.models.datasource import UpdateCodeDataSourceRequest, UpdateAzureDevOpsWikiDataSourceRequest
|
|
319
458
|
|
|
320
459
|
# Update Code Datasource
|
|
321
460
|
update_request = UpdateCodeDataSourceRequest(
|
|
@@ -327,18 +466,36 @@ update_request = UpdateCodeDataSourceRequest(
|
|
|
327
466
|
skip_reindex=False,
|
|
328
467
|
resume_indexing=False
|
|
329
468
|
)
|
|
330
|
-
result = client.
|
|
469
|
+
result = client.datasources.update("datasource_id", update_request)
|
|
470
|
+
|
|
471
|
+
# Update Azure DevOps Wiki Datasource
|
|
472
|
+
ado_update_request = UpdateAzureDevOpsWikiDataSourceRequest(
|
|
473
|
+
name="ado_wiki",
|
|
474
|
+
project_name="my_project",
|
|
475
|
+
description="Updated description",
|
|
476
|
+
wiki_query="/Engineering/*", # Update path filter (see wiki_query format above)
|
|
477
|
+
wiki_name="MyProject.wiki",
|
|
478
|
+
full_reindex=True # Trigger full reindex
|
|
479
|
+
)
|
|
480
|
+
result = client.datasources.update("datasource_id", ado_update_request)
|
|
331
481
|
```
|
|
332
482
|
|
|
483
|
+
**Reindex Options for Azure DevOps Wiki:**
|
|
484
|
+
Azure DevOps Wiki datasources support the following reindex options:
|
|
485
|
+
- `full_reindex=True` - Completely reindex all pages (clears existing data and reindexes)
|
|
486
|
+
- `skip_reindex=True` - Update metadata without reindexing content
|
|
487
|
+
|
|
488
|
+
Note: Azure DevOps Wiki does not support `incremental_reindex` or `resume_indexing` options.
|
|
489
|
+
|
|
333
490
|
3. **List Datasources**
|
|
334
491
|
```python
|
|
335
492
|
# List all datasources with filtering and pagination
|
|
336
|
-
datasources = client.
|
|
493
|
+
datasources = client.datasources.list(
|
|
337
494
|
page=0,
|
|
338
495
|
per_page=10,
|
|
339
496
|
sort_key="update_date", # or "date"
|
|
340
497
|
sort_order="desc", # or "asc"
|
|
341
|
-
datasource_types=["CODE", "CONFLUENCE"], # optional filter by type
|
|
498
|
+
datasource_types=["CODE", "CONFLUENCE", "AZURE_DEVOPS_WIKI"], # optional filter by type
|
|
342
499
|
projects=["project1", "project2"], # optional filter by projects
|
|
343
500
|
owner="John Doe", # optional filter by owner
|
|
344
501
|
status="COMPLETED" # optional filter by status
|
|
@@ -348,13 +505,20 @@ datasources = client.datasource.list(
|
|
|
348
505
|
4. **Get Datasource Details**
|
|
349
506
|
```python
|
|
350
507
|
# Get single datasource by ID
|
|
351
|
-
datasource = client.
|
|
508
|
+
datasource = client.datasources.get("datasource_id")
|
|
509
|
+
|
|
510
|
+
# Access Azure DevOps Wiki specific fields
|
|
511
|
+
if datasource.type == "knowledge_base_azure_devops_wiki":
|
|
512
|
+
wiki_info = datasource.azure_devops_wiki
|
|
513
|
+
if wiki_info:
|
|
514
|
+
print(f"Wiki Query: {wiki_info.wiki_query}")
|
|
515
|
+
print(f"Wiki Name: {wiki_info.wiki_name}")
|
|
352
516
|
```
|
|
353
517
|
|
|
354
518
|
5. **Delete Datasource**
|
|
355
519
|
```python
|
|
356
520
|
# Delete datasource by ID
|
|
357
|
-
result = client.
|
|
521
|
+
result = client.datasources.delete("datasource_id")
|
|
358
522
|
```
|
|
359
523
|
|
|
360
524
|
#### Datasource Status
|
|
@@ -402,7 +566,7 @@ The Integration service manages both user and project-level integrations in Code
|
|
|
402
566
|
from codemie_sdk.models.integration import IntegrationType
|
|
403
567
|
|
|
404
568
|
# List user integrations with pagination
|
|
405
|
-
user_integrations = client.
|
|
569
|
+
user_integrations = client.integrations.list(
|
|
406
570
|
setting_type=IntegrationType.USER,
|
|
407
571
|
page=0,
|
|
408
572
|
per_page=10,
|
|
@@ -410,7 +574,7 @@ user_integrations = client.integration.list(
|
|
|
410
574
|
)
|
|
411
575
|
|
|
412
576
|
# List project integrations
|
|
413
|
-
project_integrations = client.
|
|
577
|
+
project_integrations = client.integrations.list(
|
|
414
578
|
setting_type=IntegrationType.PROJECT,
|
|
415
579
|
per_page=100
|
|
416
580
|
)
|
|
@@ -419,13 +583,13 @@ project_integrations = client.integration.list(
|
|
|
419
583
|
2. **Get Integration**
|
|
420
584
|
```python
|
|
421
585
|
# Get integration by ID
|
|
422
|
-
integration = client.
|
|
586
|
+
integration = client.integrations.get(
|
|
423
587
|
integration_id="integration_id",
|
|
424
588
|
setting_type=IntegrationType.USER
|
|
425
589
|
)
|
|
426
590
|
|
|
427
591
|
# Get integration by alias
|
|
428
|
-
integration = client.
|
|
592
|
+
integration = client.integrations.get_by_alias(
|
|
429
593
|
alias="integration_alias",
|
|
430
594
|
setting_type=IntegrationType.PROJECT
|
|
431
595
|
)
|
|
@@ -441,7 +605,7 @@ new_integration = Integration(
|
|
|
441
605
|
alias="my_integration",
|
|
442
606
|
# Add other required fields based on integration type
|
|
443
607
|
)
|
|
444
|
-
result = client.
|
|
608
|
+
result = client.integrations.create(new_integration)
|
|
445
609
|
```
|
|
446
610
|
|
|
447
611
|
4. **Update Integration**
|
|
@@ -452,13 +616,13 @@ updated_integration = Integration(
|
|
|
452
616
|
alias="updated_alias",
|
|
453
617
|
# Add other fields to update
|
|
454
618
|
)
|
|
455
|
-
result = client.
|
|
619
|
+
result = client.integrations.update("integration_id", updated_integration)
|
|
456
620
|
```
|
|
457
621
|
|
|
458
622
|
5. **Delete Integration**
|
|
459
623
|
```python
|
|
460
624
|
# Delete integration
|
|
461
|
-
result = client.
|
|
625
|
+
result = client.integrations.delete(
|
|
462
626
|
setting_id="integration_id",
|
|
463
627
|
setting_type=IntegrationType.USER
|
|
464
628
|
)
|
|
@@ -502,7 +666,7 @@ workflow_request = WorkflowCreateRequest(
|
|
|
502
666
|
shared=False, # Optional, defaults to False
|
|
503
667
|
icon_url="https://example.com/icon.png" # Optional
|
|
504
668
|
)
|
|
505
|
-
result = client.
|
|
669
|
+
result = client.workflows.create_workflow(workflow_request)
|
|
506
670
|
```
|
|
507
671
|
|
|
508
672
|
2. **Update Workflow**
|
|
@@ -517,13 +681,13 @@ update_request = WorkflowUpdateRequest(
|
|
|
517
681
|
mode="PARALLEL",
|
|
518
682
|
shared=True
|
|
519
683
|
)
|
|
520
|
-
result = client.
|
|
684
|
+
result = client.workflows.update("workflow-id", update_request)
|
|
521
685
|
```
|
|
522
686
|
|
|
523
687
|
3. **List Workflows**
|
|
524
688
|
```python
|
|
525
689
|
# List workflows with pagination and filtering
|
|
526
|
-
workflows = client.
|
|
690
|
+
workflows = client.workflows.list(
|
|
527
691
|
page=0,
|
|
528
692
|
per_page=10,
|
|
529
693
|
projects=["project1", "project2"] # Optional project filter
|
|
@@ -533,28 +697,36 @@ workflows = client.workflow.list(
|
|
|
533
697
|
4. **Get Workflow Details**
|
|
534
698
|
```python
|
|
535
699
|
# Get workflow by ID
|
|
536
|
-
workflow = client.
|
|
700
|
+
workflow = client.workflows.get("workflow-id")
|
|
537
701
|
|
|
538
702
|
# Get prebuilt workflows
|
|
539
|
-
prebuilt_workflows = client.
|
|
703
|
+
prebuilt_workflows = client.workflows.get_prebuilt()
|
|
540
704
|
```
|
|
541
705
|
|
|
542
706
|
5. **Delete Workflow**
|
|
543
707
|
```python
|
|
544
|
-
result = client.
|
|
708
|
+
result = client.workflows.delete("workflow-id")
|
|
545
709
|
```
|
|
546
710
|
|
|
547
711
|
#### Workflow Execution
|
|
548
712
|
|
|
549
713
|
The SDK provides comprehensive workflow execution management through the WorkflowExecutionService:
|
|
550
714
|
|
|
551
|
-
1. **Run Workflow**
|
|
715
|
+
1. **Run Workflow (with MCP header propagation)**
|
|
552
716
|
```python
|
|
553
|
-
#
|
|
554
|
-
execution = client.
|
|
717
|
+
# Enable propagation in payload and pass X-* headers to forward to MCP servers
|
|
718
|
+
execution = client.workflows.run(
|
|
719
|
+
"workflow-id",
|
|
720
|
+
user_input="optional input",
|
|
721
|
+
propagate_headers=True,
|
|
722
|
+
headers={
|
|
723
|
+
"X-Request-ID": "req-abc-123",
|
|
724
|
+
"X-Source-App": "analytics-ui",
|
|
725
|
+
},
|
|
726
|
+
)
|
|
555
727
|
|
|
556
728
|
# Get execution service for advanced operations
|
|
557
|
-
execution_service = client.
|
|
729
|
+
execution_service = client.workflows.executions("workflow-id")
|
|
558
730
|
```
|
|
559
731
|
|
|
560
732
|
2. **Manage Executions**
|
|
@@ -571,8 +743,14 @@ execution = execution_service.get("execution-id")
|
|
|
571
743
|
# Abort running execution
|
|
572
744
|
result = execution_service.abort("execution-id")
|
|
573
745
|
|
|
574
|
-
# Resume interrupted execution
|
|
575
|
-
result = execution_service.resume(
|
|
746
|
+
# Resume interrupted execution with header propagation (query param + headers)
|
|
747
|
+
result = execution_service.resume(
|
|
748
|
+
"execution-id",
|
|
749
|
+
propagate_headers=True,
|
|
750
|
+
headers={
|
|
751
|
+
"X-Correlation-ID": "corr-456",
|
|
752
|
+
},
|
|
753
|
+
)
|
|
576
754
|
|
|
577
755
|
# Delete all executions
|
|
578
756
|
result = execution_service.delete_all()
|
|
@@ -674,7 +852,7 @@ Implement proper error handling for workflow operations:
|
|
|
674
852
|
|
|
675
853
|
```python
|
|
676
854
|
try:
|
|
677
|
-
workflow = client.
|
|
855
|
+
workflow = client.workflows.get("workflow-id")
|
|
678
856
|
except ApiError as e:
|
|
679
857
|
if e.status_code == 404:
|
|
680
858
|
print("Workflow not found")
|
|
@@ -738,18 +916,374 @@ client.conversations.delete("conversation-id")
|
|
|
738
916
|
```
|
|
739
917
|
|
|
740
918
|
|
|
919
|
+
### File Service
|
|
920
|
+
|
|
921
|
+
The File service enables file upload and download operations in CodeMie.
|
|
922
|
+
|
|
923
|
+
#### Core Methods
|
|
924
|
+
|
|
925
|
+
1. **Bulk Upload Files**
|
|
926
|
+
```python
|
|
927
|
+
from pathlib import Path
|
|
928
|
+
|
|
929
|
+
# Upload multiple files
|
|
930
|
+
files = [
|
|
931
|
+
Path("/path/to/file1.pdf"),
|
|
932
|
+
Path("/path/to/file2.txt"),
|
|
933
|
+
Path("/path/to/file3.docx")
|
|
934
|
+
]
|
|
935
|
+
|
|
936
|
+
response = client.files.bulk_upload(files)
|
|
937
|
+
|
|
938
|
+
# Access uploaded file information
|
|
939
|
+
for file_info in response.files:
|
|
940
|
+
print(f"Uploaded: {file_info.name}, ID: {file_info.id}")
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
2. **Get File**
|
|
944
|
+
```python
|
|
945
|
+
# Download file by ID
|
|
946
|
+
file_content = client.files.get_file("file-id")
|
|
947
|
+
|
|
948
|
+
# Save to disk
|
|
949
|
+
with open("downloaded_file.pdf", "wb") as f:
|
|
950
|
+
f.write(file_content)
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
### User Service
|
|
954
|
+
|
|
955
|
+
The User service provides access to user profile and preferences.
|
|
956
|
+
|
|
957
|
+
#### Core Methods
|
|
958
|
+
|
|
959
|
+
1. **Get Current User Profile**
|
|
960
|
+
```python
|
|
961
|
+
# Get current user information
|
|
962
|
+
user = client.users.about_me()
|
|
963
|
+
print(f"User: {user.name}, Email: {user.email}")
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
2. **Get User Data and Preferences**
|
|
967
|
+
```python
|
|
968
|
+
# Get user data and preferences
|
|
969
|
+
user_data = client.users.get_data()
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
### Task Service
|
|
973
|
+
|
|
974
|
+
The Task service enables monitoring of background tasks.
|
|
975
|
+
|
|
976
|
+
#### Core Methods
|
|
977
|
+
|
|
978
|
+
1. **Get Background Task**
|
|
979
|
+
```python
|
|
980
|
+
# Get background task status by ID
|
|
981
|
+
task = client.tasks.get("task-id")
|
|
982
|
+
print(f"Task Status: {task.status}")
|
|
983
|
+
print(f"Progress: {task.progress}")
|
|
984
|
+
```
|
|
985
|
+
|
|
741
986
|
### Webhook Service
|
|
742
987
|
|
|
743
|
-
The Webhook service provides access to trigger available
|
|
988
|
+
The Webhook service provides access to trigger available webhooks in CodeMie.
|
|
744
989
|
|
|
745
990
|
#### Core Methods
|
|
746
991
|
|
|
747
|
-
1. **
|
|
992
|
+
1. **Trigger Webhook**
|
|
748
993
|
```python
|
|
749
|
-
# Trigger assistant/workflow/datasource by
|
|
994
|
+
# Trigger assistant/workflow/datasource by its ID
|
|
750
995
|
# Data - body of the post method
|
|
751
|
-
response = client.webhook.trigger("resource_id", "
|
|
996
|
+
response = client.webhook.trigger("resource_id", {"key": "value"})
|
|
997
|
+
```
|
|
998
|
+
|
|
999
|
+
### Vendor Services
|
|
1000
|
+
|
|
1001
|
+
The Vendor Services enable integration with cloud providers to access and manage their native AI assistants, workflows, knowledge bases, and guardrails. Currently, only AWS is supported.
|
|
1002
|
+
|
|
1003
|
+
#### Vendor Assistant Service
|
|
1004
|
+
|
|
1005
|
+
Manage cloud vendor assistants (AWS Bedrock Agents).
|
|
1006
|
+
|
|
1007
|
+
**Core Methods:**
|
|
1008
|
+
|
|
1009
|
+
1. **Get Assistant Settings**
|
|
1010
|
+
```python
|
|
1011
|
+
from codemie_sdk.models.vendor_assistant import VendorType
|
|
1012
|
+
|
|
1013
|
+
# Get AWS assistant settings with pagination
|
|
1014
|
+
settings = client.vendor_assistants.get_assistant_settings(
|
|
1015
|
+
vendor=VendorType.AWS,
|
|
1016
|
+
page=0,
|
|
1017
|
+
per_page=10
|
|
1018
|
+
)
|
|
1019
|
+
|
|
1020
|
+
# Or use string
|
|
1021
|
+
settings = client.vendor_assistants.get_assistant_settings("aws", page=0, per_page=10)
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
2. **Get Assistants**
|
|
1025
|
+
```python
|
|
1026
|
+
# Get assistants for a specific vendor setting
|
|
1027
|
+
assistants = client.vendor_assistants.get_assistants(
|
|
1028
|
+
vendor=VendorType.AWS,
|
|
1029
|
+
setting_id="cac90788-39b7-4ffe-8b57-e8b047fa1f6c",
|
|
1030
|
+
per_page=8,
|
|
1031
|
+
next_token=None # For pagination
|
|
1032
|
+
)
|
|
1033
|
+
|
|
1034
|
+
# Access assistant data
|
|
1035
|
+
for assistant in assistants.data:
|
|
1036
|
+
print(f"Assistant: {assistant.name}, ID: {assistant.id}")
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
3. **Get Assistant Details**
|
|
1040
|
+
```python
|
|
1041
|
+
# Get specific assistant
|
|
1042
|
+
assistant = client.vendor_assistants.get_assistant(
|
|
1043
|
+
vendor=VendorType.AWS,
|
|
1044
|
+
setting_id="setting-id",
|
|
1045
|
+
assistant_id="assistant-id"
|
|
1046
|
+
)
|
|
1047
|
+
|
|
1048
|
+
# Get assistant versions
|
|
1049
|
+
versions = client.vendor_assistants.get_assistant_versions(
|
|
1050
|
+
vendor=VendorType.AWS,
|
|
1051
|
+
setting_id="setting-id",
|
|
1052
|
+
assistant_id="assistant-id"
|
|
1053
|
+
)
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
4. **Get Assistant Aliases**
|
|
1057
|
+
```python
|
|
1058
|
+
# Get aliases for an assistant
|
|
1059
|
+
aliases = client.vendor_assistants.get_assistant_aliases(
|
|
1060
|
+
vendor=VendorType.AWS,
|
|
1061
|
+
setting_id="setting-id",
|
|
1062
|
+
assistant_id="assistant-id"
|
|
1063
|
+
)
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
5. **Install/Uninstall Assistants**
|
|
1067
|
+
```python
|
|
1068
|
+
from codemie_sdk.models.vendor_assistant import VendorAssistantInstallRequest
|
|
1069
|
+
|
|
1070
|
+
# Install assistant
|
|
1071
|
+
install_request = VendorAssistantInstallRequest(
|
|
1072
|
+
assistant_id="assistant-id",
|
|
1073
|
+
version="1.0",
|
|
1074
|
+
project="project-name"
|
|
1075
|
+
)
|
|
1076
|
+
|
|
1077
|
+
response = client.vendor_assistants.install_assistant(
|
|
1078
|
+
vendor=VendorType.AWS,
|
|
1079
|
+
setting_id="setting-id",
|
|
1080
|
+
request=install_request
|
|
1081
|
+
)
|
|
1082
|
+
|
|
1083
|
+
# Uninstall assistant
|
|
1084
|
+
response = client.vendor_assistants.uninstall_assistant(
|
|
1085
|
+
vendor=VendorType.AWS,
|
|
1086
|
+
setting_id="setting-id",
|
|
1087
|
+
assistant_id="assistant-id"
|
|
1088
|
+
)
|
|
1089
|
+
```
|
|
1090
|
+
|
|
1091
|
+
#### Vendor Workflow Service
|
|
1092
|
+
|
|
1093
|
+
Manage cloud vendor workflows (AWS Step Functions).
|
|
1094
|
+
|
|
1095
|
+
**Core Methods:**
|
|
1096
|
+
|
|
1097
|
+
1. **Get Workflow Settings**
|
|
1098
|
+
```python
|
|
1099
|
+
# Get workflow settings for a vendor
|
|
1100
|
+
settings = client.vendor_workflows.get_workflow_settings(
|
|
1101
|
+
vendor=VendorType.AWS,
|
|
1102
|
+
page=0,
|
|
1103
|
+
per_page=10
|
|
1104
|
+
)
|
|
1105
|
+
```
|
|
1106
|
+
|
|
1107
|
+
2. **Get Workflows**
|
|
1108
|
+
```python
|
|
1109
|
+
# Get workflows for a specific setting
|
|
1110
|
+
workflows = client.vendor_workflows.get_workflows(
|
|
1111
|
+
vendor=VendorType.AWS,
|
|
1112
|
+
setting_id="setting-id",
|
|
1113
|
+
per_page=10,
|
|
1114
|
+
next_token=None
|
|
1115
|
+
)
|
|
1116
|
+
```
|
|
1117
|
+
|
|
1118
|
+
3. **Get Workflow Details**
|
|
1119
|
+
```python
|
|
1120
|
+
# Get specific workflow
|
|
1121
|
+
workflow = client.vendor_workflows.get_workflow(
|
|
1122
|
+
vendor=VendorType.AWS,
|
|
1123
|
+
setting_id="setting-id",
|
|
1124
|
+
workflow_id="workflow-id"
|
|
1125
|
+
)
|
|
1126
|
+
```
|
|
1127
|
+
|
|
1128
|
+
4. **Install/Uninstall Workflows**
|
|
1129
|
+
```python
|
|
1130
|
+
from codemie_sdk.models.vendor_workflow import VendorWorkflowInstallRequest
|
|
1131
|
+
|
|
1132
|
+
# Install workflow
|
|
1133
|
+
install_request = VendorWorkflowInstallRequest(
|
|
1134
|
+
workflow_id="workflow-id",
|
|
1135
|
+
project="project-name"
|
|
1136
|
+
)
|
|
1137
|
+
|
|
1138
|
+
response = client.vendor_workflows.install_workflow(
|
|
1139
|
+
vendor=VendorType.AWS,
|
|
1140
|
+
setting_id="setting-id",
|
|
1141
|
+
request=install_request
|
|
1142
|
+
)
|
|
1143
|
+
|
|
1144
|
+
# Uninstall workflow
|
|
1145
|
+
response = client.vendor_workflows.uninstall_workflow(
|
|
1146
|
+
vendor=VendorType.AWS,
|
|
1147
|
+
setting_id="setting-id",
|
|
1148
|
+
workflow_id="workflow-id"
|
|
1149
|
+
)
|
|
1150
|
+
```
|
|
1151
|
+
|
|
1152
|
+
#### Vendor Knowledge Base Service
|
|
1153
|
+
|
|
1154
|
+
Manage cloud vendor knowledge bases (AWS Bedrock Knowledge Bases).
|
|
1155
|
+
|
|
1156
|
+
**Core Methods:**
|
|
1157
|
+
|
|
1158
|
+
1. **Get Knowledge Base Settings**
|
|
1159
|
+
```python
|
|
1160
|
+
# Get knowledge base settings for a vendor
|
|
1161
|
+
settings = client.vendor_knowledgebases.get_knowledgebase_settings(
|
|
1162
|
+
vendor=VendorType.AWS,
|
|
1163
|
+
page=0,
|
|
1164
|
+
per_page=10
|
|
1165
|
+
)
|
|
1166
|
+
```
|
|
1167
|
+
|
|
1168
|
+
2. **Get Knowledge Bases**
|
|
1169
|
+
```python
|
|
1170
|
+
# Get knowledge bases for a specific setting
|
|
1171
|
+
kbs = client.vendor_knowledgebases.get_knowledgebases(
|
|
1172
|
+
vendor=VendorType.AWS,
|
|
1173
|
+
setting_id="setting-id",
|
|
1174
|
+
per_page=10,
|
|
1175
|
+
next_token=None
|
|
1176
|
+
)
|
|
1177
|
+
```
|
|
1178
|
+
|
|
1179
|
+
3. **Get Knowledge Base Details**
|
|
1180
|
+
```python
|
|
1181
|
+
# Get specific knowledge base with details
|
|
1182
|
+
kb_detail = client.vendor_knowledgebases.get_knowledgebase_detail(
|
|
1183
|
+
vendor=VendorType.AWS,
|
|
1184
|
+
setting_id="setting-id",
|
|
1185
|
+
kb_id="kb-id"
|
|
1186
|
+
)
|
|
1187
|
+
```
|
|
1188
|
+
|
|
1189
|
+
4. **Install/Uninstall Knowledge Bases**
|
|
1190
|
+
```python
|
|
1191
|
+
from codemie_sdk.models.vendor_knowledgebase import VendorKnowledgeBaseInstallRequest
|
|
1192
|
+
|
|
1193
|
+
# Install knowledge base
|
|
1194
|
+
install_request = VendorKnowledgeBaseInstallRequest(
|
|
1195
|
+
kb_id="kb-id",
|
|
1196
|
+
project="project-name"
|
|
1197
|
+
)
|
|
1198
|
+
|
|
1199
|
+
response = client.vendor_knowledgebases.install_knowledgebase(
|
|
1200
|
+
vendor=VendorType.AWS,
|
|
1201
|
+
setting_id="setting-id",
|
|
1202
|
+
request=install_request
|
|
1203
|
+
)
|
|
1204
|
+
|
|
1205
|
+
# Uninstall knowledge base
|
|
1206
|
+
response = client.vendor_knowledgebases.uninstall_knowledgebase(
|
|
1207
|
+
vendor=VendorType.AWS,
|
|
1208
|
+
setting_id="setting-id",
|
|
1209
|
+
kb_id="kb-id"
|
|
1210
|
+
)
|
|
1211
|
+
```
|
|
1212
|
+
|
|
1213
|
+
#### Vendor Guardrail Service
|
|
1214
|
+
|
|
1215
|
+
Manage cloud vendor guardrails (AWS Bedrock Guardrails).
|
|
1216
|
+
|
|
1217
|
+
**Core Methods:**
|
|
1218
|
+
|
|
1219
|
+
1. **Get Guardrail Settings**
|
|
1220
|
+
```python
|
|
1221
|
+
# Get guardrail settings for a vendor
|
|
1222
|
+
settings = client.vendor_guardrails.get_guardrail_settings(
|
|
1223
|
+
vendor=VendorType.AWS,
|
|
1224
|
+
page=0,
|
|
1225
|
+
per_page=10
|
|
1226
|
+
)
|
|
1227
|
+
|
|
1228
|
+
# Check for invalid settings
|
|
1229
|
+
for setting in settings.data:
|
|
1230
|
+
if setting.invalid:
|
|
1231
|
+
print(f"Error: {setting.error}")
|
|
1232
|
+
```
|
|
1233
|
+
|
|
1234
|
+
2. **Get Guardrails**
|
|
1235
|
+
```python
|
|
1236
|
+
# Get guardrails for a specific setting
|
|
1237
|
+
guardrails = client.vendor_guardrails.get_guardrails(
|
|
1238
|
+
vendor=VendorType.AWS,
|
|
1239
|
+
setting_id="setting-id",
|
|
1240
|
+
per_page=10,
|
|
1241
|
+
next_token=None
|
|
1242
|
+
)
|
|
1243
|
+
```
|
|
1244
|
+
|
|
1245
|
+
3. **Get Guardrail Details and Versions**
|
|
1246
|
+
```python
|
|
1247
|
+
# Get specific guardrail
|
|
1248
|
+
guardrail = client.vendor_guardrails.get_guardrail(
|
|
1249
|
+
vendor=VendorType.AWS,
|
|
1250
|
+
setting_id="setting-id",
|
|
1251
|
+
guardrail_id="guardrail-id"
|
|
1252
|
+
)
|
|
1253
|
+
|
|
1254
|
+
# Get guardrail versions
|
|
1255
|
+
versions = client.vendor_guardrails.get_guardrail_versions(
|
|
1256
|
+
vendor=VendorType.AWS,
|
|
1257
|
+
setting_id="setting-id",
|
|
1258
|
+
guardrail_id="guardrail-id"
|
|
1259
|
+
)
|
|
752
1260
|
```
|
|
1261
|
+
|
|
1262
|
+
4. **Install/Uninstall Guardrails**
|
|
1263
|
+
```python
|
|
1264
|
+
from codemie_sdk.models.vendor_guardrail import VendorGuardrailInstallRequest
|
|
1265
|
+
|
|
1266
|
+
# Install guardrail
|
|
1267
|
+
install_request = VendorGuardrailInstallRequest(
|
|
1268
|
+
guardrail_id="guardrail-id",
|
|
1269
|
+
version="1.0",
|
|
1270
|
+
project="project-name"
|
|
1271
|
+
)
|
|
1272
|
+
|
|
1273
|
+
response = client.vendor_guardrails.install_guardrail(
|
|
1274
|
+
vendor=VendorType.AWS,
|
|
1275
|
+
setting_id="setting-id",
|
|
1276
|
+
request=install_request
|
|
1277
|
+
)
|
|
1278
|
+
|
|
1279
|
+
# Uninstall guardrail
|
|
1280
|
+
response = client.vendor_guardrails.uninstall_guardrail(
|
|
1281
|
+
vendor=VendorType.AWS,
|
|
1282
|
+
setting_id="setting-id",
|
|
1283
|
+
guardrail_id="guardrail-id"
|
|
1284
|
+
)
|
|
1285
|
+
```
|
|
1286
|
+
|
|
753
1287
|
## Error Handling
|
|
754
1288
|
|
|
755
1289
|
The SDK implements comprehensive error handling. All API calls may raise exceptions for:
|
|
@@ -832,108 +1366,39 @@ client = CodeMieClient(
|
|
|
832
1366
|
```
|
|
833
1367
|
|
|
834
1368
|
## Support
|
|
835
|
-
For providing credentials please contact AI/Run CodeMie Team: Vadym_Vlasenko@epam.com or Nikita_Levyankov@epam.com
|
|
836
|
-
|
|
837
|
-
## Running tests
|
|
838
|
-
|
|
839
|
-
For running tests on custom environment you should create .env file in the ./tests directory,
|
|
840
|
-
ask QA team: anton_yeromin@epam.com to provide all needed testing credentials. Under this directory there are stubs
|
|
841
|
-
for .env files for running tests on local and preview environments.
|
|
842
|
-
|
|
843
|
-
Configuration example:
|
|
844
|
-
|
|
845
|
-
``` properties
|
|
846
|
-
|
|
847
|
-
AUTH_SERVER_URL=https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth
|
|
848
|
-
AUTH_CLIENT_ID=codemie-preview
|
|
849
|
-
AUTH_CLIENT_SECRET=<auth_clienbt_secret>
|
|
850
|
-
AUTH_REALM_NAME=codemie-prod
|
|
851
|
-
CODEMIE_API_DOMAIN=http://localhost:8080
|
|
852
|
-
VERIFY_SSL=False
|
|
853
|
-
|
|
854
|
-
NATS_URL=nats://localhost:4222
|
|
855
|
-
|
|
856
|
-
ENV=local
|
|
857
|
-
CLEANUP_DATA=True
|
|
858
|
-
|
|
859
|
-
AUTH_USERNAME=<username>
|
|
860
|
-
AUTH_PASSWORD=<password>
|
|
861
|
-
TEST_USER_FULL_NAME=<user_full_name>
|
|
862
|
-
|
|
863
|
-
PROJECT_NAME=codemie
|
|
864
|
-
GIT_ENV=gitlab
|
|
865
|
-
|
|
866
|
-
DEFAULT_TIMEOUT=60
|
|
867
|
-
|
|
868
|
-
GITLAB_URL=https://gitbud.epam.com
|
|
869
|
-
GITLAB_TOKEN=<gitlab_token>
|
|
870
|
-
GITLAB_PROJECT=https://gitbud.epam.com/epm-cdme/autotests/codemie-test-project
|
|
871
|
-
GITLAB_PROJECT_ID=17889
|
|
872
1369
|
|
|
873
|
-
|
|
874
|
-
GITHUB_TOKEN=<github_token>
|
|
875
|
-
GITHUB_PROJECT=https://github.com/wild47/final_task
|
|
1370
|
+
For providing credentials please contact AI/Run CodeMie Team: Vadym_Vlasenko@epam.com or Nikita_Levyankov@epam.com
|
|
876
1371
|
|
|
877
|
-
|
|
878
|
-
JIRA_TOKEN=<jira_token>
|
|
879
|
-
JQL="project = 'EPMCDME' and issuetype = 'Epic' and status = 'Closed'"
|
|
1372
|
+
## Development
|
|
880
1373
|
|
|
881
|
-
|
|
882
|
-
CONFLUENCE_TOKEN=<confluence_token>
|
|
883
|
-
CQL="space = EPMCDME and type = page and title = 'AQA Backlog Estimation'"
|
|
1374
|
+
### Setup
|
|
884
1375
|
|
|
885
|
-
|
|
886
|
-
|
|
1376
|
+
```bash
|
|
1377
|
+
# Install dependencies
|
|
1378
|
+
poetry install
|
|
887
1379
|
|
|
888
|
-
|
|
1380
|
+
# Or using make
|
|
1381
|
+
make install
|
|
889
1382
|
```
|
|
890
1383
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
```shell
|
|
894
|
-
pytest -n 10 --reruns 2
|
|
895
|
-
```
|
|
1384
|
+
### Code Quality
|
|
896
1385
|
|
|
897
|
-
|
|
1386
|
+
```bash
|
|
1387
|
+
# Run linter (check and fix)
|
|
1388
|
+
make ruff
|
|
898
1389
|
|
|
899
|
-
|
|
900
|
-
|
|
1390
|
+
# Or manually
|
|
1391
|
+
poetry run ruff check --fix
|
|
1392
|
+
poetry run ruff format
|
|
901
1393
|
```
|
|
902
1394
|
|
|
903
|
-
|
|
1395
|
+
### Building Package
|
|
904
1396
|
|
|
905
|
-
|
|
1397
|
+
```bash
|
|
1398
|
+
# Build package
|
|
1399
|
+
poetry build
|
|
1400
|
+
# Or make build
|
|
906
1401
|
|
|
907
|
-
|
|
908
|
-
|
|
1402
|
+
# Publish to PyPI
|
|
1403
|
+
make publish
|
|
909
1404
|
```
|
|
910
|
-
and then
|
|
911
|
-
|
|
912
|
-
```shell
|
|
913
|
-
pytest -n 4 -m ui --reruns 2
|
|
914
|
-
```
|
|
915
|
-
|
|
916
|
-
All Playwright documentation can be found by the following link: https://playwright.dev/python/docs/intro
|
|
917
|
-
|
|
918
|
-
Run tests for e2e tests for specific integration/tool.
|
|
919
|
-
Available marks:
|
|
920
|
-
- jira_kb
|
|
921
|
-
- confluence_kb
|
|
922
|
-
- code_kb
|
|
923
|
-
- gitlab
|
|
924
|
-
- github
|
|
925
|
-
- git
|
|
926
|
-
|
|
927
|
-
```shell
|
|
928
|
-
pytest -n 10 -m "jira_kb or github" --reruns 2
|
|
929
|
-
```
|
|
930
|
-
|
|
931
|
-
In case you want to send test results in **ReportPortal** you should specify RP_API_KEY in .env and run tests like this:
|
|
932
|
-
|
|
933
|
-
```shell
|
|
934
|
-
pytest -n 10 -m "e2e or regression" --reruns 2 --reportportal
|
|
935
|
-
```
|
|
936
|
-
|
|
937
|
-
ReportPortal link is available by the following URL: https://report-portal.core.kuberocketci.io/ui/#epm-cdme/launches/all
|
|
938
|
-
|
|
939
|
-
If you do not have access to the project ask Anton Yeromin (anton_yeromin@epam.com) to add you.
|