codemie-sdk-python 0.1.52__py3-none-any.whl → 0.1.258__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.

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