shiftaiagenticinfra-sdk-python 0.0.5__tar.gz → 0.0.6__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.
Files changed (27) hide show
  1. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/PKG-INFO +27 -2
  2. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/README.md +26 -1
  3. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/pyproject.toml +1 -1
  4. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/setup.py +1 -1
  5. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/__init__.py +1 -1
  6. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/api/__init__.py +2 -0
  7. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/api/messages_api.py +3 -0
  8. shiftaiagenticinfra_sdk_python-0.0.6/shiftai/api/platform_session_api.py +66 -0
  9. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/client.py +2 -0
  10. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/http/http_client.py +15 -3
  11. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/models/__init__.py +24 -0
  12. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftaiagenticinfra_sdk_python.egg-info/PKG-INFO +27 -2
  13. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftaiagenticinfra_sdk_python.egg-info/SOURCES.txt +1 -0
  14. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/setup.cfg +0 -0
  15. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/api/agents_api.py +0 -0
  16. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/api/analytics_api.py +0 -0
  17. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/api/conversations_api.py +0 -0
  18. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/api/internal/__init__.py +0 -0
  19. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/api/internal/trulens_api.py +0 -0
  20. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/api/platform_api.py +0 -0
  21. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/api/users_api.py +0 -0
  22. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/http/__init__.py +0 -0
  23. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftai/http/exceptions.py +0 -0
  24. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftaiagenticinfra_sdk_python.egg-info/dependency_links.txt +0 -0
  25. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftaiagenticinfra_sdk_python.egg-info/requires.txt +0 -0
  26. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/shiftaiagenticinfra_sdk_python.egg-info/top_level.txt +0 -0
  27. {shiftaiagenticinfra_sdk_python-0.0.5 → shiftaiagenticinfra_sdk_python-0.0.6}/tests/test_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shiftaiagenticinfra-sdk-python
3
- Version: 0.0.5
3
+ Version: 0.0.6
4
4
  Summary: Shiftai Agentic Infra Python SDK
5
5
  Author: ShiftAI
6
6
  Author-email: ShiftAI <s.tadakamalla@theshiftai.in>
@@ -154,6 +154,7 @@ async def main():
154
154
  message="Hello, how can I help you?",
155
155
  agent_name="SupportBot",
156
156
  agent_platform="OpenAI",
157
+ user_email="john@example.com",
157
158
  agent_version="1.0.0" # Required: Agent version
158
159
  )
159
160
 
@@ -167,7 +168,8 @@ async def main():
167
168
  agent_platform="OpenAI",
168
169
  agent_version="1.0.0", # Required: Agent version
169
170
  reply_message_id=human_response.messageId,
170
- rag_context="Retrieved context from knowledge base..."
171
+ rag_context="Retrieved context from knowledge base...",
172
+ user_email="john@example.com"
171
173
  )
172
174
 
173
175
  # 4. Get analytics
@@ -223,6 +225,7 @@ Send a human message with automatic user/agent creation.
223
225
  - `agent_version` (str, **optional**): Agent version/model (e.g., "gpt-4", "claude-2") - **Required in database**
224
226
  - `agent_metadata` (dict, **optional**): Agent configuration data (e.g., `{"temperature": 0.7, "max_tokens": 1000}`)
225
227
  - `mode` (str, **optional**): Mode identifier for the message. Allowed values: `"SIMPLE"` or `"EXPAND"`
228
+ - `conversation_id` (UUID, **optional**): Conversation ID to store the HUMAN message in. If omitted, backend creates a new conversation automatically.
226
229
 
227
230
  **Return Type:** `PlatformMessageSubmissionResponse`
228
231
 
@@ -248,6 +251,28 @@ Send a bot response to a human message.
248
251
 
249
252
  **Return Type:** `PlatformMessageSubmissionResponse`
250
253
 
254
+ **Response Notes (Cache):**
255
+ - `cacheHit` / `cacheResponse` may be present when the backend cache API was checked (typically for HUMAN messages).
256
+
257
+ ### Platform Session API
258
+
259
+ #### `await platform_session.initiate_session(request=None)`
260
+ Initiate a new conversation session.
261
+
262
+ POST `/api/platformsession/initiate`
263
+
264
+ **Return Type:** `Dict[str, Any]` (raw response body as returned by the server)
265
+
266
+ #### `await platform_session.end_conversation(conversation_id)`
267
+ End an active conversation session explicitly.
268
+
269
+ POST `/api/platformsession/endconversation`
270
+
271
+ **Parameters:**
272
+ - `conversation_id` (UUID, **required**): Conversation identifier to end
273
+
274
+ **Return Type:** `EndConversationResponse`
275
+
251
276
  #### `await messages.submit(request)`
252
277
  Low-level message submission with full control.
253
278
 
@@ -125,6 +125,7 @@ async def main():
125
125
  message="Hello, how can I help you?",
126
126
  agent_name="SupportBot",
127
127
  agent_platform="OpenAI",
128
+ user_email="john@example.com",
128
129
  agent_version="1.0.0" # Required: Agent version
129
130
  )
130
131
 
@@ -138,7 +139,8 @@ async def main():
138
139
  agent_platform="OpenAI",
139
140
  agent_version="1.0.0", # Required: Agent version
140
141
  reply_message_id=human_response.messageId,
141
- rag_context="Retrieved context from knowledge base..."
142
+ rag_context="Retrieved context from knowledge base...",
143
+ user_email="john@example.com"
142
144
  )
143
145
 
144
146
  # 4. Get analytics
@@ -194,6 +196,7 @@ Send a human message with automatic user/agent creation.
194
196
  - `agent_version` (str, **optional**): Agent version/model (e.g., "gpt-4", "claude-2") - **Required in database**
195
197
  - `agent_metadata` (dict, **optional**): Agent configuration data (e.g., `{"temperature": 0.7, "max_tokens": 1000}`)
196
198
  - `mode` (str, **optional**): Mode identifier for the message. Allowed values: `"SIMPLE"` or `"EXPAND"`
199
+ - `conversation_id` (UUID, **optional**): Conversation ID to store the HUMAN message in. If omitted, backend creates a new conversation automatically.
197
200
 
198
201
  **Return Type:** `PlatformMessageSubmissionResponse`
199
202
 
@@ -219,6 +222,28 @@ Send a bot response to a human message.
219
222
 
220
223
  **Return Type:** `PlatformMessageSubmissionResponse`
221
224
 
225
+ **Response Notes (Cache):**
226
+ - `cacheHit` / `cacheResponse` may be present when the backend cache API was checked (typically for HUMAN messages).
227
+
228
+ ### Platform Session API
229
+
230
+ #### `await platform_session.initiate_session(request=None)`
231
+ Initiate a new conversation session.
232
+
233
+ POST `/api/platformsession/initiate`
234
+
235
+ **Return Type:** `Dict[str, Any]` (raw response body as returned by the server)
236
+
237
+ #### `await platform_session.end_conversation(conversation_id)`
238
+ End an active conversation session explicitly.
239
+
240
+ POST `/api/platformsession/endconversation`
241
+
242
+ **Parameters:**
243
+ - `conversation_id` (UUID, **required**): Conversation identifier to end
244
+
245
+ **Return Type:** `EndConversationResponse`
246
+
222
247
  #### `await messages.submit(request)`
223
248
  Low-level message submission with full control.
224
249
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "shiftaiagenticinfra-sdk-python"
7
- version = "0.0.5"
7
+ version = "0.0.6"
8
8
  description = "Shiftai Agentic Infra Python SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -13,7 +13,7 @@ def read_readme():
13
13
 
14
14
  setup(
15
15
  name="shiftaiagenticinfra-sdk-python",
16
- version="0.0.1",
16
+ version="0.0.6",
17
17
  description="Shiftai Agentic Infra Python SDK",
18
18
  long_description=read_readme(),
19
19
  long_description_content_type="text/markdown",
@@ -6,6 +6,6 @@ A Python client library for the Shiftai Agentic Infra REST API.
6
6
 
7
7
  from .client import ShiftaiagenticinfraClient
8
8
 
9
- __version__ = "0.0.1"
9
+ __version__ = "0.0.6"
10
10
  __all__ = ["ShiftaiagenticinfraClient"]
11
11
 
@@ -6,6 +6,7 @@ from .users_api import UsersApi
6
6
  from .agents_api import AgentsApi
7
7
  from .analytics_api import AnalyticsApi
8
8
  from .conversations_api import ConversationsApi
9
+ from .platform_session_api import PlatformSessionApi
9
10
 
10
11
  __all__ = [
11
12
  "PlatformApi",
@@ -14,5 +15,6 @@ __all__ = [
14
15
  "AgentsApi",
15
16
  "AnalyticsApi",
16
17
  "ConversationsApi",
18
+ "PlatformSessionApi",
17
19
  ]
18
20
 
@@ -35,6 +35,7 @@ class MessagesApi:
35
35
  agent_version: Optional[str] = None,
36
36
  agent_metadata: Optional[Dict[str, Any]] = None,
37
37
  mode: Optional[str] = None,
38
+ conversation_id: Optional[UUID] = None,
38
39
  ) -> PlatformMessageSubmissionResponse:
39
40
  """
40
41
  Send a human message.
@@ -56,6 +57,7 @@ class MessagesApi:
56
57
  agent_version: Optional agent version or model identifier
57
58
  agent_metadata: Optional additional agent configuration metadata
58
59
  mode: Optional mode identifier for the message
60
+ conversation_id: Optional conversation ID for HUMAN messages. If not provided, backend creates a new conversation.
59
61
 
60
62
  Returns:
61
63
  PlatformMessageSubmissionResponse with message ID and contextual prompt
@@ -101,6 +103,7 @@ class MessagesApi:
101
103
  agentData=agent_data,
102
104
  senderType="HUMAN", # Auto-set
103
105
  messageType="TEXT", # Auto-set
106
+ conversationId=conversation_id,
104
107
  mode=mode
105
108
  )
106
109
 
@@ -0,0 +1,66 @@
1
+ """
2
+ API for platform session (conversation session) operations.
3
+
4
+ Provides methods for initiating new conversation sessions and explicitly ending them.
5
+ """
6
+
7
+ from typing import Any, Dict, Optional
8
+ from uuid import UUID
9
+
10
+ from ..http import HttpClient
11
+ from ..models import EndConversationRequest, EndConversationResponse
12
+
13
+
14
+ class PlatformSessionApi:
15
+ """API for platform session operations."""
16
+
17
+ def __init__(self, http_client: HttpClient):
18
+ self._http_client = http_client
19
+
20
+ async def initiate_session(
21
+ self,
22
+ request: Optional[Dict[str, Any]] = None,
23
+ ) -> Dict[str, Any]:
24
+ """
25
+ Initiate a new conversation session.
26
+
27
+ POST /api/platformsession/initiate
28
+
29
+ Notes:
30
+ - Requires API key authentication.
31
+ - This SDK method returns the response body "as-is" (raw map) because
32
+ the exact response DTO may evolve server-side.
33
+
34
+ Args:
35
+ request: Optional raw request body to pass through (dict). If omitted, sends an empty body.
36
+
37
+ Returns:
38
+ Dict[str, Any]: Raw response map returned by the endpoint.
39
+ """
40
+ self._http_client.ensure_authenticated()
41
+ return await self._http_client.post_map("/api/platformsession/initiate", request or {})
42
+
43
+ async def end_conversation(self, conversation_id: UUID) -> EndConversationResponse:
44
+ """
45
+ End an active conversation session.
46
+
47
+ POST /api/platformsession/endconversation
48
+
49
+ Args:
50
+ conversation_id: UUID of the conversation to end (required)
51
+
52
+ Returns:
53
+ EndConversationResponse containing success, message and timestamps.
54
+ """
55
+ self._http_client.ensure_authenticated()
56
+
57
+ if conversation_id is None:
58
+ raise ValueError("conversation_id is required")
59
+
60
+ request = EndConversationRequest(conversationId=conversation_id)
61
+ return await self._http_client.post(
62
+ "/api/platformsession/endconversation",
63
+ request,
64
+ EndConversationResponse,
65
+ )
66
+
@@ -12,6 +12,7 @@ from .api import (
12
12
  AgentsApi,
13
13
  AnalyticsApi,
14
14
  ConversationsApi,
15
+ PlatformSessionApi,
15
16
  )
16
17
  from .api.internal.trulens_api import EvalApi
17
18
 
@@ -68,6 +69,7 @@ class ShiftaiagenticinfraClient:
68
69
  self.agents = AgentsApi(self._http_client)
69
70
  self.analytics = AnalyticsApi(self._http_client)
70
71
  self.conversations = ConversationsApi(self._http_client)
72
+ self.platform_session = PlatformSessionApi(self._http_client)
71
73
  self.internal = InternalApi(self._http_client)
72
74
 
73
75
  def _ensure_api_key(self) -> None:
@@ -239,7 +239,9 @@ class HttpClient:
239
239
 
240
240
  # Convert dict to response_type object
241
241
  if isinstance(data, dict):
242
- return response_type(**data)
242
+ # Filter to known fields to prevent TypeError on unknown fields
243
+ filtered_data = self._filter_known_fields(data, response_type)
244
+ return response_type(**filtered_data)
243
245
  return data
244
246
 
245
247
  except (UnauthorizedException, BadRequestException, NotFoundException, ServerException, ApiException):
@@ -291,7 +293,15 @@ class HttpClient:
291
293
  raise ApiException(0, f"Expected list, got {type(data)}")
292
294
 
293
295
  # Convert list of dicts to list of objects
294
- return [element_type(**item) if isinstance(item, dict) else item for item in data]
296
+ result: List[T] = []
297
+ for item in data:
298
+ if isinstance(item, dict):
299
+ # Filter to known fields to prevent TypeError on unknown fields
300
+ filtered_item = self._filter_known_fields(item, element_type)
301
+ result.append(element_type(**filtered_item))
302
+ else:
303
+ result.append(item)
304
+ return result
295
305
 
296
306
  except (UnauthorizedException, BadRequestException, NotFoundException, ServerException, ApiException):
297
307
  raise
@@ -338,7 +348,9 @@ class HttpClient:
338
348
 
339
349
  # Convert dict to response_type object
340
350
  if isinstance(data, dict):
341
- return response_type(**data)
351
+ # Filter to known fields to prevent TypeError on unknown fields
352
+ filtered_data = self._filter_known_fields(data, response_type)
353
+ return response_type(**filtered_data)
342
354
  return data
343
355
 
344
356
  except (UnauthorizedException, BadRequestException, NotFoundException, ServerException, ApiException):
@@ -49,6 +49,9 @@ class PlatformMessageSubmissionRequest:
49
49
  sourceEvent: Optional[Dict[str, Any]] = None
50
50
  ragContext: Optional[str] = None
51
51
  replyMessageId: Optional[UUID] = None
52
+ # Optional conversation ID for HUMAN messages. If omitted, backend creates a new conversation.
53
+ # For BOT messages, backend determines conversation from replyMessageId and ignores this field.
54
+ conversationId: Optional[UUID] = None
52
55
  mode: Optional[str] = None
53
56
 
54
57
 
@@ -88,6 +91,25 @@ class PlatformMessageSubmissionResponse:
88
91
  similarConversations: Optional[List[WeaviateVector]] = None # Similar conversations (senderType=HUMAN only)
89
92
  operationStatus: Optional[Dict[str, bool]] = None # Operation status flags (senderType=BOT only)
90
93
  conversationTitle: Optional[str] = None # LLM-generated conversation title
94
+ # Cache metadata (only present when cache was checked)
95
+ cacheResponse: Optional[str] = None
96
+ cacheHit: Optional[bool] = None
97
+
98
+
99
+ @dataclass
100
+ class EndConversationRequest:
101
+ """Request DTO for ending a conversation session."""
102
+ conversationId: UUID
103
+
104
+
105
+ @dataclass
106
+ class EndConversationResponse:
107
+ """Response DTO for ending a conversation session."""
108
+ success: Optional[bool] = None
109
+ message: Optional[str] = None
110
+ conversationId: Optional[UUID] = None
111
+ conversationExternalId: Optional[str] = None
112
+ endedAt: Optional[str] = None # ISO 8601 datetime string
91
113
 
92
114
 
93
115
  @dataclass
@@ -175,6 +197,8 @@ class PlatformMessage:
175
197
  messageEmbedding: Optional[str] = None
176
198
  generatedContext: Optional[str] = None
177
199
  ragContext: Optional[str] = None
200
+ cacheHit: Optional[bool] = None
201
+ cacheResponse: Optional[str] = None
178
202
  evalRecordId: Optional[str] = None
179
203
  evalSyncStatus: Optional[str] = None
180
204
  evalSyncError: Optional[str] = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shiftaiagenticinfra-sdk-python
3
- Version: 0.0.5
3
+ Version: 0.0.6
4
4
  Summary: Shiftai Agentic Infra Python SDK
5
5
  Author: ShiftAI
6
6
  Author-email: ShiftAI <s.tadakamalla@theshiftai.in>
@@ -154,6 +154,7 @@ async def main():
154
154
  message="Hello, how can I help you?",
155
155
  agent_name="SupportBot",
156
156
  agent_platform="OpenAI",
157
+ user_email="john@example.com",
157
158
  agent_version="1.0.0" # Required: Agent version
158
159
  )
159
160
 
@@ -167,7 +168,8 @@ async def main():
167
168
  agent_platform="OpenAI",
168
169
  agent_version="1.0.0", # Required: Agent version
169
170
  reply_message_id=human_response.messageId,
170
- rag_context="Retrieved context from knowledge base..."
171
+ rag_context="Retrieved context from knowledge base...",
172
+ user_email="john@example.com"
171
173
  )
172
174
 
173
175
  # 4. Get analytics
@@ -223,6 +225,7 @@ Send a human message with automatic user/agent creation.
223
225
  - `agent_version` (str, **optional**): Agent version/model (e.g., "gpt-4", "claude-2") - **Required in database**
224
226
  - `agent_metadata` (dict, **optional**): Agent configuration data (e.g., `{"temperature": 0.7, "max_tokens": 1000}`)
225
227
  - `mode` (str, **optional**): Mode identifier for the message. Allowed values: `"SIMPLE"` or `"EXPAND"`
228
+ - `conversation_id` (UUID, **optional**): Conversation ID to store the HUMAN message in. If omitted, backend creates a new conversation automatically.
226
229
 
227
230
  **Return Type:** `PlatformMessageSubmissionResponse`
228
231
 
@@ -248,6 +251,28 @@ Send a bot response to a human message.
248
251
 
249
252
  **Return Type:** `PlatformMessageSubmissionResponse`
250
253
 
254
+ **Response Notes (Cache):**
255
+ - `cacheHit` / `cacheResponse` may be present when the backend cache API was checked (typically for HUMAN messages).
256
+
257
+ ### Platform Session API
258
+
259
+ #### `await platform_session.initiate_session(request=None)`
260
+ Initiate a new conversation session.
261
+
262
+ POST `/api/platformsession/initiate`
263
+
264
+ **Return Type:** `Dict[str, Any]` (raw response body as returned by the server)
265
+
266
+ #### `await platform_session.end_conversation(conversation_id)`
267
+ End an active conversation session explicitly.
268
+
269
+ POST `/api/platformsession/endconversation`
270
+
271
+ **Parameters:**
272
+ - `conversation_id` (UUID, **required**): Conversation identifier to end
273
+
274
+ **Return Type:** `EndConversationResponse`
275
+
251
276
  #### `await messages.submit(request)`
252
277
  Low-level message submission with full control.
253
278
 
@@ -9,6 +9,7 @@ shiftai/api/analytics_api.py
9
9
  shiftai/api/conversations_api.py
10
10
  shiftai/api/messages_api.py
11
11
  shiftai/api/platform_api.py
12
+ shiftai/api/platform_session_api.py
12
13
  shiftai/api/users_api.py
13
14
  shiftai/api/internal/__init__.py
14
15
  shiftai/api/internal/trulens_api.py