codemie-sdk-python 0.1.191__tar.gz → 0.1.249__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.
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/PKG-INFO +146 -11
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/README.md +144 -9
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/pyproject.toml +2 -2
- codemie_sdk_python-0.1.249/src/codemie_sdk/__init__.py +135 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/client/client.py +43 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/assistant.py +61 -2
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/datasource.py +44 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/models/file_operation.py +25 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/integration.py +1 -1
- codemie_sdk_python-0.1.249/src/codemie_sdk/models/vendor_assistant.py +187 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/models/vendor_guardrail.py +152 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/models/vendor_knowledgebase.py +151 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/models/vendor_workflow.py +145 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/models/workflow_execution_payload.py +21 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/services/assistant.py +473 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/datasource.py +67 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/services/files.py +82 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/services/vendor_assistant.py +364 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/services/vendor_guardrail.py +375 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/services/vendor_knowledgebase.py +270 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/services/vendor_workflow.py +330 -0
- codemie_sdk_python-0.1.249/src/codemie_sdk/services/webhook.py +41 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/workflow.py +26 -2
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/workflow_execution.py +35 -6
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/utils/http.py +28 -8
- codemie_sdk_python-0.1.191/src/codemie_sdk/__init__.py +0 -23
- codemie_sdk_python-0.1.191/src/codemie_sdk/services/assistant.py +0 -254
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/auth/__init__.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/auth/credentials.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/client/__init__.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/exceptions.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/__init__.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/common.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/conversation.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/llm.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/task.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/user.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/workflow.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/workflow_state.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/workflow_thoughts.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/conversation.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/integration.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/llm.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/task.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/user.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/workflow_execution_state.py +0 -0
- {codemie_sdk_python-0.1.191 → codemie_sdk_python-0.1.249}/src/codemie_sdk/utils/__init__.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: codemie-sdk-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.249
|
|
4
4
|
Summary: CodeMie SDK for Python
|
|
5
5
|
Author: Vadym Vlasenko
|
|
6
6
|
Author-email: vadym_vlasenko@epam.com
|
|
7
7
|
Requires-Python: >=3.12,<4.0
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
-
Requires-Dist: pydantic (>=2.
|
|
10
|
+
Requires-Dist: pydantic (>=2.12.2,<3.0.0)
|
|
11
11
|
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
|
|
@@ -25,6 +25,7 @@ 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)
|
|
28
29
|
- [Datasource Service](#datasource-service)
|
|
29
30
|
- [Supported Datasource Types](#supported-datasource-types)
|
|
30
31
|
- [Core Methods](#core-methods-1)
|
|
@@ -43,6 +44,8 @@ Python SDK for CodeMie services. This SDK provides a comprehensive interface to
|
|
|
43
44
|
- [Workflow Status Monitoring](#workflow-status-monitoring)
|
|
44
45
|
- [Conversation Service](#conversation-service)
|
|
45
46
|
- [Core Methods](#core-methods-4)
|
|
47
|
+
- [Webhook Service](#webhook-service)
|
|
48
|
+
- [Core Methods](#core-methods-5)
|
|
46
49
|
- [Development](#development)
|
|
47
50
|
- [Setup](#setup)
|
|
48
51
|
- [Running Tests](#running-tests)
|
|
@@ -57,7 +60,7 @@ Python SDK for CodeMie services. This SDK provides a comprehensive interface to
|
|
|
57
60
|
## Installation
|
|
58
61
|
|
|
59
62
|
```sh
|
|
60
|
-
pip install codemie-sdk
|
|
63
|
+
pip install codemie-sdk-python
|
|
61
64
|
```
|
|
62
65
|
OR
|
|
63
66
|
```sh
|
|
@@ -172,16 +175,41 @@ result = client.assistant.delete("assistant-id")
|
|
|
172
175
|
|
|
173
176
|
#### Advanced Features
|
|
174
177
|
|
|
175
|
-
6. **Chat with Assistant**
|
|
178
|
+
6. **Chat with Assistant (with MCP header propagation)**
|
|
176
179
|
```python
|
|
177
180
|
from codemie_sdk.models.assistant import AssistantChatRequest
|
|
178
181
|
|
|
179
182
|
chat_request = AssistantChatRequest(
|
|
180
183
|
text="Your message here",
|
|
181
184
|
stream=False, # Set to True for streaming response
|
|
182
|
-
#
|
|
185
|
+
propagate_headers=True, # Enable propagation of X-* headers to MCP servers
|
|
186
|
+
)
|
|
187
|
+
# Pass X-* headers to forward to MCP servers
|
|
188
|
+
response = client.assistant.chat(
|
|
189
|
+
"assistant-id",
|
|
190
|
+
chat_request,
|
|
191
|
+
headers={
|
|
192
|
+
"X-Tenant-ID": "tenant-abc-123",
|
|
193
|
+
"X-User-ID": "user-456",
|
|
194
|
+
"X-Request-ID": "req-123",
|
|
195
|
+
},
|
|
196
|
+
)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
6.a. **Chat with Assistant by slug (with MCP header propagation)**
|
|
200
|
+
```python
|
|
201
|
+
chat_request = AssistantChatRequest(
|
|
202
|
+
text="Your message here",
|
|
203
|
+
propagate_headers=True,
|
|
204
|
+
)
|
|
205
|
+
response = client.assistants.chat_by_slug(
|
|
206
|
+
"assistant-slug",
|
|
207
|
+
chat_request,
|
|
208
|
+
headers={
|
|
209
|
+
"X-Environment": "production",
|
|
210
|
+
"X-Feature-Flag-Beta": "true",
|
|
211
|
+
},
|
|
183
212
|
)
|
|
184
|
-
response = client.assistant.chat("assistant-id", chat_request)
|
|
185
213
|
```
|
|
186
214
|
|
|
187
215
|
7. **Utilize structured outputs with Assistant**
|
|
@@ -241,6 +269,42 @@ prebuilt_assistant = client.assistant.get_prebuilt_by_slug("assistant-slug")
|
|
|
241
269
|
tools = client.assistant.get_tools()
|
|
242
270
|
```
|
|
243
271
|
|
|
272
|
+
### Prompt Variables Support
|
|
273
|
+
The SDK supports assistant-level prompt variables that the backend already exposes via the `prompt_variables` field.
|
|
274
|
+
|
|
275
|
+
Create and update an assistant with prompt variables:
|
|
276
|
+
```python
|
|
277
|
+
from codemie_sdk.models.assistant import AssistantCreateRequest, AssistantUpdateRequest, PromptVariable
|
|
278
|
+
|
|
279
|
+
# Create
|
|
280
|
+
create_req = AssistantCreateRequest(
|
|
281
|
+
name="My Assistant",
|
|
282
|
+
description="Assistant description",
|
|
283
|
+
system_prompt="Instructions. Use {{project_name}} in responses.",
|
|
284
|
+
toolkits=[],
|
|
285
|
+
project="my_project",
|
|
286
|
+
llm_model_type="gpt-4o",
|
|
287
|
+
context=[],
|
|
288
|
+
conversation_starters=[],
|
|
289
|
+
mcp_servers=[],
|
|
290
|
+
assistant_ids=[],
|
|
291
|
+
prompt_variables=[
|
|
292
|
+
PromptVariable(key="project_name", default_value="Delta", description="Current project"),
|
|
293
|
+
PromptVariable(key="region", default_value="eu"),
|
|
294
|
+
],
|
|
295
|
+
)
|
|
296
|
+
client.assistants.create(create_req)
|
|
297
|
+
|
|
298
|
+
# Update
|
|
299
|
+
update_req = AssistantUpdateRequest(
|
|
300
|
+
**create_req.model_dump(),
|
|
301
|
+
prompt_variables=[
|
|
302
|
+
PromptVariable(key="project_name", default_value="Delta-Updated"),
|
|
303
|
+
PromptVariable(key="region", default_value="us"),
|
|
304
|
+
],
|
|
305
|
+
)
|
|
306
|
+
client.assistants.update("assistant-id", update_req)
|
|
307
|
+
|
|
244
308
|
### Datasource Service
|
|
245
309
|
|
|
246
310
|
The Datasource service enables managing various types of data sources in CodeMie, including code repositories, Confluence spaces, Jira projects, files, and Google documents.
|
|
@@ -546,10 +610,18 @@ result = client.workflow.delete("workflow-id")
|
|
|
546
610
|
|
|
547
611
|
The SDK provides comprehensive workflow execution management through the WorkflowExecutionService:
|
|
548
612
|
|
|
549
|
-
1. **Run Workflow**
|
|
613
|
+
1. **Run Workflow (with MCP header propagation)**
|
|
550
614
|
```python
|
|
551
|
-
#
|
|
552
|
-
execution = client.workflow.run(
|
|
615
|
+
# Enable propagation in payload and pass X-* headers to forward to MCP servers
|
|
616
|
+
execution = client.workflow.run(
|
|
617
|
+
"workflow-id",
|
|
618
|
+
user_input="optional input",
|
|
619
|
+
propagate_headers=True,
|
|
620
|
+
headers={
|
|
621
|
+
"X-Request-ID": "req-abc-123",
|
|
622
|
+
"X-Source-App": "analytics-ui",
|
|
623
|
+
},
|
|
624
|
+
)
|
|
553
625
|
|
|
554
626
|
# Get execution service for advanced operations
|
|
555
627
|
execution_service = client.workflow.executions("workflow-id")
|
|
@@ -569,8 +641,14 @@ execution = execution_service.get("execution-id")
|
|
|
569
641
|
# Abort running execution
|
|
570
642
|
result = execution_service.abort("execution-id")
|
|
571
643
|
|
|
572
|
-
# Resume interrupted execution
|
|
573
|
-
result = execution_service.resume(
|
|
644
|
+
# Resume interrupted execution with header propagation (query param + headers)
|
|
645
|
+
result = execution_service.resume(
|
|
646
|
+
"execution-id",
|
|
647
|
+
propagate_headers=True,
|
|
648
|
+
headers={
|
|
649
|
+
"X-Correlation-ID": "corr-456",
|
|
650
|
+
},
|
|
651
|
+
)
|
|
574
652
|
|
|
575
653
|
# Delete all executions
|
|
576
654
|
result = execution_service.delete_all()
|
|
@@ -735,6 +813,19 @@ client.conversations.list_by_assistant_id("assistant-id")
|
|
|
735
813
|
client.conversations.delete("conversation-id")
|
|
736
814
|
```
|
|
737
815
|
|
|
816
|
+
|
|
817
|
+
### Webhook Service
|
|
818
|
+
|
|
819
|
+
The Webhook service provides access to trigger available webhook in CodeMie.
|
|
820
|
+
|
|
821
|
+
#### Core Methods
|
|
822
|
+
|
|
823
|
+
1. **Get All Conversations**
|
|
824
|
+
```python
|
|
825
|
+
# Trigger assistant/workflow/datasource by it's ID
|
|
826
|
+
# Data - body of the post method
|
|
827
|
+
response = client.webhook.trigger("resource_id", "data")
|
|
828
|
+
```
|
|
738
829
|
## Error Handling
|
|
739
830
|
|
|
740
831
|
The SDK implements comprehensive error handling. All API calls may raise exceptions for:
|
|
@@ -816,6 +907,50 @@ client = CodeMieClient(
|
|
|
816
907
|
)
|
|
817
908
|
```
|
|
818
909
|
|
|
910
|
+
### Assistant Versioning via SDK
|
|
911
|
+
|
|
912
|
+
The Python SDK exposes full assistant versioning capabilities delivered in EPMCDME-8285.
|
|
913
|
+
|
|
914
|
+
- List versions
|
|
915
|
+
```python
|
|
916
|
+
versions = client.assistants.list_versions("assistant-id", page=0, per_page=20)
|
|
917
|
+
print([v.version_number for v in versions])
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
- Get specific version
|
|
921
|
+
```python
|
|
922
|
+
version = client.assistants.get_version("assistant-id", 2)
|
|
923
|
+
print(version.system_prompt)
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
- Compare two versions
|
|
927
|
+
```python
|
|
928
|
+
from codemie_sdk.models.assistant import AssistantVersionDiff
|
|
929
|
+
|
|
930
|
+
diff: AssistantVersionDiff = client.assistants.compare_versions("assistant-id", 1, 3)
|
|
931
|
+
print(diff.summary)
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
- Rollback to a version
|
|
935
|
+
```python
|
|
936
|
+
resp = client.assistants.rollback_to_version("assistant-id", 2)
|
|
937
|
+
print(resp)
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
- Chat with a specific version
|
|
941
|
+
```python
|
|
942
|
+
from codemie_sdk.models.assistant import AssistantChatRequest
|
|
943
|
+
|
|
944
|
+
req = AssistantChatRequest(text="Hi", stream=False)
|
|
945
|
+
resp = client.assistants.chat_with_version("assistant-id", 2, req)
|
|
946
|
+
print(resp.generated)
|
|
947
|
+
```
|
|
948
|
+
|
|
949
|
+
Quick CLI example
|
|
950
|
+
```bash
|
|
951
|
+
python codemie-sdk/examples/assistant_versions.py <assistant_id> [version_number]
|
|
952
|
+
```
|
|
953
|
+
|
|
819
954
|
## Support
|
|
820
955
|
For providing credentials please contact AI/Run CodeMie Team: Vadym_Vlasenko@epam.com or Nikita_Levyankov@epam.com
|
|
821
956
|
|
|
@@ -12,6 +12,7 @@ Python SDK for CodeMie services. This SDK provides a comprehensive interface to
|
|
|
12
12
|
- [Assistant Service](#assistant-service)
|
|
13
13
|
- [Core Methods](#core-methods)
|
|
14
14
|
- [Advanced Features](#advanced-features)
|
|
15
|
+
- [Prompt Variables Support](#prompt-variables-support)
|
|
15
16
|
- [Datasource Service](#datasource-service)
|
|
16
17
|
- [Supported Datasource Types](#supported-datasource-types)
|
|
17
18
|
- [Core Methods](#core-methods-1)
|
|
@@ -30,6 +31,8 @@ Python SDK for CodeMie services. This SDK provides a comprehensive interface to
|
|
|
30
31
|
- [Workflow Status Monitoring](#workflow-status-monitoring)
|
|
31
32
|
- [Conversation Service](#conversation-service)
|
|
32
33
|
- [Core Methods](#core-methods-4)
|
|
34
|
+
- [Webhook Service](#webhook-service)
|
|
35
|
+
- [Core Methods](#core-methods-5)
|
|
33
36
|
- [Development](#development)
|
|
34
37
|
- [Setup](#setup)
|
|
35
38
|
- [Running Tests](#running-tests)
|
|
@@ -44,7 +47,7 @@ Python SDK for CodeMie services. This SDK provides a comprehensive interface to
|
|
|
44
47
|
## Installation
|
|
45
48
|
|
|
46
49
|
```sh
|
|
47
|
-
pip install codemie-sdk
|
|
50
|
+
pip install codemie-sdk-python
|
|
48
51
|
```
|
|
49
52
|
OR
|
|
50
53
|
```sh
|
|
@@ -159,16 +162,41 @@ result = client.assistant.delete("assistant-id")
|
|
|
159
162
|
|
|
160
163
|
#### Advanced Features
|
|
161
164
|
|
|
162
|
-
6. **Chat with Assistant**
|
|
165
|
+
6. **Chat with Assistant (with MCP header propagation)**
|
|
163
166
|
```python
|
|
164
167
|
from codemie_sdk.models.assistant import AssistantChatRequest
|
|
165
168
|
|
|
166
169
|
chat_request = AssistantChatRequest(
|
|
167
170
|
text="Your message here",
|
|
168
171
|
stream=False, # Set to True for streaming response
|
|
169
|
-
#
|
|
172
|
+
propagate_headers=True, # Enable propagation of X-* headers to MCP servers
|
|
173
|
+
)
|
|
174
|
+
# Pass X-* headers to forward to MCP servers
|
|
175
|
+
response = client.assistant.chat(
|
|
176
|
+
"assistant-id",
|
|
177
|
+
chat_request,
|
|
178
|
+
headers={
|
|
179
|
+
"X-Tenant-ID": "tenant-abc-123",
|
|
180
|
+
"X-User-ID": "user-456",
|
|
181
|
+
"X-Request-ID": "req-123",
|
|
182
|
+
},
|
|
183
|
+
)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
6.a. **Chat with Assistant by slug (with MCP header propagation)**
|
|
187
|
+
```python
|
|
188
|
+
chat_request = AssistantChatRequest(
|
|
189
|
+
text="Your message here",
|
|
190
|
+
propagate_headers=True,
|
|
191
|
+
)
|
|
192
|
+
response = client.assistants.chat_by_slug(
|
|
193
|
+
"assistant-slug",
|
|
194
|
+
chat_request,
|
|
195
|
+
headers={
|
|
196
|
+
"X-Environment": "production",
|
|
197
|
+
"X-Feature-Flag-Beta": "true",
|
|
198
|
+
},
|
|
170
199
|
)
|
|
171
|
-
response = client.assistant.chat("assistant-id", chat_request)
|
|
172
200
|
```
|
|
173
201
|
|
|
174
202
|
7. **Utilize structured outputs with Assistant**
|
|
@@ -228,6 +256,42 @@ prebuilt_assistant = client.assistant.get_prebuilt_by_slug("assistant-slug")
|
|
|
228
256
|
tools = client.assistant.get_tools()
|
|
229
257
|
```
|
|
230
258
|
|
|
259
|
+
### Prompt Variables Support
|
|
260
|
+
The SDK supports assistant-level prompt variables that the backend already exposes via the `prompt_variables` field.
|
|
261
|
+
|
|
262
|
+
Create and update an assistant with prompt variables:
|
|
263
|
+
```python
|
|
264
|
+
from codemie_sdk.models.assistant import AssistantCreateRequest, AssistantUpdateRequest, PromptVariable
|
|
265
|
+
|
|
266
|
+
# Create
|
|
267
|
+
create_req = AssistantCreateRequest(
|
|
268
|
+
name="My Assistant",
|
|
269
|
+
description="Assistant description",
|
|
270
|
+
system_prompt="Instructions. Use {{project_name}} in responses.",
|
|
271
|
+
toolkits=[],
|
|
272
|
+
project="my_project",
|
|
273
|
+
llm_model_type="gpt-4o",
|
|
274
|
+
context=[],
|
|
275
|
+
conversation_starters=[],
|
|
276
|
+
mcp_servers=[],
|
|
277
|
+
assistant_ids=[],
|
|
278
|
+
prompt_variables=[
|
|
279
|
+
PromptVariable(key="project_name", default_value="Delta", description="Current project"),
|
|
280
|
+
PromptVariable(key="region", default_value="eu"),
|
|
281
|
+
],
|
|
282
|
+
)
|
|
283
|
+
client.assistants.create(create_req)
|
|
284
|
+
|
|
285
|
+
# Update
|
|
286
|
+
update_req = AssistantUpdateRequest(
|
|
287
|
+
**create_req.model_dump(),
|
|
288
|
+
prompt_variables=[
|
|
289
|
+
PromptVariable(key="project_name", default_value="Delta-Updated"),
|
|
290
|
+
PromptVariable(key="region", default_value="us"),
|
|
291
|
+
],
|
|
292
|
+
)
|
|
293
|
+
client.assistants.update("assistant-id", update_req)
|
|
294
|
+
|
|
231
295
|
### Datasource Service
|
|
232
296
|
|
|
233
297
|
The Datasource service enables managing various types of data sources in CodeMie, including code repositories, Confluence spaces, Jira projects, files, and Google documents.
|
|
@@ -533,10 +597,18 @@ result = client.workflow.delete("workflow-id")
|
|
|
533
597
|
|
|
534
598
|
The SDK provides comprehensive workflow execution management through the WorkflowExecutionService:
|
|
535
599
|
|
|
536
|
-
1. **Run Workflow**
|
|
600
|
+
1. **Run Workflow (with MCP header propagation)**
|
|
537
601
|
```python
|
|
538
|
-
#
|
|
539
|
-
execution = client.workflow.run(
|
|
602
|
+
# Enable propagation in payload and pass X-* headers to forward to MCP servers
|
|
603
|
+
execution = client.workflow.run(
|
|
604
|
+
"workflow-id",
|
|
605
|
+
user_input="optional input",
|
|
606
|
+
propagate_headers=True,
|
|
607
|
+
headers={
|
|
608
|
+
"X-Request-ID": "req-abc-123",
|
|
609
|
+
"X-Source-App": "analytics-ui",
|
|
610
|
+
},
|
|
611
|
+
)
|
|
540
612
|
|
|
541
613
|
# Get execution service for advanced operations
|
|
542
614
|
execution_service = client.workflow.executions("workflow-id")
|
|
@@ -556,8 +628,14 @@ execution = execution_service.get("execution-id")
|
|
|
556
628
|
# Abort running execution
|
|
557
629
|
result = execution_service.abort("execution-id")
|
|
558
630
|
|
|
559
|
-
# Resume interrupted execution
|
|
560
|
-
result = execution_service.resume(
|
|
631
|
+
# Resume interrupted execution with header propagation (query param + headers)
|
|
632
|
+
result = execution_service.resume(
|
|
633
|
+
"execution-id",
|
|
634
|
+
propagate_headers=True,
|
|
635
|
+
headers={
|
|
636
|
+
"X-Correlation-ID": "corr-456",
|
|
637
|
+
},
|
|
638
|
+
)
|
|
561
639
|
|
|
562
640
|
# Delete all executions
|
|
563
641
|
result = execution_service.delete_all()
|
|
@@ -722,6 +800,19 @@ client.conversations.list_by_assistant_id("assistant-id")
|
|
|
722
800
|
client.conversations.delete("conversation-id")
|
|
723
801
|
```
|
|
724
802
|
|
|
803
|
+
|
|
804
|
+
### Webhook Service
|
|
805
|
+
|
|
806
|
+
The Webhook service provides access to trigger available webhook in CodeMie.
|
|
807
|
+
|
|
808
|
+
#### Core Methods
|
|
809
|
+
|
|
810
|
+
1. **Get All Conversations**
|
|
811
|
+
```python
|
|
812
|
+
# Trigger assistant/workflow/datasource by it's ID
|
|
813
|
+
# Data - body of the post method
|
|
814
|
+
response = client.webhook.trigger("resource_id", "data")
|
|
815
|
+
```
|
|
725
816
|
## Error Handling
|
|
726
817
|
|
|
727
818
|
The SDK implements comprehensive error handling. All API calls may raise exceptions for:
|
|
@@ -803,6 +894,50 @@ client = CodeMieClient(
|
|
|
803
894
|
)
|
|
804
895
|
```
|
|
805
896
|
|
|
897
|
+
### Assistant Versioning via SDK
|
|
898
|
+
|
|
899
|
+
The Python SDK exposes full assistant versioning capabilities delivered in EPMCDME-8285.
|
|
900
|
+
|
|
901
|
+
- List versions
|
|
902
|
+
```python
|
|
903
|
+
versions = client.assistants.list_versions("assistant-id", page=0, per_page=20)
|
|
904
|
+
print([v.version_number for v in versions])
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
- Get specific version
|
|
908
|
+
```python
|
|
909
|
+
version = client.assistants.get_version("assistant-id", 2)
|
|
910
|
+
print(version.system_prompt)
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
- Compare two versions
|
|
914
|
+
```python
|
|
915
|
+
from codemie_sdk.models.assistant import AssistantVersionDiff
|
|
916
|
+
|
|
917
|
+
diff: AssistantVersionDiff = client.assistants.compare_versions("assistant-id", 1, 3)
|
|
918
|
+
print(diff.summary)
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
- Rollback to a version
|
|
922
|
+
```python
|
|
923
|
+
resp = client.assistants.rollback_to_version("assistant-id", 2)
|
|
924
|
+
print(resp)
|
|
925
|
+
```
|
|
926
|
+
|
|
927
|
+
- Chat with a specific version
|
|
928
|
+
```python
|
|
929
|
+
from codemie_sdk.models.assistant import AssistantChatRequest
|
|
930
|
+
|
|
931
|
+
req = AssistantChatRequest(text="Hi", stream=False)
|
|
932
|
+
resp = client.assistants.chat_with_version("assistant-id", 2, req)
|
|
933
|
+
print(resp.generated)
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
Quick CLI example
|
|
937
|
+
```bash
|
|
938
|
+
python codemie-sdk/examples/assistant_versions.py <assistant_id> [version_number]
|
|
939
|
+
```
|
|
940
|
+
|
|
806
941
|
## Support
|
|
807
942
|
For providing credentials please contact AI/Run CodeMie Team: Vadym_Vlasenko@epam.com or Nikita_Levyankov@epam.com
|
|
808
943
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "codemie-sdk-python"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.249"
|
|
4
4
|
description = "CodeMie SDK for Python"
|
|
5
5
|
authors = [
|
|
6
6
|
"Vadym Vlasenko <vadym_vlasenko@epam.com>",
|
|
@@ -13,7 +13,7 @@ packages = [
|
|
|
13
13
|
[tool.poetry.dependencies]
|
|
14
14
|
python = "^3.12"
|
|
15
15
|
requests = "^2.31.0"
|
|
16
|
-
pydantic = "^2.
|
|
16
|
+
pydantic = "^2.12.2"
|
|
17
17
|
|
|
18
18
|
[tool.poetry.group.dev.dependencies]
|
|
19
19
|
ruff = "^0.11.3"
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CodeMie SDK for Python
|
|
3
|
+
~~~~~~~~~~~~~~~~~~~~~
|
|
4
|
+
|
|
5
|
+
A Python SDK for interacting with CodeMie API.
|
|
6
|
+
|
|
7
|
+
Basic usage:
|
|
8
|
+
|
|
9
|
+
>>> from codemie_sdk import CodeMieClient
|
|
10
|
+
>>> client = CodeMieClient(
|
|
11
|
+
... auth_server_url="https://auth.example.com",
|
|
12
|
+
... auth_client_id="client_id",
|
|
13
|
+
... auth_client_secret="secret",
|
|
14
|
+
... auth_realm_name="realm",
|
|
15
|
+
... codemie_api_domain="api.codemie.com"
|
|
16
|
+
... )
|
|
17
|
+
>>> assistants = client.assistants.list()
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from .client.client import CodeMieClient
|
|
21
|
+
from .models.vendor_assistant import (
|
|
22
|
+
VendorType,
|
|
23
|
+
VendorAssistantSetting,
|
|
24
|
+
VendorAssistantSettingsResponse,
|
|
25
|
+
VendorAssistant,
|
|
26
|
+
VendorAssistantVersion,
|
|
27
|
+
VendorAssistantStatus,
|
|
28
|
+
VendorAssistantsResponse,
|
|
29
|
+
VendorAssistantAlias,
|
|
30
|
+
VendorAssistantAliasesResponse,
|
|
31
|
+
VendorAssistantInstallRequest,
|
|
32
|
+
VendorAssistantInstallSummary,
|
|
33
|
+
VendorAssistantInstallResponse,
|
|
34
|
+
VendorAssistantUninstallResponse,
|
|
35
|
+
PaginationInfo,
|
|
36
|
+
TokenPagination,
|
|
37
|
+
)
|
|
38
|
+
from .models.vendor_workflow import (
|
|
39
|
+
VendorWorkflowSetting,
|
|
40
|
+
VendorWorkflowSettingsResponse,
|
|
41
|
+
VendorWorkflow,
|
|
42
|
+
VendorWorkflowStatus,
|
|
43
|
+
VendorWorkflowsResponse,
|
|
44
|
+
VendorWorkflowAlias,
|
|
45
|
+
VendorWorkflowAliasesResponse,
|
|
46
|
+
VendorWorkflowInstallRequest,
|
|
47
|
+
VendorWorkflowInstallSummary,
|
|
48
|
+
VendorWorkflowInstallResponse,
|
|
49
|
+
VendorWorkflowUninstallResponse,
|
|
50
|
+
)
|
|
51
|
+
from .models.vendor_knowledgebase import (
|
|
52
|
+
VendorKnowledgeBaseSetting,
|
|
53
|
+
VendorKnowledgeBaseSettingsResponse,
|
|
54
|
+
VendorKnowledgeBase,
|
|
55
|
+
VendorKnowledgeBaseStatus,
|
|
56
|
+
VendorKnowledgeBasesResponse,
|
|
57
|
+
VendorKnowledgeBaseDetail,
|
|
58
|
+
VendorKnowledgeBaseInstallRequest,
|
|
59
|
+
VendorKnowledgeBaseInstallSummary,
|
|
60
|
+
VendorKnowledgeBaseInstallResponse,
|
|
61
|
+
VendorKnowledgeBaseUninstallResponse,
|
|
62
|
+
)
|
|
63
|
+
from .models.vendor_guardrail import (
|
|
64
|
+
VendorGuardrailSetting,
|
|
65
|
+
VendorGuardrailSettingsResponse,
|
|
66
|
+
VendorGuardrail,
|
|
67
|
+
VendorGuardrailStatus,
|
|
68
|
+
VendorGuardrailsResponse,
|
|
69
|
+
VendorGuardrailVersion,
|
|
70
|
+
VendorGuardrailVersionsResponse,
|
|
71
|
+
VendorGuardrailInstallRequest,
|
|
72
|
+
VendorGuardrailInstallSummary,
|
|
73
|
+
VendorGuardrailInstallResponse,
|
|
74
|
+
VendorGuardrailUninstallResponse,
|
|
75
|
+
)
|
|
76
|
+
from .services.vendor_assistant import VendorAssistantService
|
|
77
|
+
from .services.vendor_workflow import VendorWorkflowService
|
|
78
|
+
from .services.vendor_knowledgebase import VendorKnowledgeBaseService
|
|
79
|
+
from .services.vendor_guardrail import VendorGuardrailService
|
|
80
|
+
|
|
81
|
+
__version__ = "0.2.12"
|
|
82
|
+
__all__ = [
|
|
83
|
+
"CodeMieClient",
|
|
84
|
+
"VendorType",
|
|
85
|
+
"VendorAssistantSetting",
|
|
86
|
+
"VendorAssistantSettingsResponse",
|
|
87
|
+
"VendorAssistant",
|
|
88
|
+
"VendorAssistantVersion",
|
|
89
|
+
"VendorAssistantStatus",
|
|
90
|
+
"VendorAssistantsResponse",
|
|
91
|
+
"VendorAssistantAlias",
|
|
92
|
+
"VendorAssistantAliasesResponse",
|
|
93
|
+
"VendorAssistantInstallRequest",
|
|
94
|
+
"VendorAssistantInstallSummary",
|
|
95
|
+
"VendorAssistantInstallResponse",
|
|
96
|
+
"VendorAssistantUninstallResponse",
|
|
97
|
+
"PaginationInfo",
|
|
98
|
+
"TokenPagination",
|
|
99
|
+
"VendorAssistantService",
|
|
100
|
+
"VendorWorkflowSetting",
|
|
101
|
+
"VendorWorkflowSettingsResponse",
|
|
102
|
+
"VendorWorkflow",
|
|
103
|
+
"VendorWorkflowStatus",
|
|
104
|
+
"VendorWorkflowsResponse",
|
|
105
|
+
"VendorWorkflowAlias",
|
|
106
|
+
"VendorWorkflowAliasesResponse",
|
|
107
|
+
"VendorWorkflowInstallRequest",
|
|
108
|
+
"VendorWorkflowInstallSummary",
|
|
109
|
+
"VendorWorkflowInstallResponse",
|
|
110
|
+
"VendorWorkflowUninstallResponse",
|
|
111
|
+
"VendorWorkflowService",
|
|
112
|
+
"VendorKnowledgeBaseSetting",
|
|
113
|
+
"VendorKnowledgeBaseSettingsResponse",
|
|
114
|
+
"VendorKnowledgeBase",
|
|
115
|
+
"VendorKnowledgeBaseStatus",
|
|
116
|
+
"VendorKnowledgeBasesResponse",
|
|
117
|
+
"VendorKnowledgeBaseDetail",
|
|
118
|
+
"VendorKnowledgeBaseInstallRequest",
|
|
119
|
+
"VendorKnowledgeBaseInstallSummary",
|
|
120
|
+
"VendorKnowledgeBaseInstallResponse",
|
|
121
|
+
"VendorKnowledgeBaseUninstallResponse",
|
|
122
|
+
"VendorKnowledgeBaseService",
|
|
123
|
+
"VendorGuardrailSetting",
|
|
124
|
+
"VendorGuardrailSettingsResponse",
|
|
125
|
+
"VendorGuardrail",
|
|
126
|
+
"VendorGuardrailStatus",
|
|
127
|
+
"VendorGuardrailsResponse",
|
|
128
|
+
"VendorGuardrailVersion",
|
|
129
|
+
"VendorGuardrailVersionsResponse",
|
|
130
|
+
"VendorGuardrailInstallRequest",
|
|
131
|
+
"VendorGuardrailInstallSummary",
|
|
132
|
+
"VendorGuardrailInstallResponse",
|
|
133
|
+
"VendorGuardrailUninstallResponse",
|
|
134
|
+
"VendorGuardrailService",
|
|
135
|
+
]
|
|
@@ -11,6 +11,12 @@ from ..services.integration import IntegrationService
|
|
|
11
11
|
from ..services.task import TaskService
|
|
12
12
|
from ..services.user import UserService
|
|
13
13
|
from ..services.workflow import WorkflowService
|
|
14
|
+
from ..services.files import FileOperationService
|
|
15
|
+
from ..services.webhook import WebhookService
|
|
16
|
+
from ..services.vendor_assistant import VendorAssistantService
|
|
17
|
+
from ..services.vendor_workflow import VendorWorkflowService
|
|
18
|
+
from ..services.vendor_knowledgebase import VendorKnowledgeBaseService
|
|
19
|
+
from ..services.vendor_guardrail import VendorGuardrailService
|
|
14
20
|
|
|
15
21
|
|
|
16
22
|
class CodeMieClient:
|
|
@@ -81,6 +87,24 @@ class CodeMieClient:
|
|
|
81
87
|
self.conversations = ConversationService(
|
|
82
88
|
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
83
89
|
)
|
|
90
|
+
self.files = FileOperationService(
|
|
91
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
92
|
+
)
|
|
93
|
+
self.webhook = WebhookService(
|
|
94
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
95
|
+
)
|
|
96
|
+
self.vendor_assistants = VendorAssistantService(
|
|
97
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
98
|
+
)
|
|
99
|
+
self.vendor_workflows = VendorWorkflowService(
|
|
100
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
101
|
+
)
|
|
102
|
+
self.vendor_knowledgebases = VendorKnowledgeBaseService(
|
|
103
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
104
|
+
)
|
|
105
|
+
self.vendor_guardrails = VendorGuardrailService(
|
|
106
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
107
|
+
)
|
|
84
108
|
|
|
85
109
|
@property
|
|
86
110
|
def token(self) -> str:
|
|
@@ -96,6 +120,7 @@ class CodeMieClient:
|
|
|
96
120
|
"localhost",
|
|
97
121
|
"127.0.0.1",
|
|
98
122
|
"0.0.0.0",
|
|
123
|
+
"192.168",
|
|
99
124
|
]
|
|
100
125
|
return any(pattern in domain_lower for pattern in localhost_patterns)
|
|
101
126
|
|
|
@@ -127,4 +152,22 @@ class CodeMieClient:
|
|
|
127
152
|
self.conversations = ConversationService(
|
|
128
153
|
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
129
154
|
)
|
|
155
|
+
self.files = FileOperationService(
|
|
156
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
157
|
+
)
|
|
158
|
+
self.webhook = WebhookService(
|
|
159
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
160
|
+
)
|
|
161
|
+
self.vendor_assistants = VendorAssistantService(
|
|
162
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
163
|
+
)
|
|
164
|
+
self.vendor_workflows = VendorWorkflowService(
|
|
165
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
166
|
+
)
|
|
167
|
+
self.vendor_knowledgebases = VendorKnowledgeBaseService(
|
|
168
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
169
|
+
)
|
|
170
|
+
self.vendor_guardrails = VendorGuardrailService(
|
|
171
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
172
|
+
)
|
|
130
173
|
return self._token
|