codemie-sdk-python 0.1.135__py3-none-any.whl → 0.1.136__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.
- codemie_sdk/client/client.py +7 -0
- codemie_sdk/models/conversation.py +160 -0
- codemie_sdk/services/conversation.py +71 -0
- {codemie_sdk_python-0.1.135.dist-info → codemie_sdk_python-0.1.136.dist-info}/METADATA +33 -1
- {codemie_sdk_python-0.1.135.dist-info → codemie_sdk_python-0.1.136.dist-info}/RECORD +6 -4
- {codemie_sdk_python-0.1.135.dist-info → codemie_sdk_python-0.1.136.dist-info}/WHEEL +0 -0
codemie_sdk/client/client.py
CHANGED
|
@@ -4,6 +4,7 @@ from typing import Optional
|
|
|
4
4
|
|
|
5
5
|
from ..auth.credentials import KeycloakCredentials
|
|
6
6
|
from ..services.assistant import AssistantService
|
|
7
|
+
from ..services.conversation import ConversationService
|
|
7
8
|
from ..services.datasource import DatasourceService
|
|
8
9
|
from ..services.llm import LLMService
|
|
9
10
|
from ..services.integration import IntegrationService
|
|
@@ -76,6 +77,9 @@ class CodeMieClient:
|
|
|
76
77
|
self.workflows = WorkflowService(
|
|
77
78
|
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
78
79
|
)
|
|
80
|
+
self.conversations = ConversationService(
|
|
81
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
82
|
+
)
|
|
79
83
|
|
|
80
84
|
@property
|
|
81
85
|
def token(self) -> str:
|
|
@@ -109,4 +113,7 @@ class CodeMieClient:
|
|
|
109
113
|
self.workflows = WorkflowService(
|
|
110
114
|
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
111
115
|
)
|
|
116
|
+
self.conversations = ConversationService(
|
|
117
|
+
self._api_domain, self._token, verify_ssl=self._verify_ssl
|
|
118
|
+
)
|
|
112
119
|
return self._token
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"""Models for conversation-related data structures."""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing import List, Optional, Union
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
from codemie_sdk.models.assistant import ContextType
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Conversation(BaseModel):
|
|
12
|
+
"""
|
|
13
|
+
Model for conversation summary data as returned from the list endpoint.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
id: str
|
|
17
|
+
name: str
|
|
18
|
+
folder: Optional[str]
|
|
19
|
+
pinned: bool
|
|
20
|
+
date: str
|
|
21
|
+
assistant_ids: List[str]
|
|
22
|
+
initial_assistant_id: Optional[str]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class Mark(BaseModel):
|
|
26
|
+
"""Model for conversation review/mark data."""
|
|
27
|
+
|
|
28
|
+
mark: str
|
|
29
|
+
rating: int
|
|
30
|
+
comments: str
|
|
31
|
+
date: datetime
|
|
32
|
+
operator: Optional["Operator"] = None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Operator(BaseModel):
|
|
36
|
+
"""Represents an operator involved in marking a conversation."""
|
|
37
|
+
|
|
38
|
+
user_id: str
|
|
39
|
+
name: str
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class Thought(BaseModel):
|
|
43
|
+
"""Model for reasoning or tool-invocation within a message's history."""
|
|
44
|
+
|
|
45
|
+
id: str
|
|
46
|
+
parent_id: Optional[str]
|
|
47
|
+
metadata: dict
|
|
48
|
+
in_progress: bool
|
|
49
|
+
input_text: Optional[str]
|
|
50
|
+
message: Optional[str]
|
|
51
|
+
author_type: str
|
|
52
|
+
author_name: str
|
|
53
|
+
output_format: str
|
|
54
|
+
error: Optional[bool]
|
|
55
|
+
children: List[str]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class HistoryMark(BaseModel):
|
|
59
|
+
"""Model for conversation history review/mark data."""
|
|
60
|
+
|
|
61
|
+
mark: str
|
|
62
|
+
rating: int
|
|
63
|
+
comments: Optional[str]
|
|
64
|
+
date: datetime
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class HistoryItem(BaseModel):
|
|
68
|
+
"""Represents an individual message within a conversation's history."""
|
|
69
|
+
|
|
70
|
+
role: str
|
|
71
|
+
message: str
|
|
72
|
+
historyIndex: int
|
|
73
|
+
date: datetime
|
|
74
|
+
responseTime: Optional[float]
|
|
75
|
+
inputTokens: Optional[int]
|
|
76
|
+
outputTokens: Optional[int]
|
|
77
|
+
moneySpent: Optional[float]
|
|
78
|
+
userMark: Optional[HistoryMark]
|
|
79
|
+
operatorMark: Optional[HistoryMark]
|
|
80
|
+
messageRaw: Optional[str]
|
|
81
|
+
fileNames: List[str]
|
|
82
|
+
assistantId: Optional[str]
|
|
83
|
+
thoughts: Optional[List[Thought]] = Field(default_factory=list)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class ContextItem(BaseModel):
|
|
87
|
+
"""Represents contextual settings for conversation."""
|
|
88
|
+
|
|
89
|
+
context_type: Optional[ContextType]
|
|
90
|
+
name: str
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class ToolItem(BaseModel):
|
|
94
|
+
"""Represents a tool used by an assistant, including configuration and description."""
|
|
95
|
+
|
|
96
|
+
name: str
|
|
97
|
+
label: Optional[str]
|
|
98
|
+
settings_config: Optional[bool]
|
|
99
|
+
user_description: Optional[str]
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class AssistantDataItem(BaseModel):
|
|
103
|
+
"""Model represents details for an assistant included in a conversation."""
|
|
104
|
+
|
|
105
|
+
assistant_id: str
|
|
106
|
+
assistant_name: str
|
|
107
|
+
assistant_icon: str
|
|
108
|
+
assistant_type: str
|
|
109
|
+
context: List[Union[ContextItem, str]]
|
|
110
|
+
tools: List[ToolItem]
|
|
111
|
+
conversation_starters: List[str]
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class ConversationDetailsData(BaseModel):
|
|
115
|
+
"""Extended details about a conversation's configuration and context."""
|
|
116
|
+
|
|
117
|
+
llm_model: Optional[str]
|
|
118
|
+
context: List[ContextItem]
|
|
119
|
+
app_name: Optional[str]
|
|
120
|
+
repo_name: Optional[str]
|
|
121
|
+
index_type: Optional[str]
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class AssistantDetailsData(BaseModel):
|
|
125
|
+
"""Extended details about an assistant included in a conversation."""
|
|
126
|
+
|
|
127
|
+
assistant_id: str
|
|
128
|
+
assistant_name: str
|
|
129
|
+
assistant_icon: str
|
|
130
|
+
assistant_type: str
|
|
131
|
+
context: List[Union[ContextItem, str]]
|
|
132
|
+
tools: List[ToolItem]
|
|
133
|
+
conversation_starters: List[str]
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class ConversationDetails(BaseModel):
|
|
137
|
+
"""Summary information for a user conversation as returned from list endpoints."""
|
|
138
|
+
|
|
139
|
+
id: str
|
|
140
|
+
date: datetime
|
|
141
|
+
update_date: datetime
|
|
142
|
+
conversation_id: str
|
|
143
|
+
conversation_name: str
|
|
144
|
+
llm_model: Optional[str]
|
|
145
|
+
folder: Optional[str]
|
|
146
|
+
pinned: bool
|
|
147
|
+
history: List[HistoryItem]
|
|
148
|
+
user_id: str
|
|
149
|
+
user_name: str
|
|
150
|
+
assistant_ids: List[str]
|
|
151
|
+
assistant_data: List[AssistantDataItem]
|
|
152
|
+
initial_assistant_id: str
|
|
153
|
+
final_user_mark: Optional[Mark]
|
|
154
|
+
final_operator_mark: Optional[Mark]
|
|
155
|
+
project: str
|
|
156
|
+
conversation_details: Optional[ConversationDetailsData]
|
|
157
|
+
assistant_details: Optional[AssistantDetailsData]
|
|
158
|
+
user_abilities: Optional[List[str]]
|
|
159
|
+
is_folder_migrated: bool
|
|
160
|
+
category: Optional[str]
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""Conversation service implementation."""
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from ..models.conversation import Conversation, ConversationDetails
|
|
6
|
+
from ..utils import ApiRequestHandler
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ConversationService:
|
|
10
|
+
"""Service for managing user conversations."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, api_domain: str, token: str, verify_ssl: bool = True):
|
|
13
|
+
"""Initialize the conversation service.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
api_domain: Base URL for the API
|
|
17
|
+
token: Authentication token
|
|
18
|
+
verify_ssl: Whether to verify SSL certificates
|
|
19
|
+
"""
|
|
20
|
+
self._api = ApiRequestHandler(api_domain, token, verify_ssl)
|
|
21
|
+
|
|
22
|
+
def list(self) -> List[Conversation]:
|
|
23
|
+
"""Get list of all conversations for the current user.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
List of all conversations for the current user.
|
|
27
|
+
"""
|
|
28
|
+
return self._api.get("/v1/conversations", List[Conversation])
|
|
29
|
+
|
|
30
|
+
def list_by_assistant_id(self, assistant_id: str) -> List[Conversation]:
|
|
31
|
+
"""Get list of all conversations for the current user that include the specified assistant.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
assistant_id: Assistant ID
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
List of conversations for the specified assistant.
|
|
38
|
+
"""
|
|
39
|
+
return [
|
|
40
|
+
conv
|
|
41
|
+
for conv in self._api.get("/v1/conversations", List[Conversation])
|
|
42
|
+
if assistant_id in conv.assistant_ids
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
def get_conversation(self, conversation_id: str) -> ConversationDetails:
|
|
46
|
+
"""Get details for a specific conversation by its ID.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
conversation_id: Conversation ID
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
Conversation details
|
|
53
|
+
"""
|
|
54
|
+
return self._api.get(
|
|
55
|
+
f"/v1/conversations/{conversation_id}",
|
|
56
|
+
ConversationDetails,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def delete(self, conversation_id: str) -> dict:
|
|
60
|
+
"""Delete a specific conversation by its ID.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
conversation_id: Conversation ID to delete
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
Deletion confirmation
|
|
67
|
+
"""
|
|
68
|
+
return self._api.delete(
|
|
69
|
+
f"/v1/conversations/{conversation_id}",
|
|
70
|
+
dict,
|
|
71
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: codemie-sdk-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.136
|
|
4
4
|
Summary: CodeMie SDK for Python
|
|
5
5
|
Author: Vadym Vlasenko
|
|
6
6
|
Author-email: vadym_vlasenko@epam.com
|
|
@@ -41,6 +41,8 @@ Python SDK for CodeMie services. This SDK provides a comprehensive interface to
|
|
|
41
41
|
- [Best Practices](#best-practices)
|
|
42
42
|
- [Error Handling](#error-handling)
|
|
43
43
|
- [Workflow Status Monitoring](#workflow-status-monitoring)
|
|
44
|
+
- [Conversation Service](#conversation-service)
|
|
45
|
+
- [Core Methods](#core-methods-4)
|
|
44
46
|
- [Development](#development)
|
|
45
47
|
- [Setup](#setup)
|
|
46
48
|
- [Running Tests](#running-tests)
|
|
@@ -703,6 +705,36 @@ def monitor_execution(execution_service, execution_id):
|
|
|
703
705
|
time.sleep(5) # Poll every 5 seconds
|
|
704
706
|
```
|
|
705
707
|
|
|
708
|
+
### Conversation Service
|
|
709
|
+
|
|
710
|
+
The Conversation service provides access to manage user conversations within CodeMie Assistants.
|
|
711
|
+
|
|
712
|
+
#### Core Methods
|
|
713
|
+
|
|
714
|
+
1. **Get All Conversations**
|
|
715
|
+
```python
|
|
716
|
+
# List all conversations for current user
|
|
717
|
+
conversations = client.conversations.list()
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
2. **Get Specific Conversation**
|
|
721
|
+
```python
|
|
722
|
+
# Get Conversation by it's ID
|
|
723
|
+
client.conversations.get_conversation("conversation-id")
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
3. **Get Conversation by Assistant ID**
|
|
727
|
+
```python
|
|
728
|
+
# Get Conversation where Assistant ID is present
|
|
729
|
+
client.conversations.list_by_assistant_id("assistant-id")
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
4. **Delete Conversation**
|
|
733
|
+
```python
|
|
734
|
+
# Delete specific conversation
|
|
735
|
+
client.conversations.delete("conversation-id")
|
|
736
|
+
```
|
|
737
|
+
|
|
706
738
|
## Error Handling
|
|
707
739
|
|
|
708
740
|
The SDK implements comprehensive error handling. All API calls may raise exceptions for:
|
|
@@ -2,11 +2,12 @@ codemie_sdk/__init__.py,sha256=leeACpTc2113BsY_IgO-ceFHPrQKC2WhuOfuuyyIqDE,567
|
|
|
2
2
|
codemie_sdk/auth/__init__.py,sha256=IksEj223xEZtJ-cQ0AT9L0Bs9psIJ8QNzDXrPTUQ3xQ,126
|
|
3
3
|
codemie_sdk/auth/credentials.py,sha256=vcvt2nvb4_tSCdR7On498wNW4D-DRIuEJU6l3QG8QN0,4471
|
|
4
4
|
codemie_sdk/client/__init__.py,sha256=yf6C39MmrJ6gK9ZHMhBeynKwUUYVSUTQbKxU8-4qpKg,101
|
|
5
|
-
codemie_sdk/client/client.py,sha256=
|
|
5
|
+
codemie_sdk/client/client.py,sha256=8XlFsa2OEKdawipbUcX3L7umVHXKh9nzQ5-CXsXpMXI,4691
|
|
6
6
|
codemie_sdk/exceptions.py,sha256=XoVPyognx-JmyVxLHkZPAcX1CMi1OoT1diBFJLU54so,1183
|
|
7
7
|
codemie_sdk/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
codemie_sdk/models/assistant.py,sha256=w0Oc4ArB-Rf6KiBjhVMVJgbmXpd48Tdt-dGLJJ7qJHw,10369
|
|
9
9
|
codemie_sdk/models/common.py,sha256=gmZ-ps8TbaieNKr0kUKoQEjhVrHD2CAYomOpZQRatH8,1195
|
|
10
|
+
codemie_sdk/models/conversation.py,sha256=88NBSY-SpRKTz1o-YWm3xDWEbv_-dV8tT9WrTgsNAj0,3948
|
|
10
11
|
codemie_sdk/models/datasource.py,sha256=yCFB_wg9Lo2V6mzF2N3lsVBXJoyc8pyfMgMZUorn0ng,10852
|
|
11
12
|
codemie_sdk/models/integration.py,sha256=aJ2DQPhU4vcAgX8WUWrB8cbJKjqqvw2FHHjq0aiIlps,2293
|
|
12
13
|
codemie_sdk/models/llm.py,sha256=ppb9-1dx1UFhRuJpSR3ij7H6Pfhe9nO4C4BEOIbToy4,1192
|
|
@@ -15,6 +16,7 @@ codemie_sdk/models/user.py,sha256=Q0rjimZh-IbeaPfq6b6fk6ZaCtwLqWHEIlU863suCS4,17
|
|
|
15
16
|
codemie_sdk/models/workflow.py,sha256=qfk0rBJnFUMpcEDq_E5GB3hzYKbe_bb2NYJlLZJwUEE,2453
|
|
16
17
|
codemie_sdk/models/workflow_state.py,sha256=CMYFQZ7sy4QxmnWmc83TFfqP7TG_3rW5MdH5fxsS9kY,1251
|
|
17
18
|
codemie_sdk/services/assistant.py,sha256=BsTR_uoPoZtta6icfw2M0Ea6w2VIhYndDUVqsHJuZJo,7888
|
|
19
|
+
codemie_sdk/services/conversation.py,sha256=kv9wUuYxkz1SALL4cdnnlOMiriqYnAyKtoPBF1Xf8Uc,2127
|
|
18
20
|
codemie_sdk/services/datasource.py,sha256=d8LImpireGOnXKvj4h8iafq_ZQMn177_GGLLiE5g7wU,7405
|
|
19
21
|
codemie_sdk/services/integration.py,sha256=SdwFwR3hCPyJYilzzlkpKPLNbO89nfqmIXXoT7bDEBI,5410
|
|
20
22
|
codemie_sdk/services/llm.py,sha256=0-e4_7RvLHs2giCyoQ5U4KDTh6p5VXgPKNxnDP9ZDFU,1100
|
|
@@ -25,6 +27,6 @@ codemie_sdk/services/workflow_execution.py,sha256=aGoT3rdTmh5-doAsrmBBjLEuOfvL5a
|
|
|
25
27
|
codemie_sdk/services/workflow_execution_state.py,sha256=tXoaa8yT09xgYEUNiHhVULe76TwGwVgZupMIUyyLxdo,2070
|
|
26
28
|
codemie_sdk/utils/__init__.py,sha256=BXAJJfAzO89-kMYvWWo9wSNhSbGgF3vB1In9sePFhMM,109
|
|
27
29
|
codemie_sdk/utils/http.py,sha256=sdUdMYtexkYz0dQ7ysdwJlyYaE-QHdTZekQNDJpX48s,9134
|
|
28
|
-
codemie_sdk_python-0.1.
|
|
29
|
-
codemie_sdk_python-0.1.
|
|
30
|
-
codemie_sdk_python-0.1.
|
|
30
|
+
codemie_sdk_python-0.1.136.dist-info/METADATA,sha256=eMt7Qe4ctvYgDswvr7zYCl_PnPQoifzK29bWewCBpgE,24494
|
|
31
|
+
codemie_sdk_python-0.1.136.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
32
|
+
codemie_sdk_python-0.1.136.dist-info/RECORD,,
|
|
File without changes
|