codemie-sdk-python 0.1.218__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.218 → codemie_sdk_python-0.1.249}/PKG-INFO +129 -9
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/README.md +128 -8
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/pyproject.toml +1 -1
- codemie_sdk_python-0.1.249/src/codemie_sdk/__init__.py +135 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/client/client.py +35 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/assistant.py +53 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/datasource.py +44 -0
- {codemie_sdk_python-0.1.218 → 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.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/workflow_execution_payload.py +6 -2
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/assistant.py +214 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/datasource.py +67 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/files.py +21 -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.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/workflow.py +10 -1
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/workflow_execution.py +26 -4
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/utils/http.py +21 -7
- codemie_sdk_python-0.1.218/src/codemie_sdk/__init__.py +0 -23
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/auth/__init__.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/auth/credentials.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/client/__init__.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/exceptions.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/__init__.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/common.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/conversation.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/file_operation.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/llm.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/task.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/user.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/workflow.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/workflow_state.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/workflow_thoughts.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/conversation.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/integration.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/llm.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/task.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/user.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/webhook.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/services/workflow_execution_state.py +0 -0
- {codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/utils/__init__.py +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.249
|
|
4
4
|
Summary: CodeMie SDK for Python
|
|
5
5
|
Author: Vadym Vlasenko
|
|
6
6
|
Author-email: vadym_vlasenko@epam.com
|
|
@@ -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)
|
|
@@ -174,16 +175,41 @@ result = client.assistant.delete("assistant-id")
|
|
|
174
175
|
|
|
175
176
|
#### Advanced Features
|
|
176
177
|
|
|
177
|
-
6. **Chat with Assistant**
|
|
178
|
+
6. **Chat with Assistant (with MCP header propagation)**
|
|
178
179
|
```python
|
|
179
180
|
from codemie_sdk.models.assistant import AssistantChatRequest
|
|
180
181
|
|
|
181
182
|
chat_request = AssistantChatRequest(
|
|
182
183
|
text="Your message here",
|
|
183
184
|
stream=False, # Set to True for streaming response
|
|
184
|
-
#
|
|
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
|
+
},
|
|
185
212
|
)
|
|
186
|
-
response = client.assistant.chat("assistant-id", chat_request)
|
|
187
213
|
```
|
|
188
214
|
|
|
189
215
|
7. **Utilize structured outputs with Assistant**
|
|
@@ -243,6 +269,42 @@ prebuilt_assistant = client.assistant.get_prebuilt_by_slug("assistant-slug")
|
|
|
243
269
|
tools = client.assistant.get_tools()
|
|
244
270
|
```
|
|
245
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
|
+
|
|
246
308
|
### Datasource Service
|
|
247
309
|
|
|
248
310
|
The Datasource service enables managing various types of data sources in CodeMie, including code repositories, Confluence spaces, Jira projects, files, and Google documents.
|
|
@@ -548,10 +610,18 @@ result = client.workflow.delete("workflow-id")
|
|
|
548
610
|
|
|
549
611
|
The SDK provides comprehensive workflow execution management through the WorkflowExecutionService:
|
|
550
612
|
|
|
551
|
-
1. **Run Workflow**
|
|
613
|
+
1. **Run Workflow (with MCP header propagation)**
|
|
552
614
|
```python
|
|
553
|
-
#
|
|
554
|
-
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
|
+
)
|
|
555
625
|
|
|
556
626
|
# Get execution service for advanced operations
|
|
557
627
|
execution_service = client.workflow.executions("workflow-id")
|
|
@@ -571,8 +641,14 @@ execution = execution_service.get("execution-id")
|
|
|
571
641
|
# Abort running execution
|
|
572
642
|
result = execution_service.abort("execution-id")
|
|
573
643
|
|
|
574
|
-
# Resume interrupted execution
|
|
575
|
-
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
|
+
)
|
|
576
652
|
|
|
577
653
|
# Delete all executions
|
|
578
654
|
result = execution_service.delete_all()
|
|
@@ -831,6 +907,50 @@ client = CodeMieClient(
|
|
|
831
907
|
)
|
|
832
908
|
```
|
|
833
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
|
+
|
|
834
954
|
## Support
|
|
835
955
|
For providing credentials please contact AI/Run CodeMie Team: Vadym_Vlasenko@epam.com or Nikita_Levyankov@epam.com
|
|
836
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)
|
|
@@ -161,16 +162,41 @@ result = client.assistant.delete("assistant-id")
|
|
|
161
162
|
|
|
162
163
|
#### Advanced Features
|
|
163
164
|
|
|
164
|
-
6. **Chat with Assistant**
|
|
165
|
+
6. **Chat with Assistant (with MCP header propagation)**
|
|
165
166
|
```python
|
|
166
167
|
from codemie_sdk.models.assistant import AssistantChatRequest
|
|
167
168
|
|
|
168
169
|
chat_request = AssistantChatRequest(
|
|
169
170
|
text="Your message here",
|
|
170
171
|
stream=False, # Set to True for streaming response
|
|
171
|
-
#
|
|
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
|
+
},
|
|
172
199
|
)
|
|
173
|
-
response = client.assistant.chat("assistant-id", chat_request)
|
|
174
200
|
```
|
|
175
201
|
|
|
176
202
|
7. **Utilize structured outputs with Assistant**
|
|
@@ -230,6 +256,42 @@ prebuilt_assistant = client.assistant.get_prebuilt_by_slug("assistant-slug")
|
|
|
230
256
|
tools = client.assistant.get_tools()
|
|
231
257
|
```
|
|
232
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
|
+
|
|
233
295
|
### Datasource Service
|
|
234
296
|
|
|
235
297
|
The Datasource service enables managing various types of data sources in CodeMie, including code repositories, Confluence spaces, Jira projects, files, and Google documents.
|
|
@@ -535,10 +597,18 @@ result = client.workflow.delete("workflow-id")
|
|
|
535
597
|
|
|
536
598
|
The SDK provides comprehensive workflow execution management through the WorkflowExecutionService:
|
|
537
599
|
|
|
538
|
-
1. **Run Workflow**
|
|
600
|
+
1. **Run Workflow (with MCP header propagation)**
|
|
539
601
|
```python
|
|
540
|
-
#
|
|
541
|
-
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
|
+
)
|
|
542
612
|
|
|
543
613
|
# Get execution service for advanced operations
|
|
544
614
|
execution_service = client.workflow.executions("workflow-id")
|
|
@@ -558,8 +628,14 @@ execution = execution_service.get("execution-id")
|
|
|
558
628
|
# Abort running execution
|
|
559
629
|
result = execution_service.abort("execution-id")
|
|
560
630
|
|
|
561
|
-
# Resume interrupted execution
|
|
562
|
-
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
|
+
)
|
|
563
639
|
|
|
564
640
|
# Delete all executions
|
|
565
641
|
result = execution_service.delete_all()
|
|
@@ -818,6 +894,50 @@ client = CodeMieClient(
|
|
|
818
894
|
)
|
|
819
895
|
```
|
|
820
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
|
+
|
|
821
941
|
## Support
|
|
822
942
|
For providing credentials please contact AI/Run CodeMie Team: Vadym_Vlasenko@epam.com or Nikita_Levyankov@epam.com
|
|
823
943
|
|
|
@@ -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
|
+
]
|
|
@@ -13,6 +13,10 @@ from ..services.user import UserService
|
|
|
13
13
|
from ..services.workflow import WorkflowService
|
|
14
14
|
from ..services.files import FileOperationService
|
|
15
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
|
|
16
20
|
|
|
17
21
|
|
|
18
22
|
class CodeMieClient:
|
|
@@ -89,6 +93,18 @@ class CodeMieClient:
|
|
|
89
93
|
self.webhook = WebhookService(
|
|
90
94
|
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
91
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
|
+
)
|
|
92
108
|
|
|
93
109
|
@property
|
|
94
110
|
def token(self) -> str:
|
|
@@ -104,6 +120,7 @@ class CodeMieClient:
|
|
|
104
120
|
"localhost",
|
|
105
121
|
"127.0.0.1",
|
|
106
122
|
"0.0.0.0",
|
|
123
|
+
"192.168",
|
|
107
124
|
]
|
|
108
125
|
return any(pattern in domain_lower for pattern in localhost_patterns)
|
|
109
126
|
|
|
@@ -135,4 +152,22 @@ class CodeMieClient:
|
|
|
135
152
|
self.conversations = ConversationService(
|
|
136
153
|
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
137
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
|
+
)
|
|
138
173
|
return self._token
|
{codemie_sdk_python-0.1.218 → codemie_sdk_python-0.1.249}/src/codemie_sdk/models/assistant.py
RENAMED
|
@@ -53,6 +53,16 @@ class Context(BaseModel):
|
|
|
53
53
|
name: str
|
|
54
54
|
|
|
55
55
|
|
|
56
|
+
class PromptVariable(BaseModel):
|
|
57
|
+
"""Model for assistant prompt variables."""
|
|
58
|
+
|
|
59
|
+
model_config = ConfigDict(extra="ignore")
|
|
60
|
+
|
|
61
|
+
key: str
|
|
62
|
+
description: Optional[str] = None
|
|
63
|
+
default_value: str
|
|
64
|
+
|
|
65
|
+
|
|
56
66
|
class MCPServerConfig(BaseModel):
|
|
57
67
|
"""
|
|
58
68
|
Configuration for an MCP server.
|
|
@@ -137,6 +147,17 @@ class AssistantBase(BaseModel):
|
|
|
137
147
|
icon_url: Optional[str] = None
|
|
138
148
|
|
|
139
149
|
|
|
150
|
+
class AssistantListResponse(BaseModel):
|
|
151
|
+
"""Model for assistant list response."""
|
|
152
|
+
|
|
153
|
+
model_config = ConfigDict(extra="ignore")
|
|
154
|
+
|
|
155
|
+
id: str
|
|
156
|
+
name: str
|
|
157
|
+
slug: Optional[str] = None
|
|
158
|
+
created_by: Optional[User] = None
|
|
159
|
+
|
|
160
|
+
|
|
140
161
|
class Assistant(AssistantBase):
|
|
141
162
|
"""Full assistant model with additional fields."""
|
|
142
163
|
|
|
@@ -164,6 +185,8 @@ class Assistant(AssistantBase):
|
|
|
164
185
|
user_abilities: Optional[List[Any]] = None
|
|
165
186
|
mcp_servers: List[MCPServerDetails] = Field(default_factory=list)
|
|
166
187
|
assistant_ids: List[str] = Field(default_factory=list)
|
|
188
|
+
version_count: Optional[int] = None
|
|
189
|
+
prompt_variables: Optional[List[PromptVariable]] = Field(default=None)
|
|
167
190
|
|
|
168
191
|
|
|
169
192
|
class AssistantRequestBase(AssistantBase):
|
|
@@ -191,6 +214,7 @@ class AssistantRequestBase(AssistantBase):
|
|
|
191
214
|
top_p: Optional[float] = None
|
|
192
215
|
mcp_servers: List[MCPServerDetails] = Field(default_factory=list)
|
|
193
216
|
assistant_ids: List[str] = Field(default_factory=list)
|
|
217
|
+
prompt_variables: List[PromptVariable] = Field(default_factory=list)
|
|
194
218
|
|
|
195
219
|
|
|
196
220
|
class AssistantCreateRequest(AssistantRequestBase):
|
|
@@ -205,6 +229,27 @@ class AssistantUpdateRequest(AssistantRequestBase):
|
|
|
205
229
|
pass
|
|
206
230
|
|
|
207
231
|
|
|
232
|
+
class AssistantVersion(BaseModel):
|
|
233
|
+
"""Immutable snapshot of assistant configuration for a specific version."""
|
|
234
|
+
|
|
235
|
+
model_config = ConfigDict(extra="ignore", use_enum_values=True)
|
|
236
|
+
|
|
237
|
+
version_number: int
|
|
238
|
+
created_date: datetime
|
|
239
|
+
created_by: Optional[User] = None
|
|
240
|
+
change_notes: Optional[str] = None
|
|
241
|
+
description: Optional[str] = None
|
|
242
|
+
system_prompt: str
|
|
243
|
+
llm_model_type: Optional[str] = None
|
|
244
|
+
temperature: Optional[float] = None
|
|
245
|
+
top_p: Optional[float] = None
|
|
246
|
+
context: List[Context] = Field(default_factory=list)
|
|
247
|
+
toolkits: List[ToolKitDetails] = Field(default_factory=list)
|
|
248
|
+
mcp_servers: List[MCPServerDetails] = Field(default_factory=list)
|
|
249
|
+
assistant_ids: List[str] = Field(default_factory=list)
|
|
250
|
+
prompt_variables: List[PromptVariable] = Field(default_factory=list)
|
|
251
|
+
|
|
252
|
+
|
|
208
253
|
class ChatRole(str, Enum):
|
|
209
254
|
"""Enum for chat message roles."""
|
|
210
255
|
|
|
@@ -263,6 +308,14 @@ class AssistantChatRequest(BaseModel):
|
|
|
263
308
|
default=None, description="DataSource in conversation history"
|
|
264
309
|
)
|
|
265
310
|
stream: bool = Field(default=False, description="Enable streaming response")
|
|
311
|
+
propagate_headers: bool = Field(
|
|
312
|
+
default=False,
|
|
313
|
+
description="Enable propagation of X-* HTTP headers to MCP servers during tool execution",
|
|
314
|
+
)
|
|
315
|
+
custom_metadata: Optional[dict[str, Any]] = Field(
|
|
316
|
+
default=None,
|
|
317
|
+
description="Custom metadata for the AI Assistant",
|
|
318
|
+
)
|
|
266
319
|
top_k: int = Field(default=10, description="Top K results to consider")
|
|
267
320
|
system_prompt: str = Field(default="", description="Override system prompt")
|
|
268
321
|
background_task: bool = Field(default=False, description="Run as background task")
|