codemie-sdk-python 0.1.5__tar.gz → 0.1.7__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.
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/PKG-INFO +95 -2
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/README.md +95 -1
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/pyproject.toml +10 -1
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/client/client.py +5 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/models/assistant.py +62 -1
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/models/datasource.py +6 -2
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/models/integration.py +8 -2
- codemie_sdk_python-0.1.7/src/codemie_sdk/models/workflow_state.py +51 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/workflow_execution.py +12 -0
- codemie_sdk_python-0.1.7/src/codemie_sdk/services/workflow_execution_state.py +61 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/utils/http.py +10 -4
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/__init__.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/auth/__init__.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/auth/credentials.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/client/__init__.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/exceptions.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/models/common.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/models/llm.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/models/task.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/models/user.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/models/workflow.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/assistant.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/datasource.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/integration.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/llm.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/task.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/user.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/workflow.py +0 -0
- {codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/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.7
|
|
4
4
|
Summary: CodeMie SDK for Python
|
|
5
5
|
Author: Vadym Vlasenko
|
|
6
6
|
Author-email: vadym_vlasenko@epam.com
|
|
@@ -169,7 +169,7 @@ result = client.assistant.delete("assistant-id")
|
|
|
169
169
|
from codemie_sdk.models.assistant import AssistantChatRequest
|
|
170
170
|
|
|
171
171
|
chat_request = AssistantChatRequest(
|
|
172
|
-
|
|
172
|
+
text="Your message here",
|
|
173
173
|
stream=False, # Set to True for streaming response
|
|
174
174
|
# Additional parameters
|
|
175
175
|
)
|
|
@@ -525,6 +525,37 @@ result = execution_service.resume("execution-id")
|
|
|
525
525
|
result = execution_service.delete_all()
|
|
526
526
|
```
|
|
527
527
|
|
|
528
|
+
3. **Work with Execution States**
|
|
529
|
+
```python
|
|
530
|
+
# Get execution states
|
|
531
|
+
states = execution_service.states(execution_id).list()
|
|
532
|
+
|
|
533
|
+
# Get state output
|
|
534
|
+
state_output = execution_service.states(execution_id).get_output(state_id)
|
|
535
|
+
|
|
536
|
+
# Example of monitoring workflow with state verification
|
|
537
|
+
def verify_workflow_execution(execution_service, execution_id):
|
|
538
|
+
execution = execution_service.get(execution_id)
|
|
539
|
+
|
|
540
|
+
if execution.status == ExecutionStatus.SUCCEEDED:
|
|
541
|
+
# Get and verify states
|
|
542
|
+
states = execution_service.states(execution_id).list()
|
|
543
|
+
|
|
544
|
+
# States are ordered by completion date
|
|
545
|
+
if len(states) >= 2:
|
|
546
|
+
first_state = states[0]
|
|
547
|
+
second_state = states[1]
|
|
548
|
+
assert first_state.completed_at < second_state.completed_at
|
|
549
|
+
|
|
550
|
+
# Get state outputs
|
|
551
|
+
for state in states:
|
|
552
|
+
output = execution_service.states(execution_id).get_output(state.id)
|
|
553
|
+
print(f"State {state.id} output: {output.output}")
|
|
554
|
+
|
|
555
|
+
elif execution.status == ExecutionStatus.FAILED:
|
|
556
|
+
print(f"Workflow failed: {execution.error_message}")
|
|
557
|
+
```
|
|
558
|
+
|
|
528
559
|
#### Workflow Configuration
|
|
529
560
|
|
|
530
561
|
Workflows support various configuration options:
|
|
@@ -707,3 +738,65 @@ client = CodeMieClient(
|
|
|
707
738
|
## Support
|
|
708
739
|
For providing credentials please contact AI/Run CodeMie Team: Vadym_Vlasenko@epam.com or Nikita_Levyankov@epam.com
|
|
709
740
|
|
|
741
|
+
## Running tests
|
|
742
|
+
|
|
743
|
+
For running tests on custom environment you should create .env file in the root directory
|
|
744
|
+
|
|
745
|
+
``` properties
|
|
746
|
+
|
|
747
|
+
AUTH_SERVER_URL=https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth
|
|
748
|
+
AUTH_CLIENT_ID=codemie-preview
|
|
749
|
+
AUTH_CLIENT_SECRET=<your_secret>
|
|
750
|
+
AUTH_REALM_NAME=codemie-prod
|
|
751
|
+
CODEMIE_API_DOMAIN=https://codemie-preview.lab.epam.com/code-assistant-api
|
|
752
|
+
VERIFY_SSL=False
|
|
753
|
+
|
|
754
|
+
USERNAME=<username>
|
|
755
|
+
PASSWORD=<password>
|
|
756
|
+
|
|
757
|
+
PROJECT_NAME=automation-tests-project
|
|
758
|
+
|
|
759
|
+
DEFAULT_TIMEOUT=60
|
|
760
|
+
|
|
761
|
+
GITLAB_URL=https://gitbud.epam.com
|
|
762
|
+
GITLAB_TOKEN=<gitlab_token>
|
|
763
|
+
GITLAB_PROJECT=https://gitbud.epam.com/epm-cdme/autotests/codemie-test-project
|
|
764
|
+
GITLAB_PROJECT_ID=<project_id>
|
|
765
|
+
|
|
766
|
+
GITHUB_URL=https://github.com
|
|
767
|
+
GITHUB_TOKEN=<github_token>
|
|
768
|
+
GITHUB_PROJECT=https://github.com/wild47/final_task
|
|
769
|
+
|
|
770
|
+
JIRA_URL=https://jiraeu.epam.com
|
|
771
|
+
JIRA_TOKEN=<jira_token>
|
|
772
|
+
JQL="project = 'EPMCDME' and issuetype = 'Epic' and status = 'Closed'"
|
|
773
|
+
|
|
774
|
+
CONFLUENCE_URL=https://kb.epam.com
|
|
775
|
+
CONFLUENCE_TOKEN=<konfluence_token>
|
|
776
|
+
CQL="space = EPMCDME and type = page and title = 'AQA Backlog Estimation'"
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
Run all tests
|
|
780
|
+
|
|
781
|
+
```shell
|
|
782
|
+
pytest -n auto --reruns 1
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
Run e2e tests
|
|
786
|
+
|
|
787
|
+
```shell
|
|
788
|
+
pytest -n auto -m e2e --reruns 1
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
Run tests for e2e tests for specific integration/tool.
|
|
792
|
+
Available marks:
|
|
793
|
+
- jira_kb
|
|
794
|
+
- confluence_kb
|
|
795
|
+
- code_kb
|
|
796
|
+
- gitlab
|
|
797
|
+
- github
|
|
798
|
+
- git
|
|
799
|
+
|
|
800
|
+
```shell
|
|
801
|
+
pytest -n auto -m "jira_kb or github" --reruns 1
|
|
802
|
+
```
|
|
@@ -156,7 +156,7 @@ result = client.assistant.delete("assistant-id")
|
|
|
156
156
|
from codemie_sdk.models.assistant import AssistantChatRequest
|
|
157
157
|
|
|
158
158
|
chat_request = AssistantChatRequest(
|
|
159
|
-
|
|
159
|
+
text="Your message here",
|
|
160
160
|
stream=False, # Set to True for streaming response
|
|
161
161
|
# Additional parameters
|
|
162
162
|
)
|
|
@@ -512,6 +512,37 @@ result = execution_service.resume("execution-id")
|
|
|
512
512
|
result = execution_service.delete_all()
|
|
513
513
|
```
|
|
514
514
|
|
|
515
|
+
3. **Work with Execution States**
|
|
516
|
+
```python
|
|
517
|
+
# Get execution states
|
|
518
|
+
states = execution_service.states(execution_id).list()
|
|
519
|
+
|
|
520
|
+
# Get state output
|
|
521
|
+
state_output = execution_service.states(execution_id).get_output(state_id)
|
|
522
|
+
|
|
523
|
+
# Example of monitoring workflow with state verification
|
|
524
|
+
def verify_workflow_execution(execution_service, execution_id):
|
|
525
|
+
execution = execution_service.get(execution_id)
|
|
526
|
+
|
|
527
|
+
if execution.status == ExecutionStatus.SUCCEEDED:
|
|
528
|
+
# Get and verify states
|
|
529
|
+
states = execution_service.states(execution_id).list()
|
|
530
|
+
|
|
531
|
+
# States are ordered by completion date
|
|
532
|
+
if len(states) >= 2:
|
|
533
|
+
first_state = states[0]
|
|
534
|
+
second_state = states[1]
|
|
535
|
+
assert first_state.completed_at < second_state.completed_at
|
|
536
|
+
|
|
537
|
+
# Get state outputs
|
|
538
|
+
for state in states:
|
|
539
|
+
output = execution_service.states(execution_id).get_output(state.id)
|
|
540
|
+
print(f"State {state.id} output: {output.output}")
|
|
541
|
+
|
|
542
|
+
elif execution.status == ExecutionStatus.FAILED:
|
|
543
|
+
print(f"Workflow failed: {execution.error_message}")
|
|
544
|
+
```
|
|
545
|
+
|
|
515
546
|
#### Workflow Configuration
|
|
516
547
|
|
|
517
548
|
Workflows support various configuration options:
|
|
@@ -693,3 +724,66 @@ client = CodeMieClient(
|
|
|
693
724
|
|
|
694
725
|
## Support
|
|
695
726
|
For providing credentials please contact AI/Run CodeMie Team: Vadym_Vlasenko@epam.com or Nikita_Levyankov@epam.com
|
|
727
|
+
|
|
728
|
+
## Running tests
|
|
729
|
+
|
|
730
|
+
For running tests on custom environment you should create .env file in the root directory
|
|
731
|
+
|
|
732
|
+
``` properties
|
|
733
|
+
|
|
734
|
+
AUTH_SERVER_URL=https://keycloak.eks-core.aws.main.edp.projects.epam.com/auth
|
|
735
|
+
AUTH_CLIENT_ID=codemie-preview
|
|
736
|
+
AUTH_CLIENT_SECRET=<your_secret>
|
|
737
|
+
AUTH_REALM_NAME=codemie-prod
|
|
738
|
+
CODEMIE_API_DOMAIN=https://codemie-preview.lab.epam.com/code-assistant-api
|
|
739
|
+
VERIFY_SSL=False
|
|
740
|
+
|
|
741
|
+
USERNAME=<username>
|
|
742
|
+
PASSWORD=<password>
|
|
743
|
+
|
|
744
|
+
PROJECT_NAME=automation-tests-project
|
|
745
|
+
|
|
746
|
+
DEFAULT_TIMEOUT=60
|
|
747
|
+
|
|
748
|
+
GITLAB_URL=https://gitbud.epam.com
|
|
749
|
+
GITLAB_TOKEN=<gitlab_token>
|
|
750
|
+
GITLAB_PROJECT=https://gitbud.epam.com/epm-cdme/autotests/codemie-test-project
|
|
751
|
+
GITLAB_PROJECT_ID=<project_id>
|
|
752
|
+
|
|
753
|
+
GITHUB_URL=https://github.com
|
|
754
|
+
GITHUB_TOKEN=<github_token>
|
|
755
|
+
GITHUB_PROJECT=https://github.com/wild47/final_task
|
|
756
|
+
|
|
757
|
+
JIRA_URL=https://jiraeu.epam.com
|
|
758
|
+
JIRA_TOKEN=<jira_token>
|
|
759
|
+
JQL="project = 'EPMCDME' and issuetype = 'Epic' and status = 'Closed'"
|
|
760
|
+
|
|
761
|
+
CONFLUENCE_URL=https://kb.epam.com
|
|
762
|
+
CONFLUENCE_TOKEN=<konfluence_token>
|
|
763
|
+
CQL="space = EPMCDME and type = page and title = 'AQA Backlog Estimation'"
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
Run all tests
|
|
767
|
+
|
|
768
|
+
```shell
|
|
769
|
+
pytest -n auto --reruns 1
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
Run e2e tests
|
|
773
|
+
|
|
774
|
+
```shell
|
|
775
|
+
pytest -n auto -m e2e --reruns 1
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
Run tests for e2e tests for specific integration/tool.
|
|
779
|
+
Available marks:
|
|
780
|
+
- jira_kb
|
|
781
|
+
- confluence_kb
|
|
782
|
+
- code_kb
|
|
783
|
+
- gitlab
|
|
784
|
+
- github
|
|
785
|
+
- git
|
|
786
|
+
|
|
787
|
+
```shell
|
|
788
|
+
pytest -n auto -m "jira_kb or github" --reruns 1
|
|
789
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "codemie-sdk-python"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.7"
|
|
4
4
|
description = "CodeMie SDK for Python"
|
|
5
5
|
authors = [
|
|
6
6
|
"Vadym Vlasenko <vadym_vlasenko@epam.com>",
|
|
@@ -19,6 +19,15 @@ pydantic = "^2.11.1"
|
|
|
19
19
|
ruff = "^0.11.3"
|
|
20
20
|
pytest-cov = "^6.0.0"
|
|
21
21
|
|
|
22
|
+
[tool.poetry.group.test.dependencies]
|
|
23
|
+
python-dotenv = "^1.1.0"
|
|
24
|
+
PyHamcrest = "^2.1.0"
|
|
25
|
+
pytest-xdist = "^3.6.1"
|
|
26
|
+
pytest-rerunfailures = "^15.1"
|
|
27
|
+
python-gitlab = "^5.6.0"
|
|
28
|
+
boto3 = "^1.38.20"
|
|
29
|
+
aws-assume-role-lib = "^2.10.0"
|
|
30
|
+
|
|
22
31
|
[build-system]
|
|
23
32
|
requires = ["poetry-core"]
|
|
24
33
|
build-backend = "poetry.core.masonry.api"
|
|
@@ -51,6 +51,11 @@ class CodeMieClient:
|
|
|
51
51
|
self._token: Optional[str] = None
|
|
52
52
|
self._api_domain = codemie_api_domain.rstrip("/")
|
|
53
53
|
self._verify_ssl = verify_ssl
|
|
54
|
+
if not verify_ssl:
|
|
55
|
+
import requests
|
|
56
|
+
from urllib3.exceptions import InsecureRequestWarning
|
|
57
|
+
|
|
58
|
+
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
|
54
59
|
|
|
55
60
|
# Initialize token first
|
|
56
61
|
self._token = self.auth.get_token()
|
|
@@ -11,6 +11,54 @@ from .common import User
|
|
|
11
11
|
from .integration import Integration
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
class GitToolName(str, Enum):
|
|
15
|
+
"""Enum for Git tool names."""
|
|
16
|
+
|
|
17
|
+
LIST_BRANCHES_IN_REPO = "list_branches_in_repo"
|
|
18
|
+
CREATE_BRANCH = "create_branch"
|
|
19
|
+
SET_ACTIVE_BRANCH = "set_active_branch"
|
|
20
|
+
CREATE_FILE = "create_file"
|
|
21
|
+
UPDATE_FILE = "update_file"
|
|
22
|
+
UPDATE_FILE_DIFF = "update_file_diff"
|
|
23
|
+
DELETE_FILE = "delete_file"
|
|
24
|
+
CREATE_PULL_REQUEST = "create_pull_request"
|
|
25
|
+
GET_PR_CHANGES = "get_pr_changes"
|
|
26
|
+
CREATE_PR_CHANGES_COMMENT = "create_pr_changes_comment"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CodeBaseToolName(str, Enum):
|
|
30
|
+
"""Enum for Git tool names."""
|
|
31
|
+
|
|
32
|
+
SONAR = "Sonar"
|
|
33
|
+
SONAR_CLOUD = "Sonar"
|
|
34
|
+
GET_REPOSITORY_FILE_TREE_V2 = "get_repository_file_tree_v2"
|
|
35
|
+
SEARCH_CODE_REPO_V2 = "search_code_repo_v2"
|
|
36
|
+
READ_FILES_CONTENT = "read_files_content"
|
|
37
|
+
READ_FILES_CONTENT_SUMMARY = "read_files_content_summary"
|
|
38
|
+
SEARCH_CODE_REPO_BY_PATH = "search_code_repo_by_path"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class VcsToolName(str, Enum):
|
|
42
|
+
"""Enum for VCS tool names."""
|
|
43
|
+
|
|
44
|
+
GITLAB = "gitlab"
|
|
45
|
+
GITHUB = "github"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class CloudToolName(str, Enum):
|
|
49
|
+
"""Enum for VCS tool names."""
|
|
50
|
+
|
|
51
|
+
AWS = "AWS"
|
|
52
|
+
GCP = "GCP"
|
|
53
|
+
AZURE = "Azure"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class PluginToolName(str, Enum):
|
|
57
|
+
"""Enum for VCS tool names."""
|
|
58
|
+
|
|
59
|
+
PLUGIN = "Plugin"
|
|
60
|
+
|
|
61
|
+
|
|
14
62
|
class ToolDetails(BaseModel):
|
|
15
63
|
"""Model for tool details."""
|
|
16
64
|
|
|
@@ -23,6 +71,16 @@ class ToolDetails(BaseModel):
|
|
|
23
71
|
settings: Optional[Integration] = None
|
|
24
72
|
|
|
25
73
|
|
|
74
|
+
class Toolkit(str, Enum):
|
|
75
|
+
"""Enum for toolkits."""
|
|
76
|
+
|
|
77
|
+
GIT = "Git"
|
|
78
|
+
VCS = "VCS"
|
|
79
|
+
CODEBASE_TOOLS = "Codebase Tools"
|
|
80
|
+
CLOUD = "Cloud"
|
|
81
|
+
PLUGIN = "Plugin"
|
|
82
|
+
|
|
83
|
+
|
|
26
84
|
class ToolKitDetails(BaseModel):
|
|
27
85
|
"""Model for toolkit details."""
|
|
28
86
|
|
|
@@ -149,7 +207,7 @@ class AssistantChatRequest(BaseModel):
|
|
|
149
207
|
conversation_id: Optional[str] = Field(
|
|
150
208
|
default=str(uuid.uuid4()), description="Conversation identifier"
|
|
151
209
|
)
|
|
152
|
-
text:
|
|
210
|
+
text: str = Field(description="User's input")
|
|
153
211
|
content_raw: Optional[str] = Field(default="", description="Raw content input")
|
|
154
212
|
file_name: Optional[str] = Field(default=None, description="Associated file name")
|
|
155
213
|
llm_model: Optional[str] = Field(
|
|
@@ -166,6 +224,9 @@ class AssistantChatRequest(BaseModel):
|
|
|
166
224
|
top_k: int = Field(default=10, description="Top K results to consider")
|
|
167
225
|
system_prompt: str = Field(default="", description="Override system prompt")
|
|
168
226
|
background_task: bool = Field(default=False, description="Run as background task")
|
|
227
|
+
metadata: Optional[dict[str, Any]] = Field(
|
|
228
|
+
default=None, description="Provide additional metadata"
|
|
229
|
+
)
|
|
169
230
|
|
|
170
231
|
|
|
171
232
|
class BaseModelResponse(BaseModel):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from enum import Enum
|
|
4
|
-
from typing import Optional, List
|
|
4
|
+
from typing import Optional, List, Union
|
|
5
5
|
|
|
6
6
|
from pydantic import BaseModel, Field, model_validator, ConfigDict, field_validator
|
|
7
7
|
|
|
@@ -20,6 +20,10 @@ class DataSourceType(str, Enum):
|
|
|
20
20
|
JIRA = "knowledge_base_jira"
|
|
21
21
|
FILE = "knowledge_base_file"
|
|
22
22
|
GOOGLE = "llm_routing_google"
|
|
23
|
+
PROVIDER = "provider"
|
|
24
|
+
SUMMARY = "summary"
|
|
25
|
+
CHUNK_SUMMARY = "chunk-summary"
|
|
26
|
+
JSON = "knowledge_base_json"
|
|
23
27
|
|
|
24
28
|
|
|
25
29
|
class DataSourceStatus(str, Enum):
|
|
@@ -37,7 +41,7 @@ class DataSourceProcessingInfo(BaseModel):
|
|
|
37
41
|
total_size_kb: Optional[float] = None
|
|
38
42
|
average_file_size_bytes: Optional[float] = None
|
|
39
43
|
unique_extensions: Optional[List[str]] = None
|
|
40
|
-
filtered_documents: Optional[int] = None
|
|
44
|
+
filtered_documents: Optional[Union[int, list]] = None
|
|
41
45
|
processed_documents_count: Optional[int] = Field(None, alias="documents_count_key")
|
|
42
46
|
|
|
43
47
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""Models for assistant-related data structures."""
|
|
2
2
|
|
|
3
|
-
from datetime import datetime
|
|
4
3
|
from enum import Enum
|
|
5
4
|
from typing import List, Optional, Any
|
|
5
|
+
from datetime import datetime
|
|
6
6
|
|
|
7
|
-
from pydantic import BaseModel, Field, ConfigDict
|
|
7
|
+
from pydantic import BaseModel, Field, ConfigDict, field_serializer
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class CredentialTypes(str, Enum):
|
|
@@ -33,6 +33,8 @@ class CredentialTypes(str, Enum):
|
|
|
33
33
|
ZEPHYR_SQUAD = "ZephyrSquad"
|
|
34
34
|
SERVICE_NOW = "ServiceNow"
|
|
35
35
|
DIAL = "DIAL"
|
|
36
|
+
A2A = "A2A"
|
|
37
|
+
MCP = "MCP"
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
class IntegrationType(str, Enum):
|
|
@@ -66,3 +68,7 @@ class Integration(BaseModel):
|
|
|
66
68
|
credential_type: CredentialTypes
|
|
67
69
|
credential_values: List[CredentialValues]
|
|
68
70
|
setting_type: IntegrationType = Field(default=IntegrationType.USER)
|
|
71
|
+
|
|
72
|
+
@field_serializer("date", "update_date")
|
|
73
|
+
def serialize_dt(self, dt: datetime, _info):
|
|
74
|
+
return dt.isoformat()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Workflow execution state models."""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from enum import Enum
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, ConfigDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class WorkflowExecutionStatusEnum(str, Enum):
|
|
11
|
+
"""Workflow execution state status."""
|
|
12
|
+
|
|
13
|
+
IN_PROGRESS = "In Progress"
|
|
14
|
+
NOT_STARTED = "Not Started"
|
|
15
|
+
INTERRUPTED = "Interrupted"
|
|
16
|
+
FAILED = "Failed"
|
|
17
|
+
SUCCEEDED = "Succeeded"
|
|
18
|
+
ABORTED = "Aborted"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class WorkflowExecutionStateThought(BaseModel):
|
|
22
|
+
"""Model for workflow execution state thought."""
|
|
23
|
+
|
|
24
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
25
|
+
|
|
26
|
+
id: str
|
|
27
|
+
text: str
|
|
28
|
+
created_at: datetime
|
|
29
|
+
parent_id: Optional[str] = None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class WorkflowExecutionState(BaseModel):
|
|
33
|
+
"""Model for workflow execution state."""
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
36
|
+
|
|
37
|
+
id: str
|
|
38
|
+
execution_id: str
|
|
39
|
+
name: str
|
|
40
|
+
task: Optional[str] = ""
|
|
41
|
+
status: WorkflowExecutionStatusEnum = WorkflowExecutionStatusEnum.NOT_STARTED
|
|
42
|
+
started_at: Optional[datetime] = None
|
|
43
|
+
completed_at: Optional[datetime] = None
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class WorkflowExecutionStateOutput(BaseModel):
|
|
47
|
+
"""Model for workflow execution state output."""
|
|
48
|
+
|
|
49
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
50
|
+
|
|
51
|
+
output: Optional[str] = None
|
{codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/workflow_execution.py
RENAMED
|
@@ -4,6 +4,7 @@ from typing import List, Optional
|
|
|
4
4
|
|
|
5
5
|
from ..models.common import PaginationParams
|
|
6
6
|
from ..models.workflow import WorkflowExecution
|
|
7
|
+
from .workflow_execution_state import WorkflowExecutionStateService
|
|
7
8
|
from ..utils import ApiRequestHandler
|
|
8
9
|
|
|
9
10
|
|
|
@@ -71,6 +72,17 @@ class WorkflowExecutionService:
|
|
|
71
72
|
WorkflowExecution,
|
|
72
73
|
)
|
|
73
74
|
|
|
75
|
+
def states(self, execution_id: str) -> WorkflowExecutionStateService:
|
|
76
|
+
"""Get states service for a specific workflow execution.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
execution_id: ID of the execution to get states for
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
WorkflowExecutionStateService: Service for managing states of this execution
|
|
83
|
+
"""
|
|
84
|
+
return WorkflowExecutionStateService(self._api, self._workflow_id, execution_id)
|
|
85
|
+
|
|
74
86
|
def delete_all(self) -> dict:
|
|
75
87
|
"""Delete all workflow executions."""
|
|
76
88
|
return self._api.delete(f"/v1/workflows/{self._workflow_id}/executions", dict)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Workflow execution state service implementation."""
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from ..models.common import PaginationParams
|
|
6
|
+
from ..models.workflow_state import (
|
|
7
|
+
WorkflowExecutionState,
|
|
8
|
+
WorkflowExecutionStateOutput,
|
|
9
|
+
)
|
|
10
|
+
from ..utils import ApiRequestHandler
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class WorkflowExecutionStateService:
|
|
14
|
+
"""Service for managing workflow execution states."""
|
|
15
|
+
|
|
16
|
+
def __init__(self, api: ApiRequestHandler, workflow_id: str, execution_id: str):
|
|
17
|
+
"""Initialize the workflow execution state service.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
api: Request handler for API
|
|
21
|
+
workflow_id: ID of the workflow this service manages states for
|
|
22
|
+
execution_id: ID of the execution this service manages states for
|
|
23
|
+
"""
|
|
24
|
+
self._api = api
|
|
25
|
+
self._workflow_id = workflow_id
|
|
26
|
+
self._execution_id = execution_id
|
|
27
|
+
|
|
28
|
+
def list(
|
|
29
|
+
self,
|
|
30
|
+
page: int = 0,
|
|
31
|
+
per_page: int = 10,
|
|
32
|
+
) -> List[WorkflowExecutionState]:
|
|
33
|
+
"""List states for the workflow execution with filtering and pagination support.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
page: Page number (0-based). Must be >= 0. Defaults to 0.
|
|
37
|
+
per_page: Number of items per page. Must be > 0. Defaults to 10.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
List of WorkflowExecutionState containing state information.
|
|
41
|
+
"""
|
|
42
|
+
params = PaginationParams(page=page, per_page=per_page).to_dict()
|
|
43
|
+
return self._api.get(
|
|
44
|
+
f"/v1/workflows/{self._workflow_id}/executions/{self._execution_id}/states",
|
|
45
|
+
List[WorkflowExecutionState],
|
|
46
|
+
params=params,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def get_output(self, state_id: str) -> WorkflowExecutionStateOutput:
|
|
50
|
+
"""Get output for a specific execution state.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
state_id: ID of the state to get output for
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
WorkflowExecutionStateOutput containing the state output.
|
|
57
|
+
"""
|
|
58
|
+
return self._api.get(
|
|
59
|
+
f"/v1/workflows/{self._workflow_id}/executions/{self._execution_id}/states/{state_id}/output",
|
|
60
|
+
WorkflowExecutionStateOutput,
|
|
61
|
+
)
|
|
@@ -48,10 +48,16 @@ class ApiRequestHandler:
|
|
|
48
48
|
|
|
49
49
|
def _get_headers(self) -> dict:
|
|
50
50
|
"""Gets request headers with auth token."""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
51
|
+
headers = {"Content-Type": "application/json"}
|
|
52
|
+
if (
|
|
53
|
+
"0.0.0.0" in self._base_url
|
|
54
|
+
or "127.0.0.1" in self._base_url
|
|
55
|
+
or "localhost" in self._base_url
|
|
56
|
+
):
|
|
57
|
+
headers["User-Id"] = "dev-codemie-user"
|
|
58
|
+
else:
|
|
59
|
+
headers["Authorization"] = f"Bearer {self._token}"
|
|
60
|
+
return headers
|
|
55
61
|
|
|
56
62
|
def _parse_response(
|
|
57
63
|
self,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/datasource.py
RENAMED
|
File without changes
|
{codemie_sdk_python-0.1.5 → codemie_sdk_python-0.1.7}/src/codemie_sdk/services/integration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|