dais-sdk 0.6.2__tar.gz → 0.6.4__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.
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/PKG-INFO +4 -4
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/pyproject.toml +4 -4
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/mcp_client/local_mcp_client.py +1 -1
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/stream.py +3 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/types/message.py +26 -2
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/LICENSE +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/README.md +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/__init__.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/debug.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/logger.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/mcp_client/__init__.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/mcp_client/base_mcp_client.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/mcp_client/oauth_server.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/mcp_client/remote_mcp_client.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/param_parser.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/tool/__init__.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/tool/execute.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/tool/prepare.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/tool/toolset/__init__.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/tool/toolset/mcp_toolset.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/tool/toolset/python_toolset.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/tool/toolset/toolset.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/tool/utils.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/types/__init__.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/types/exceptions.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/types/request_params.py +0 -0
- {dais_sdk-0.6.2 → dais_sdk-0.6.4}/src/dais_sdk/types/tool.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dais-sdk
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.4
|
|
4
4
|
Summary: A wrapper of LiteLLM
|
|
5
5
|
Author-email: BHznJNs <bhznjns@outlook.com>
|
|
6
6
|
Requires-Python: >=3.14
|
|
@@ -11,11 +11,11 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.14
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: litellm>=1.
|
|
14
|
+
Requires-Dist: litellm>=1.81.0
|
|
15
15
|
Requires-Dist: pydantic>=2.0.0
|
|
16
16
|
Requires-Dist: httpx==0.28.1
|
|
17
|
-
Requires-Dist: mcp==1.
|
|
18
|
-
Requires-Dist: starlette==0.
|
|
17
|
+
Requires-Dist: mcp==1.26.0
|
|
18
|
+
Requires-Dist: starlette==0.52.1
|
|
19
19
|
Requires-Dist: uvicorn==0.40.0
|
|
20
20
|
Project-URL: Source, https://github.com/Dais-Project/Dais-SDK
|
|
21
21
|
Project-URL: Tracker, https://github.com/Dais-Project/Dais-SDK/issues
|
|
@@ -15,16 +15,16 @@ classifiers = [
|
|
|
15
15
|
"Programming Language :: Python :: 3.14",
|
|
16
16
|
]
|
|
17
17
|
requires-python = ">=3.14"
|
|
18
|
-
version = "0.6.
|
|
18
|
+
version = "0.6.4"
|
|
19
19
|
|
|
20
20
|
dependencies = [
|
|
21
|
-
"litellm>=1.
|
|
21
|
+
"litellm>=1.81.0",
|
|
22
22
|
"pydantic>=2.0.0",
|
|
23
23
|
|
|
24
24
|
# MCP client dependencies
|
|
25
25
|
"httpx==0.28.1",
|
|
26
|
-
"mcp==1.
|
|
27
|
-
"starlette==0.
|
|
26
|
+
"mcp==1.26.0",
|
|
27
|
+
"starlette==0.52.1",
|
|
28
28
|
"uvicorn==0.40.0",
|
|
29
29
|
]
|
|
30
30
|
|
|
@@ -4,7 +4,7 @@ from mcp import ClientSession, StdioServerParameters as StdioServerParams
|
|
|
4
4
|
from mcp.client.stdio import stdio_client
|
|
5
5
|
from .base_mcp_client import McpClient, Tool, ToolResult, McpSessionNotEstablishedError
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
LocalServerParams = StdioServerParams
|
|
8
8
|
|
|
9
9
|
class LocalMcpClient(McpClient):
|
|
10
10
|
def __init__(self, name: str, params: LocalServerParams):
|
|
@@ -74,6 +74,9 @@ class AssistantMessageCollector:
|
|
|
74
74
|
|
|
75
75
|
def get_message(self) -> AssistantMessage:
|
|
76
76
|
self.message_buf.tool_calls = self.tool_call_collector.get_tool_calls()
|
|
77
|
+
if self.message_buf.content is not None and self.message_buf.reasoning_content is None:
|
|
78
|
+
self.message_buf.content, self.message_buf.reasoning_content =\
|
|
79
|
+
AssistantMessage.extract_thinking_content(self.message_buf.content)
|
|
77
80
|
return self.message_buf
|
|
78
81
|
|
|
79
82
|
def clear(self):
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import dataclasses
|
|
3
|
+
import re
|
|
3
4
|
import uuid
|
|
4
5
|
from abc import ABC, abstractmethod
|
|
5
6
|
from typing import Any, Literal, cast
|
|
@@ -92,6 +93,22 @@ class AssistantMessage(ChatMessage):
|
|
|
92
93
|
usage: LiteLlmUsage | None = None
|
|
93
94
|
role: Literal["assistant"] = "assistant"
|
|
94
95
|
|
|
96
|
+
@staticmethod
|
|
97
|
+
def extract_thinking_content(text: str) -> tuple[str, str | None]:
|
|
98
|
+
"""
|
|
99
|
+
Extract thinking content from the start of model responsed text.
|
|
100
|
+
Returns:
|
|
101
|
+
A tuple of (extracted_content, optional thinking_content)
|
|
102
|
+
"""
|
|
103
|
+
pattern = r"<(think|thinking)>(.*?)</\1>"
|
|
104
|
+
match = re.match(pattern, text, re.DOTALL)
|
|
105
|
+
if match:
|
|
106
|
+
start, end = match.span()
|
|
107
|
+
thinking_content = match.group(2)
|
|
108
|
+
remaining_content = text[:start] + text[end:]
|
|
109
|
+
return remaining_content.strip(), thinking_content
|
|
110
|
+
return text, None
|
|
111
|
+
|
|
95
112
|
@classmethod
|
|
96
113
|
def from_litellm_message(cls, response: LiteLlmModelResponse) -> "AssistantMessage":
|
|
97
114
|
choices = cast(list[LiteLlmModelResponseChoices], response.choices)
|
|
@@ -108,9 +125,16 @@ class AssistantMessage(ChatMessage):
|
|
|
108
125
|
type="function",
|
|
109
126
|
) for tool_call in cast(list[ChatCompletionMessageToolCall], message_tool_calls)]
|
|
110
127
|
|
|
128
|
+
content: str | None = message.get("content")
|
|
129
|
+
reasoning_content: str | None = message.get("reasoning_content")
|
|
130
|
+
if content is not None:
|
|
131
|
+
content, thinking_block_content = cls.extract_thinking_content(content)
|
|
132
|
+
if reasoning_content is None:
|
|
133
|
+
reasoning_content = thinking_block_content
|
|
134
|
+
|
|
111
135
|
return cls.model_construct(
|
|
112
|
-
content=
|
|
113
|
-
reasoning_content=
|
|
136
|
+
content=content,
|
|
137
|
+
reasoning_content=reasoning_content,
|
|
114
138
|
tool_calls=tool_calls,
|
|
115
139
|
audio=message.get("audio"),
|
|
116
140
|
images=message.get("images"),
|
|
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
|
|
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
|