codemie-sdk-python 0.1.4__tar.gz → 0.1.5__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.

Potentially problematic release.


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

Files changed (30) hide show
  1. codemie_sdk_python-0.1.5/PKG-INFO +709 -0
  2. codemie_sdk_python-0.1.5/README.md +695 -0
  3. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/pyproject.toml +6 -4
  4. codemie_sdk_python-0.1.4/LICENSE +0 -19
  5. codemie_sdk_python-0.1.4/PKG-INFO +0 -120
  6. codemie_sdk_python-0.1.4/README.md +0 -105
  7. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/__init__.py +0 -0
  8. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/auth/__init__.py +0 -0
  9. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/auth/credentials.py +0 -0
  10. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/client/__init__.py +0 -0
  11. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/client/client.py +0 -0
  12. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/exceptions.py +0 -0
  13. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/models/assistant.py +0 -0
  14. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/models/common.py +0 -0
  15. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/models/datasource.py +0 -0
  16. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/models/integration.py +0 -0
  17. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/models/llm.py +0 -0
  18. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/models/task.py +0 -0
  19. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/models/user.py +0 -0
  20. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/models/workflow.py +0 -0
  21. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/services/assistant.py +0 -0
  22. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/services/datasource.py +0 -0
  23. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/services/integration.py +0 -0
  24. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/services/llm.py +0 -0
  25. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/services/task.py +0 -0
  26. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/services/user.py +0 -0
  27. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/services/workflow.py +0 -0
  28. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/services/workflow_execution.py +0 -0
  29. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/utils/__init__.py +0 -0
  30. {codemie_sdk_python-0.1.4 → codemie_sdk_python-0.1.5}/src/codemie_sdk/utils/http.py +0 -0
@@ -0,0 +1,709 @@
1
+ Metadata-Version: 2.1
2
+ Name: codemie-sdk-python
3
+ Version: 0.1.5
4
+ Summary: CodeMie SDK for Python
5
+ Author: Vadym Vlasenko
6
+ Author-email: vadym_vlasenko@epam.com
7
+ Requires-Python: >=3.12,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Requires-Dist: pydantic (>=2.11.1,<3.0.0)
11
+ Requires-Dist: requests (>=2.31.0,<3.0.0)
12
+ Description-Content-Type: text/markdown
13
+
14
+ # CodeMie Python SDK
15
+
16
+ Python SDK for CodeMie services. This SDK provides a comprehensive interface to interact with CodeMie services, including LLM (Large Language Models), assistants, workflows, and tools.
17
+
18
+ ## Table of Contents
19
+
20
+ - [Installation](#installation)
21
+ - [Usage](#usage)
22
+ - [Basic Usage](#basic-usage)
23
+ - [Service Details](#service-details)
24
+ - [LLM Service](#llm-service)
25
+ - [Assistant Service](#assistant-service)
26
+ - [Core Methods](#core-methods)
27
+ - [Advanced Features](#advanced-features)
28
+ - [Datasource Service](#datasource-service)
29
+ - [Supported Datasource Types](#supported-datasource-types)
30
+ - [Core Methods](#core-methods-1)
31
+ - [Datasource Status](#datasource-status)
32
+ - [Best Practices for Datasources](#best-practices-for-datasources)
33
+ - [Integration Service](#integration-service)
34
+ - [Integration Types](#integration-types)
35
+ - [Core Methods](#core-methods-2)
36
+ - [Best Practices for Integrations](#best-practices-for-integrations)
37
+ - [Workflow Service](#workflow-service)
38
+ - [Core Methods](#core-methods-3)
39
+ - [Workflow Execution](#workflow-execution)
40
+ - [Workflow Configuration](#workflow-configuration)
41
+ - [Best Practices](#best-practices)
42
+ - [Error Handling](#error-handling)
43
+ - [Workflow Status Monitoring](#workflow-status-monitoring)
44
+ - [Development](#development)
45
+ - [Setup](#setup)
46
+ - [Running Tests](#running-tests)
47
+ - [Building Package](#building-package)
48
+ - [Error Handling](#error-handling-1)
49
+ - [Authentication](#authentication)
50
+ - [Required Parameters](#required-parameters)
51
+ - [Usage Examples](#usage-examples)
52
+ - [Best Practices](#best-practices-1)
53
+ - [Support](#support)
54
+
55
+ ## Installation
56
+
57
+ ```sh
58
+ pip install codemie-sdk
59
+ ```
60
+
61
+ ## Usage
62
+
63
+ ### Basic usage
64
+
65
+ ```python
66
+ from codemie_sdk import CodeMieClient
67
+
68
+ # Initialize client with authentication parameters
69
+ client = CodeMieClient(
70
+ auth_server_url="https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth",
71
+ auth_client_id="your-client-id",
72
+ auth_client_secret="your-client-secret",
73
+ auth_realm_name="your-realm",
74
+ codemie_api_domain="https://codemie.lab.epam.com/code-assistant-api"
75
+ )
76
+ ```
77
+
78
+ ## Service Details
79
+
80
+ ### LLM Service
81
+
82
+ The LLM service provides access to language models and embedding models:
83
+
84
+ - **list()**: Retrieves a list of available LLM models
85
+ ```python
86
+ llm_models = client.llm.list(token=client.token)
87
+ ```
88
+
89
+ - **list_embeddings()**: Retrieves a list of available embedding models
90
+ ```python
91
+ embedding_models = client.llm.list_embeddings(token=client.token)
92
+ ```
93
+
94
+ Each LLM model contains the following information:
95
+ - Model identifier
96
+ - Model capabilities
97
+ - Configuration parameters
98
+
99
+ Example usage:
100
+ ```python
101
+ # List available LLM models
102
+ llm_models = client.llm.list(token=client.token)
103
+
104
+ # List available embedding models
105
+ embedding_models = client.llm.list_embeddings(token=client.token)
106
+ ```
107
+
108
+ ### Assistant Service
109
+
110
+ The Assistant service allows you to manage and interact with CodeMie assistants:
111
+
112
+ #### Core Methods
113
+
114
+ 1. **List Assistants**
115
+ ```python
116
+ assistants = client.assistant.list(
117
+ minimal_response=True, # Return minimal assistant info
118
+ scope="visible_to_user", # or "created_by_user"
119
+ page=0,
120
+ per_page=12,
121
+ filters={"key": "value"} # Optional filters
122
+ )
123
+ ```
124
+
125
+ 2. **Get Assistant Details**
126
+ ```python
127
+ # By ID
128
+ assistant = client.assistant.get("assistant-id")
129
+
130
+ # By Slug
131
+ assistant = client.assistant.get_by_slug("assistant-slug")
132
+ ```
133
+
134
+ 3. **Create Assistant**
135
+ ```python
136
+ from codemie_sdk.models.assistant import AssistantCreateRequest
137
+
138
+ request = AssistantCreateRequest(
139
+ name="My Assistant",
140
+ description="Assistant description",
141
+ instructions="Assistant instructions",
142
+ tools=["tool1", "tool2"],
143
+ # Additional parameters as needed
144
+ )
145
+ new_assistant = client.assistant.create(request)
146
+ ```
147
+
148
+ 4. **Update Assistant**
149
+ ```python
150
+ from codemie_sdk.models.assistant import AssistantUpdateRequest
151
+
152
+ request = AssistantUpdateRequest(
153
+ name="Updated Name",
154
+ description="Updated description",
155
+ # Other fields to update
156
+ )
157
+ updated_assistant = client.assistant.update("assistant-id", request)
158
+ ```
159
+
160
+ 5. **Delete Assistant**
161
+ ```python
162
+ result = client.assistant.delete("assistant-id")
163
+ ```
164
+
165
+ #### Advanced Features
166
+
167
+ 6. **Chat with Assistant**
168
+ ```python
169
+ from codemie_sdk.models.assistant import AssistantChatRequest
170
+
171
+ chat_request = AssistantChatRequest(
172
+ message="Your message here",
173
+ stream=False, # Set to True for streaming response
174
+ # Additional parameters
175
+ )
176
+ response = client.assistant.chat("assistant-id", chat_request)
177
+ ```
178
+
179
+ 7. **Work with Prebuilt Assistants**
180
+ ```python
181
+ # List prebuilt assistants
182
+ prebuilt = client.assistant.get_prebuilt()
183
+
184
+ # Get specific prebuilt assistant
185
+ prebuilt_assistant = client.assistant.get_prebuilt_by_slug("assistant-slug")
186
+ ```
187
+
188
+ 8. **Get Available Tools**
189
+ ```python
190
+ tools = client.assistant.get_tools()
191
+ ```
192
+
193
+ ### Datasource Service
194
+
195
+ The Datasource service enables managing various types of data sources in CodeMie, including code repositories, Confluence spaces, Jira projects, files, and Google documents.
196
+
197
+ #### Supported Datasource Types
198
+
199
+ - `CODE`: Code repository datasources
200
+ - `CONFLUENCE`: Confluence knowledge base
201
+ - `JIRA`: Jira knowledge base
202
+ - `FILE`: File-based knowledge base
203
+ - `GOOGLE`: Google documents
204
+
205
+ #### Core Methods
206
+
207
+ 1. **Create Datasource**
208
+ ```python
209
+ from codemie_sdk.models.datasource import (
210
+ CodeDataSourceRequest,
211
+ ConfluenceDataSourceRequest,
212
+ JiraDataSourceRequest,
213
+ GoogleDataSourceRequest
214
+ )
215
+
216
+ # Create Code Datasource
217
+ code_request = CodeDataSourceRequest(
218
+ name="my_repo", # lowercase letters and underscores only
219
+ project_name="my_project",
220
+ description="My code repository",
221
+ link="https://github.com/user/repo",
222
+ branch="main",
223
+ index_type="code", # or "summary" or "chunk-summary"
224
+ files_filter="*.py", # optional
225
+ embeddings_model="model_name",
226
+ summarization_model="gpt-4", # optional
227
+ docs_generation=False # optional
228
+ )
229
+ result = client.datasource.create(code_request)
230
+
231
+ # Create Confluence Datasource
232
+ confluence_request = ConfluenceDataSourceRequest(
233
+ name="confluence_kb",
234
+ project_name="my_project",
235
+ description="Confluence space",
236
+ cql="space = 'MYSPACE'",
237
+ include_restricted_content=False,
238
+ include_archived_content=False,
239
+ include_attachments=True,
240
+ include_comments=True
241
+ )
242
+ result = client.datasource.create(confluence_request)
243
+
244
+ # Create Jira Datasource
245
+ jira_request = JiraDataSourceRequest(
246
+ name="jira_kb",
247
+ project_name="my_project",
248
+ description="Jira project",
249
+ jql="project = 'MYPROJECT'"
250
+ )
251
+ result = client.datasource.create(jira_request)
252
+
253
+ # Create Google Doc Datasource
254
+ google_request = GoogleDataSourceRequest(
255
+ name="google_doc",
256
+ project_name="my_project",
257
+ description="Google document",
258
+ google_doc="document_url"
259
+ )
260
+ result = client.datasource.create(google_request)
261
+ ```
262
+
263
+ 2. **Update Datasource**
264
+ ```python
265
+ from codemie_sdk.models.datasource import UpdateCodeDataSourceRequest
266
+
267
+ # Update Code Datasource
268
+ update_request = UpdateCodeDataSourceRequest(
269
+ name="my_repo",
270
+ project_name="my_project",
271
+ description="Updated description",
272
+ branch="develop",
273
+ full_reindex=True, # optional reindex parameters
274
+ skip_reindex=False,
275
+ resume_indexing=False
276
+ )
277
+ result = client.datasource.update("datasource_id", update_request)
278
+ ```
279
+
280
+ 3. **List Datasources**
281
+ ```python
282
+ # List all datasources with filtering and pagination
283
+ datasources = client.datasource.list(
284
+ page=0,
285
+ per_page=10,
286
+ sort_key="update_date", # or "date"
287
+ sort_order="desc", # or "asc"
288
+ datasource_types=["CODE", "CONFLUENCE"], # optional filter by type
289
+ projects=["project1", "project2"], # optional filter by projects
290
+ owner="John Doe", # optional filter by owner
291
+ status="COMPLETED" # optional filter by status
292
+ )
293
+ ```
294
+
295
+ 4. **Get Datasource Details**
296
+ ```python
297
+ # Get single datasource by ID
298
+ datasource = client.datasource.get("datasource_id")
299
+ ```
300
+
301
+ 5. **Delete Datasource**
302
+ ```python
303
+ # Delete datasource by ID
304
+ result = client.datasource.delete("datasource_id")
305
+ ```
306
+
307
+ #### Datasource Status
308
+
309
+ Datasources can have the following statuses:
310
+ - `COMPLETED`: Indexing completed successfully
311
+ - `FAILED`: Indexing failed
312
+ - `FETCHING`: Fetching data from source
313
+ - `IN_PROGRESS`: Processing/indexing in progress
314
+
315
+ #### Best Practices for Datasources
316
+
317
+ 1. **Naming Convention**:
318
+ - Use lowercase letters and underscores for datasource names
319
+ - Keep names descriptive but concise
320
+
321
+ 2. **Performance Optimization**:
322
+ - Use appropriate filters when listing datasources
323
+ - Consider pagination for large result sets
324
+ - Choose appropriate reindex options based on your needs
325
+
326
+ 3. **Error Handling**:
327
+ - Always check datasource status after creation/update
328
+ - Handle potential failures gracefully
329
+ - Monitor processing information for issues
330
+
331
+ 4. **Security**:
332
+ - Be careful with sensitive data in filters and queries
333
+ - Use proper access controls when sharing datasources
334
+ - Regularly review and clean up unused datasources
335
+
336
+ ### Integration Service
337
+
338
+ The Integration service manages both user and project-level integrations in CodeMie, allowing you to configure and manage various integration settings.
339
+
340
+ #### Integration Types
341
+
342
+ - `USER`: User-level integrations
343
+ - `PROJECT`: Project-level integrations
344
+
345
+ #### Core Methods
346
+
347
+ 1. **List Integrations**
348
+ ```python
349
+ from codemie_sdk.models.integration import IntegrationType
350
+
351
+ # List user integrations with pagination
352
+ user_integrations = client.integration.list(
353
+ setting_type=IntegrationType.USER,
354
+ page=0,
355
+ per_page=10,
356
+ filters={"some_filter": "value"} # optional
357
+ )
358
+
359
+ # List project integrations
360
+ project_integrations = client.integration.list(
361
+ setting_type=IntegrationType.PROJECT,
362
+ per_page=100
363
+ )
364
+ ```
365
+
366
+ 2. **Get Integration**
367
+ ```python
368
+ # Get integration by ID
369
+ integration = client.integration.get(
370
+ integration_id="integration_id",
371
+ setting_type=IntegrationType.USER
372
+ )
373
+
374
+ # Get integration by alias
375
+ integration = client.integration.get_by_alias(
376
+ alias="integration_alias",
377
+ setting_type=IntegrationType.PROJECT
378
+ )
379
+ ```
380
+
381
+ 3. **Create Integration**
382
+ ```python
383
+ from codemie_sdk.models.integration import Integration
384
+
385
+ # Create new integration
386
+ new_integration = Integration(
387
+ setting_type=IntegrationType.USER,
388
+ alias="my_integration",
389
+ # Add other required fields based on integration type
390
+ )
391
+ result = client.integration.create(new_integration)
392
+ ```
393
+
394
+ 4. **Update Integration**
395
+ ```python
396
+ # Update existing integration
397
+ updated_integration = Integration(
398
+ setting_type=IntegrationType.USER,
399
+ alias="updated_alias",
400
+ # Add other fields to update
401
+ )
402
+ result = client.integration.update("integration_id", updated_integration)
403
+ ```
404
+
405
+ 5. **Delete Integration**
406
+ ```python
407
+ # Delete integration
408
+ result = client.integration.delete(
409
+ setting_id="integration_id",
410
+ setting_type=IntegrationType.USER
411
+ )
412
+ ```
413
+
414
+ #### Best Practices for Integrations
415
+
416
+ 1. **Error Handling**:
417
+ - Handle `NotFoundError` when getting integrations by ID or alias
418
+ - Validate integration settings before creation/update
419
+ - Use appropriate setting type (USER/PROJECT) based on context
420
+
421
+ 2. **Performance**:
422
+ - Use pagination for listing integrations
423
+ - Cache frequently accessed integrations when appropriate
424
+ - Use filters to reduce result set size
425
+
426
+ 3. **Security**:
427
+ - Keep integration credentials secure
428
+ - Regularly review and update integration settings
429
+ - Use project-level integrations for team-wide settings
430
+ - Use user-level integrations for personal settings
431
+
432
+ ### Workflow Service
433
+
434
+ The Workflow service enables you to create, manage, and execute workflows in CodeMie. Workflows allow you to automate complex processes and integrate various CodeMie services.
435
+
436
+ #### Core Methods
437
+
438
+ 1. **Create Workflow**
439
+ ```python
440
+ from codemie_sdk.models.workflow import WorkflowCreateRequest
441
+
442
+ # Create new workflow
443
+ workflow_request = WorkflowCreateRequest(
444
+ name="My Workflow",
445
+ description="Workflow description",
446
+ project="project-id",
447
+ yaml_config="your-yaml-configuration",
448
+ mode="SEQUENTIAL", # Optional, defaults to SEQUENTIAL
449
+ shared=False, # Optional, defaults to False
450
+ icon_url="https://example.com/icon.png" # Optional
451
+ )
452
+ result = client.workflow.create_workflow(workflow_request)
453
+ ```
454
+
455
+ 2. **Update Workflow**
456
+ ```python
457
+ from codemie_sdk.models.workflow import WorkflowUpdateRequest
458
+
459
+ # Update existing workflow
460
+ update_request = WorkflowUpdateRequest(
461
+ name="Updated Workflow",
462
+ description="Updated description",
463
+ yaml_config="updated-yaml-config",
464
+ mode="PARALLEL",
465
+ shared=True
466
+ )
467
+ result = client.workflow.update("workflow-id", update_request)
468
+ ```
469
+
470
+ 3. **List Workflows**
471
+ ```python
472
+ # List workflows with pagination and filtering
473
+ workflows = client.workflow.list(
474
+ page=0,
475
+ per_page=10,
476
+ projects=["project1", "project2"] # Optional project filter
477
+ )
478
+ ```
479
+
480
+ 4. **Get Workflow Details**
481
+ ```python
482
+ # Get workflow by ID
483
+ workflow = client.workflow.get("workflow-id")
484
+
485
+ # Get prebuilt workflows
486
+ prebuilt_workflows = client.workflow.get_prebuilt()
487
+ ```
488
+
489
+ 5. **Delete Workflow**
490
+ ```python
491
+ result = client.workflow.delete("workflow-id")
492
+ ```
493
+
494
+ #### Workflow Execution
495
+
496
+ The SDK provides comprehensive workflow execution management through the WorkflowExecutionService:
497
+
498
+ 1. **Run Workflow**
499
+ ```python
500
+ # Simple workflow execution
501
+ execution = client.workflow.run("workflow-id", user_input="optional input")
502
+
503
+ # Get execution service for advanced operations
504
+ execution_service = client.workflow.executions("workflow-id")
505
+ ```
506
+
507
+ 2. **Manage Executions**
508
+ ```python
509
+ # List workflow executions
510
+ executions = execution_service.list(
511
+ page=0,
512
+ per_page=10
513
+ )
514
+
515
+ # Get execution details
516
+ execution = execution_service.get("execution-id")
517
+
518
+ # Abort running execution
519
+ result = execution_service.abort("execution-id")
520
+
521
+ # Resume interrupted execution
522
+ result = execution_service.resume("execution-id")
523
+
524
+ # Delete all executions
525
+ result = execution_service.delete_all()
526
+ ```
527
+
528
+ #### Workflow Configuration
529
+
530
+ Workflows support various configuration options:
531
+
532
+ 1. **Modes**:
533
+ - `SEQUENTIAL`: Tasks execute in sequence
534
+ - `PARALLEL`: Tasks can execute simultaneously
535
+
536
+ 2. **YAML Configuration**:
537
+ ```yaml
538
+ name: Example Workflow
539
+ description: Workflow description
540
+ tasks:
541
+ - name: task1
542
+ type: llm
543
+ config:
544
+ prompt: "Your prompt here"
545
+ model: "gpt-4"
546
+
547
+ - name: task2
548
+ type: tool
549
+ config:
550
+ tool_name: "your-tool"
551
+ parameters:
552
+ param1: "value1"
553
+ ```
554
+
555
+ #### Best Practices
556
+
557
+ 1. **Workflow Design**:
558
+ - Keep workflows modular and focused
559
+ - Use clear, descriptive names for workflows and tasks
560
+ - Document workflow purpose and requirements
561
+ - Test workflows thoroughly before deployment
562
+
563
+ 2. **Execution Management**:
564
+ - Monitor long-running workflows
565
+ - Implement proper error handling
566
+ - Use pagination for listing executions
567
+ - Clean up completed executions regularly
568
+
569
+ 3. **Performance Optimization**:
570
+ - Choose appropriate workflow mode (SEQUENTIAL/PARALLEL)
571
+ - Manage resource usage in parallel workflows
572
+ - Consider task dependencies and ordering
573
+ - Use efficient task configurations
574
+
575
+ 4. **Security**:
576
+ - Control workflow sharing carefully
577
+ - Validate user inputs
578
+ - Manage sensitive data appropriately
579
+ - Regular audit of workflow access
580
+
581
+ 5. **Maintenance**:
582
+ - Regular review of workflow configurations
583
+ - Update workflows when dependencies change
584
+ - Monitor workflow performance
585
+ - Archive or remove unused workflows
586
+
587
+ #### Error Handling
588
+
589
+ Implement proper error handling for workflow operations:
590
+
591
+ ```python
592
+ try:
593
+ workflow = client.workflow.get("workflow-id")
594
+ except ApiError as e:
595
+ if e.status_code == 404:
596
+ print("Workflow not found")
597
+ else:
598
+ print(f"API error: {e}")
599
+ except Exception as e:
600
+ print(f"Unexpected error: {e}")
601
+ ```
602
+
603
+ #### Workflow Status Monitoring
604
+
605
+ Monitor workflow execution status:
606
+
607
+ ```python
608
+ def monitor_execution(execution_service, execution_id):
609
+ while True:
610
+ execution = execution_service.get(execution_id)
611
+ status = execution.status
612
+
613
+ if status == "COMPLETED":
614
+ print("Workflow completed successfully")
615
+ break
616
+ elif status == "FAILED":
617
+ print(f"Workflow failed: {execution.error}")
618
+ break
619
+ elif status == "ABORTED":
620
+ print("Workflow was aborted")
621
+ break
622
+
623
+ time.sleep(5) # Poll every 5 seconds
624
+ ```
625
+
626
+ ## Error Handling
627
+
628
+ The SDK implements comprehensive error handling. All API calls may raise exceptions for:
629
+ - Authentication failures
630
+ - Network errors
631
+ - Invalid parameters
632
+ - Server-side errors
633
+
634
+ It's recommended to implement try-catch blocks around SDK operations to handle potential exceptions gracefully.
635
+
636
+ ## Authentication
637
+
638
+ The SDK supports two authentication methods through Keycloak:
639
+
640
+ 1. Username/Password Authentication
641
+ 2. Client Credentials Authentication
642
+
643
+ ### Required Parameters
644
+
645
+ You must provide either:
646
+
647
+ - Username/Password credentials:
648
+ ```python
649
+ {
650
+ "username": "your-username",
651
+ "password": "your-password",
652
+ "auth_client_id": "client-id", # Optional, defaults to "codemie-sdk"
653
+ "auth_realm_name": "realm-name",
654
+ "auth_server_url": "keycloak-url",
655
+ "verify_ssl": True # Optional, defaults to True
656
+ }
657
+ ```
658
+
659
+ OR
660
+
661
+ - Client Credentials:
662
+ ```python
663
+ {
664
+ "auth_client_id": "your-client-id",
665
+ "auth_client_secret": "your-client-secret",
666
+ "auth_realm_name": "realm-name",
667
+ "auth_server_url": "keycloak-url",
668
+ "verify_ssl": True # Optional, defaults to True
669
+ }
670
+ ```
671
+
672
+ ### Usage Examples
673
+
674
+ 1. Username/Password Authentication:
675
+ ```python
676
+ from codemie_sdk import CodeMieClient
677
+
678
+ client = CodeMieClient(
679
+ codemie_api_domain="https://api.domain.com",
680
+ username="your-username",
681
+ password="your-password",
682
+ auth_client_id="your-client-id", # Optional
683
+ auth_realm_name="your-realm",
684
+ auth_server_url="https://keycloak.domain.com/auth",
685
+ verify_ssl=True # Optional
686
+ )
687
+ ```
688
+
689
+ 2. Client Credentials Authentication:
690
+ ```python
691
+ from codemie_sdk.auth import KeycloakCredentials
692
+
693
+ credentials = KeycloakCredentials(
694
+ server_url="https://keycloak.domain.com/auth",
695
+ realm_name="your-realm",
696
+ client_id="your-client-id",
697
+ client_secret="your-client-secret",
698
+ verify_ssl=True # Optional
699
+ )
700
+
701
+ client = CodeMieClient(
702
+ codemie_api_domain="https://api.domain.com",
703
+ credentials=credentials
704
+ )
705
+ ```
706
+
707
+ ## Support
708
+ For providing credentials please contact AI/Run CodeMie Team: Vadym_Vlasenko@epam.com or Nikita_Levyankov@epam.com
709
+