codemie-sdk-python 0.1.212__py3-none-any.whl → 0.1.230__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of codemie-sdk-python might be problematic. Click here for more details.

@@ -0,0 +1,330 @@
1
+ """Vendor workflow service implementation for managing cloud vendor workflow settings."""
2
+
3
+ from typing import Union, Optional, List
4
+
5
+ from ..models.vendor_assistant import VendorType
6
+ from ..models.vendor_workflow import (
7
+ VendorWorkflowSettingsResponse,
8
+ VendorWorkflowsResponse,
9
+ VendorWorkflow,
10
+ VendorWorkflowAliasesResponse,
11
+ VendorWorkflowInstallRequest,
12
+ VendorWorkflowInstallResponse,
13
+ VendorWorkflowUninstallResponse,
14
+ )
15
+ from ..utils import ApiRequestHandler
16
+
17
+
18
+ class VendorWorkflowService:
19
+ """Service for managing cloud vendor workflow settings (AWS, Azure, GCP)."""
20
+
21
+ def __init__(self, api_domain: str, token: str, verify_ssl: bool = True):
22
+ """Initialize the vendor workflow service.
23
+
24
+ Args:
25
+ api_domain: Base URL for the CodeMie API
26
+ token: Authentication token
27
+ verify_ssl: Whether to verify SSL certificates
28
+ """
29
+ self._api = ApiRequestHandler(api_domain, token, verify_ssl)
30
+
31
+ def get_workflow_settings(
32
+ self,
33
+ vendor: Union[VendorType, str],
34
+ page: int = 0,
35
+ per_page: int = 10,
36
+ ) -> VendorWorkflowSettingsResponse:
37
+ """Get workflow settings for a specific cloud vendor.
38
+
39
+ Args:
40
+ vendor: Cloud vendor type (aws, azure, gcp). Can be VendorType enum or string.
41
+ page: Page number for pagination (0-based)
42
+ per_page: Number of items per page
43
+
44
+ Returns:
45
+ VendorWorkflowSettingsResponse containing list of settings and pagination info
46
+
47
+ Example:
48
+ >>> # Using enum
49
+ >>> settings = client.vendor_workflows.get_workflow_settings(VendorType.AWS, page=0, per_page=10)
50
+ >>> # Using string
51
+ >>> settings = client.vendor_workflows.get_workflow_settings("aws", page=0, per_page=10)
52
+ >>> # Access settings data
53
+ >>> for setting in settings.data:
54
+ ... print(f"Setting: {setting.setting_name}, Project: {setting.project}")
55
+ ... if setting.invalid:
56
+ ... print(f"Error: {setting.error}")
57
+ """
58
+ # Convert enum to string value if needed
59
+ vendor_str = vendor.value if isinstance(vendor, VendorType) else vendor
60
+
61
+ params = {
62
+ "page": page,
63
+ "per_page": per_page,
64
+ }
65
+
66
+ return self._api.get(
67
+ f"/v1/vendors/{vendor_str}/workflows/settings",
68
+ VendorWorkflowSettingsResponse,
69
+ params=params,
70
+ wrap_response=False,
71
+ )
72
+
73
+ def get_workflows(
74
+ self,
75
+ vendor: Union[VendorType, str],
76
+ setting_id: str,
77
+ per_page: int = 10,
78
+ next_token: Optional[str] = None,
79
+ ) -> VendorWorkflowsResponse:
80
+ """Get workflows for a specific vendor setting.
81
+
82
+ Args:
83
+ vendor: Cloud vendor type (aws, azure, gcp). Can be VendorType enum or string.
84
+ setting_id: ID of the vendor setting to retrieve workflows for
85
+ per_page: Number of items per page
86
+ next_token: Token for pagination (optional, for retrieving next page)
87
+
88
+ Returns:
89
+ VendorWorkflowsResponse containing list of workflows and pagination token
90
+
91
+ Example:
92
+ >>> # Get first page
93
+ >>> workflows = client.vendor_workflows.get_workflows(
94
+ ... vendor=VendorType.AWS,
95
+ ... setting_id="cac90788-39b7-4ffe-8b57-e8b047fa1f6c",
96
+ ... per_page=8
97
+ ... )
98
+ >>> # Access workflow data
99
+ >>> for workflow in workflows.data:
100
+ ... print(f"Name: {workflow.name}, Status: {workflow.status}")
101
+ ... print(f"Version: {workflow.version}, Description: {workflow.description}")
102
+ >>> # Get next page if available
103
+ >>> if workflows.pagination.next_token:
104
+ ... next_page = client.vendor_workflows.get_workflows(
105
+ ... vendor=VendorType.AWS,
106
+ ... setting_id="cac90788-39b7-4ffe-8b57-e8b047fa1f6c",
107
+ ... per_page=8,
108
+ ... next_token=workflows.pagination.next_token
109
+ ... )
110
+ """
111
+ # Convert enum to string value if needed
112
+ vendor_str = vendor.value if isinstance(vendor, VendorType) else vendor
113
+
114
+ params = {
115
+ "setting_id": setting_id,
116
+ "per_page": per_page,
117
+ }
118
+
119
+ if next_token:
120
+ params["next_token"] = next_token
121
+
122
+ return self._api.get(
123
+ f"/v1/vendors/{vendor_str}/workflows",
124
+ VendorWorkflowsResponse,
125
+ params=params,
126
+ wrap_response=False,
127
+ )
128
+
129
+ def get_workflow(
130
+ self,
131
+ vendor: Union[VendorType, str],
132
+ workflow_id: str,
133
+ setting_id: str,
134
+ ) -> VendorWorkflow:
135
+ """Get a specific workflow by ID for a vendor setting.
136
+
137
+ Args:
138
+ vendor: Cloud vendor type (aws, azure, gcp). Can be VendorType enum or string.
139
+ workflow_id: ID of the workflow to retrieve
140
+ setting_id: ID of the vendor setting
141
+
142
+ Returns:
143
+ VendorWorkflow containing workflow details
144
+
145
+ Example:
146
+ >>> workflow = client.vendor_workflows.get_workflow(
147
+ ... vendor=VendorType.AWS,
148
+ ... workflow_id="9HXLQ7J9YP",
149
+ ... setting_id="cac90788-39b7-4ffe-8b57-e8b047fa1f6c"
150
+ ... )
151
+ >>> print(f"Name: {workflow.name}, Status: {workflow.status}")
152
+ >>> print(f"Version: {workflow.version}, Description: {workflow.description}")
153
+ """
154
+ # Convert enum to string value if needed
155
+ vendor_str = vendor.value if isinstance(vendor, VendorType) else vendor
156
+
157
+ params = {
158
+ "setting_id": setting_id,
159
+ }
160
+
161
+ return self._api.get(
162
+ f"/v1/vendors/{vendor_str}/workflows/{workflow_id}",
163
+ VendorWorkflow,
164
+ params=params,
165
+ wrap_response=False,
166
+ )
167
+
168
+ def get_workflow_aliases(
169
+ self,
170
+ vendor: Union[VendorType, str],
171
+ workflow_id: str,
172
+ setting_id: str,
173
+ per_page: int = 10,
174
+ next_token: Optional[str] = None,
175
+ ) -> VendorWorkflowAliasesResponse:
176
+ """Get aliases for a specific vendor workflow.
177
+
178
+ Args:
179
+ vendor: Cloud vendor type (aws, azure, gcp). Can be VendorType enum or string.
180
+ workflow_id: ID of the workflow to retrieve aliases for
181
+ setting_id: ID of the vendor setting
182
+ per_page: Number of items per page
183
+ next_token: Token for pagination (optional, for retrieving next page)
184
+
185
+ Returns:
186
+ VendorWorkflowAliasesResponse containing list of aliases and pagination token
187
+
188
+ Example:
189
+ >>> # Get first page of aliases
190
+ >>> aliases = client.vendor_workflows.get_workflow_aliases(
191
+ ... vendor=VendorType.AWS,
192
+ ... workflow_id="9HXLQ7J9YP",
193
+ ... setting_id="cac90788-39b7-4ffe-8b57-e8b047fa1f6c",
194
+ ... per_page=5
195
+ ... )
196
+ >>> for alias in aliases.data:
197
+ ... print(f"{alias.name} (v{alias.version}): {alias.status}")
198
+ ... if alias.aiRunId:
199
+ ... print(f" AI Run ID: {alias.aiRunId}")
200
+ >>> # Get next page if available
201
+ >>> if aliases.pagination.next_token:
202
+ ... next_page = client.vendor_workflows.get_workflow_aliases(
203
+ ... vendor=VendorType.AWS,
204
+ ... workflow_id="9HXLQ7J9YP",
205
+ ... setting_id="cac90788-39b7-4ffe-8b57-e8b047fa1f6c",
206
+ ... per_page=5,
207
+ ... next_token=aliases.pagination.next_token
208
+ ... )
209
+ """
210
+ # Convert enum to string value if needed
211
+ vendor_str = vendor.value if isinstance(vendor, VendorType) else vendor
212
+
213
+ params = {
214
+ "setting_id": setting_id,
215
+ "per_page": per_page,
216
+ }
217
+
218
+ if next_token:
219
+ params["next_token"] = next_token
220
+
221
+ return self._api.get(
222
+ f"/v1/vendors/{vendor_str}/workflows/{workflow_id}/aliases",
223
+ VendorWorkflowAliasesResponse,
224
+ params=params,
225
+ wrap_response=False,
226
+ )
227
+
228
+ def install_workflows(
229
+ self,
230
+ vendor: Union[VendorType, str],
231
+ workflows: List[VendorWorkflowInstallRequest],
232
+ ) -> VendorWorkflowInstallResponse:
233
+ """Install/activate vendor workflows.
234
+
235
+ Args:
236
+ vendor: Cloud vendor type (aws, azure, gcp). Can be VendorType enum or string.
237
+ workflows: List of workflow installation requests with workflow ID, flow alias ID, and setting ID
238
+
239
+ Returns:
240
+ VendorWorkflowInstallResponse containing installation summary with AI run IDs
241
+
242
+ Example:
243
+ >>> from codemie_sdk import VendorWorkflowInstallRequest
244
+ >>> # Install single workflow
245
+ >>> install_request = VendorWorkflowInstallRequest(
246
+ ... id="9HXLQ7J9YP",
247
+ ... flowAliasId="9RUV0BI2L7",
248
+ ... setting_id="cac90788-39b7-4ffe-8b57-e8b047fa1f6c"
249
+ ... )
250
+ >>> response = client.vendor_workflows.install_workflows(
251
+ ... vendor=VendorType.AWS,
252
+ ... workflows=[install_request]
253
+ ... )
254
+ >>> for item in response.summary:
255
+ ... print(f"Installed workflow {item.flowId} with run ID: {item.aiRunId}")
256
+ >>>
257
+ >>> # Install multiple workflows
258
+ >>> requests = [
259
+ ... VendorWorkflowInstallRequest(
260
+ ... id="WORKFLOW_ID_1",
261
+ ... flowAliasId="ALIAS_ID_1",
262
+ ... setting_id="SETTING_ID"
263
+ ... ),
264
+ ... VendorWorkflowInstallRequest(
265
+ ... id="WORKFLOW_ID_2",
266
+ ... flowAliasId="ALIAS_ID_2",
267
+ ... setting_id="SETTING_ID"
268
+ ... )
269
+ ... ]
270
+ >>> response = client.vendor_workflows.install_workflows(
271
+ ... vendor=VendorType.AWS,
272
+ ... workflows=requests
273
+ ... )
274
+ """
275
+ # Convert enum to string value if needed
276
+ vendor_str = vendor.value if isinstance(vendor, VendorType) else vendor
277
+
278
+ # Convert list of Pydantic models to list of dicts
279
+ payload = [workflow.model_dump(by_alias=True) for workflow in workflows]
280
+
281
+ return self._api.post(
282
+ f"/v1/vendors/{vendor_str}/workflows",
283
+ VendorWorkflowInstallResponse,
284
+ json_data=payload,
285
+ wrap_response=False,
286
+ )
287
+
288
+ def uninstall_workflow(
289
+ self,
290
+ vendor: Union[VendorType, str],
291
+ ai_run_id: str,
292
+ ) -> VendorWorkflowUninstallResponse:
293
+ """Uninstall/deactivate a vendor workflow.
294
+
295
+ Args:
296
+ vendor: Cloud vendor type (aws, azure, gcp). Can be VendorType enum or string.
297
+ ai_run_id: AI run ID returned from the workflow alias (aiRunId field)
298
+
299
+ Returns:
300
+ VendorWorkflowUninstallResponse with success status
301
+
302
+ Example:
303
+ >>> # Get workflow aliases to find the aiRunId
304
+ >>> aliases = client.vendor_workflows.get_workflow_aliases(
305
+ ... vendor=VendorType.AWS,
306
+ ... workflow_id="9HXLQ7J9YP",
307
+ ... setting_id="cac90788-39b7-4ffe-8b57-e8b047fa1f6c"
308
+ ... )
309
+ >>> # Find an installed alias with aiRunId
310
+ >>> for alias in aliases.data:
311
+ ... if alias.aiRunId:
312
+ ... ai_run_id = alias.aiRunId
313
+ ... break
314
+ >>>
315
+ >>> # Uninstall the workflow using the AI run ID
316
+ >>> response = client.vendor_workflows.uninstall_workflow(
317
+ ... vendor=VendorType.AWS,
318
+ ... ai_run_id="56fed66d-f66e-46e3-b420-bb3a8d93eed4"
319
+ ... )
320
+ >>> if response.success:
321
+ ... print("Workflow successfully uninstalled!")
322
+ """
323
+ # Convert enum to string value if needed
324
+ vendor_str = vendor.value if isinstance(vendor, VendorType) else vendor
325
+
326
+ return self._api.delete(
327
+ f"/v1/vendors/{vendor_str}/workflows/{ai_run_id}",
328
+ VendorWorkflowUninstallResponse,
329
+ wrap_response=False,
330
+ )
@@ -135,6 +135,8 @@ class WorkflowService:
135
135
  workflow_id: str,
136
136
  user_input: Optional[str] = None,
137
137
  file_name: Optional[str] = None,
138
+ propagate_headers: bool = False,
139
+ headers: Optional[dict[str, str]] = None,
138
140
  ) -> dict:
139
141
  """Run a workflow with optional input parameters.
140
142
 
@@ -142,11 +144,18 @@ class WorkflowService:
142
144
  workflow_id: ID of the workflow to run
143
145
  user_input: Optional user input for the workflow execution
144
146
  file_name: Optional file name for the workflow execution
147
+ propagate_headers: Enable propagation of X-* HTTP headers to MCP servers
148
+ headers: Optional additional HTTP headers (e.g., X-* for MCP propagation)
145
149
 
146
150
  Returns:
147
151
  dict: Created workflow execution details
148
152
  """
149
- return self.executions(workflow_id).create(user_input, file_name)
153
+ return self.executions(workflow_id).create(
154
+ user_input=user_input,
155
+ file_name=file_name,
156
+ propagate_headers=propagate_headers,
157
+ headers=headers,
158
+ )
150
159
 
151
160
  def executions(self, workflow_id: str) -> WorkflowExecutionService:
152
161
  """Get workflow execution service for the specified workflow.
@@ -46,24 +46,33 @@ class WorkflowExecutionService:
46
46
  )
47
47
 
48
48
  def create(
49
- self, user_input: Optional[str] = None, file_name: Optional[str] = None
49
+ self,
50
+ user_input: Optional[str] = None,
51
+ file_name: Optional[str] = None,
52
+ propagate_headers: bool = False,
53
+ headers: Optional[dict[str, str]] = None,
50
54
  ) -> dict:
51
55
  """Create a new workflow execution.
52
56
 
53
57
  Args:
54
58
  user_input: Optional input data for the workflow execution.
55
59
  file_name: Optional file name associated with the workflow execution.
60
+ propagate_headers: Enable propagation of X-* HTTP headers to MCP servers.
61
+ headers: Optional additional HTTP headers (e.g., X-* for MCP propagation)
56
62
 
57
63
  Returns:
58
64
  dict: Created workflow execution details
59
65
  """
60
66
  payload = WorkflowExecutionCreateRequest(
61
- user_input=user_input, file_name=file_name
67
+ user_input=user_input,
68
+ file_name=file_name,
69
+ propagate_headers=propagate_headers,
62
70
  )
63
71
  return self._api.post(
64
72
  f"/v1/workflows/{self._workflow_id}/executions",
65
73
  dict,
66
74
  json_data=payload.model_dump(),
75
+ extra_headers=headers,
67
76
  )
68
77
 
69
78
  def get(self, execution_id: str) -> WorkflowExecution:
@@ -108,17 +117,30 @@ class WorkflowExecutionService:
108
117
  f"/v1/workflows/{self._workflow_id}/executions/{execution_id}/abort", dict
109
118
  )
110
119
 
111
- def resume(self, execution_id: str) -> dict:
120
+ def resume(
121
+ self,
122
+ execution_id: str,
123
+ propagate_headers: bool = False,
124
+ headers: Optional[dict[str, str]] = None,
125
+ ) -> dict:
112
126
  """Resume an interrupted workflow execution.
113
127
 
114
128
  Args:
115
129
  execution_id: ID of the execution to resume
130
+ propagate_headers: Enable propagation of X-* HTTP headers to MCP servers.
131
+ headers: Optional additional HTTP headers (e.g., X-* for MCP propagation)
116
132
 
117
133
  Returns:
118
134
  dict: Updated workflow execution details
119
135
  """
136
+ params = {"propagate_headers": propagate_headers}
137
+ # Empty body per API; passing empty dict to satisfy typing
120
138
  return self._api.put(
121
- f"/v1/workflows/{self._workflow_id}/executions/{execution_id}/resume", dict
139
+ f"/v1/workflows/{self._workflow_id}/executions/{execution_id}/resume",
140
+ dict,
141
+ json_data={},
142
+ params=params,
143
+ extra_headers=headers,
122
144
  )
123
145
 
124
146
  def get_thoughts(
codemie_sdk/utils/http.py CHANGED
@@ -161,6 +161,7 @@ class ApiRequestHandler:
161
161
  stream: bool = False,
162
162
  wrap_response: bool = True,
163
163
  raise_on_error: bool = True,
164
+ extra_headers: Optional[Dict[str, str]] = None,
164
165
  ) -> Union[T, requests.Response]:
165
166
  """Makes a POST request and parses the response.
166
167
 
@@ -171,6 +172,7 @@ class ApiRequestHandler:
171
172
  stream: Whether to return streaming response
172
173
  wrap_response: Whether response is wrapped in 'data' field
173
174
  raise_on_error: Whether to raise exception on HTTP error status codes
175
+ extra_headers: Optional additional HTTP headers to include (e.g., X-* for MCP propagation)
174
176
 
175
177
  Returns:
176
178
  Parsed response object/list or streaming response
@@ -178,9 +180,13 @@ class ApiRequestHandler:
178
180
  if json_data:
179
181
  logger.debug(f"Request body: {json_data}")
180
182
 
183
+ headers = self._get_headers()
184
+ if extra_headers:
185
+ headers.update(extra_headers)
186
+
181
187
  response = requests.post(
182
188
  url=f"{self._base_url}{endpoint}",
183
- headers=self._get_headers(),
189
+ headers=headers,
184
190
  json=json_data,
185
191
  verify=self._verify_ssl,
186
192
  stream=stream,
@@ -242,6 +248,7 @@ class ApiRequestHandler:
242
248
  json_data: Dict[str, Any],
243
249
  params: Optional[Dict[str, Any]] = None,
244
250
  wrap_response: bool = True,
251
+ extra_headers: Optional[Dict[str, str]] = None,
245
252
  ) -> T:
246
253
  """Makes a PUT request and parses the response.
247
254
 
@@ -251,14 +258,18 @@ class ApiRequestHandler:
251
258
  json_data: JSON request body
252
259
  params: Query parameters
253
260
  wrap_response: Whether response is wrapped in 'data' field
261
+ extra_headers: Optional additional HTTP headers to include (e.g., X-* for MCP propagation)
254
262
 
255
263
  Returns:
256
264
  Parsed response object or list of objects
257
265
  """
258
266
  logger.debug(f"Request body: {json_data}")
267
+ headers = self._get_headers()
268
+ if extra_headers:
269
+ headers.update(extra_headers)
259
270
  response = requests.put(
260
271
  url=f"{self._base_url}{endpoint}",
261
- headers=self._get_headers(),
272
+ headers=headers,
262
273
  json=json_data,
263
274
  params=params,
264
275
  verify=self._verify_ssl,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codemie-sdk-python
3
- Version: 0.1.212
3
+ Version: 0.1.230
4
4
  Summary: CodeMie SDK for Python
5
5
  Author: Vadym Vlasenko
6
6
  Author-email: vadym_vlasenko@epam.com
@@ -59,7 +59,7 @@ Python SDK for CodeMie services. This SDK provides a comprehensive interface to
59
59
  ## Installation
60
60
 
61
61
  ```sh
62
- pip install codemie-sdk
62
+ pip install codemie-sdk-python
63
63
  ```
64
64
  OR
65
65
  ```sh
@@ -174,16 +174,41 @@ result = client.assistant.delete("assistant-id")
174
174
 
175
175
  #### Advanced Features
176
176
 
177
- 6. **Chat with Assistant**
177
+ 6. **Chat with Assistant (with MCP header propagation)**
178
178
  ```python
179
179
  from codemie_sdk.models.assistant import AssistantChatRequest
180
180
 
181
181
  chat_request = AssistantChatRequest(
182
182
  text="Your message here",
183
183
  stream=False, # Set to True for streaming response
184
- # Additional parameters
184
+ propagate_headers=True, # Enable propagation of X-* headers to MCP servers
185
+ )
186
+ # Pass X-* headers to forward to MCP servers
187
+ response = client.assistant.chat(
188
+ "assistant-id",
189
+ chat_request,
190
+ headers={
191
+ "X-Tenant-ID": "tenant-abc-123",
192
+ "X-User-ID": "user-456",
193
+ "X-Request-ID": "req-123",
194
+ },
195
+ )
196
+ ```
197
+
198
+ 6.a. **Chat with Assistant by slug (with MCP header propagation)**
199
+ ```python
200
+ chat_request = AssistantChatRequest(
201
+ text="Your message here",
202
+ propagate_headers=True,
203
+ )
204
+ response = client.assistants.chat_by_slug(
205
+ "assistant-slug",
206
+ chat_request,
207
+ headers={
208
+ "X-Environment": "production",
209
+ "X-Feature-Flag-Beta": "true",
210
+ },
185
211
  )
186
- response = client.assistant.chat("assistant-id", chat_request)
187
212
  ```
188
213
 
189
214
  7. **Utilize structured outputs with Assistant**
@@ -548,10 +573,18 @@ result = client.workflow.delete("workflow-id")
548
573
 
549
574
  The SDK provides comprehensive workflow execution management through the WorkflowExecutionService:
550
575
 
551
- 1. **Run Workflow**
576
+ 1. **Run Workflow (with MCP header propagation)**
552
577
  ```python
553
- # Simple workflow execution
554
- execution = client.workflow.run("workflow-id", user_input="optional input")
578
+ # Enable propagation in payload and pass X-* headers to forward to MCP servers
579
+ execution = client.workflow.run(
580
+ "workflow-id",
581
+ user_input="optional input",
582
+ propagate_headers=True,
583
+ headers={
584
+ "X-Request-ID": "req-abc-123",
585
+ "X-Source-App": "analytics-ui",
586
+ },
587
+ )
555
588
 
556
589
  # Get execution service for advanced operations
557
590
  execution_service = client.workflow.executions("workflow-id")
@@ -571,8 +604,14 @@ execution = execution_service.get("execution-id")
571
604
  # Abort running execution
572
605
  result = execution_service.abort("execution-id")
573
606
 
574
- # Resume interrupted execution
575
- result = execution_service.resume("execution-id")
607
+ # Resume interrupted execution with header propagation (query param + headers)
608
+ result = execution_service.resume(
609
+ "execution-id",
610
+ propagate_headers=True,
611
+ headers={
612
+ "X-Correlation-ID": "corr-456",
613
+ },
614
+ )
576
615
 
577
616
  # Delete all executions
578
617
  result = execution_service.delete_all()
@@ -831,6 +870,50 @@ client = CodeMieClient(
831
870
  )
832
871
  ```
833
872
 
873
+ ### Assistant Versioning via SDK
874
+
875
+ The Python SDK exposes full assistant versioning capabilities delivered in EPMCDME-8285.
876
+
877
+ - List versions
878
+ ```python
879
+ versions = client.assistants.list_versions("assistant-id", page=0, per_page=20)
880
+ print([v.version_number for v in versions])
881
+ ```
882
+
883
+ - Get specific version
884
+ ```python
885
+ version = client.assistants.get_version("assistant-id", 2)
886
+ print(version.system_prompt)
887
+ ```
888
+
889
+ - Compare two versions
890
+ ```python
891
+ from codemie_sdk.models.assistant import AssistantVersionDiff
892
+
893
+ diff: AssistantVersionDiff = client.assistants.compare_versions("assistant-id", 1, 3)
894
+ print(diff.summary)
895
+ ```
896
+
897
+ - Rollback to a version
898
+ ```python
899
+ resp = client.assistants.rollback_to_version("assistant-id", 2)
900
+ print(resp)
901
+ ```
902
+
903
+ - Chat with a specific version
904
+ ```python
905
+ from codemie_sdk.models.assistant import AssistantChatRequest
906
+
907
+ req = AssistantChatRequest(text="Hi", stream=False)
908
+ resp = client.assistants.chat_with_version("assistant-id", 2, req)
909
+ print(resp.generated)
910
+ ```
911
+
912
+ Quick CLI example
913
+ ```bash
914
+ python codemie-sdk/examples/assistant_versions.py <assistant_id> [version_number]
915
+ ```
916
+
834
917
  ## Support
835
918
  For providing credentials please contact AI/Run CodeMie Team: Vadym_Vlasenko@epam.com or Nikita_Levyankov@epam.com
836
919