gomyck-tools 1.4.0__py3-none-any.whl → 1.4.1__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.
- ctools/ai/env_config.py +2 -0
- ctools/ai/llm_client.py +13 -6
- ctools/ai/mcp/mcp_client.py +1 -0
- {gomyck_tools-1.4.0.dist-info → gomyck_tools-1.4.1.dist-info}/METADATA +1 -1
- {gomyck_tools-1.4.0.dist-info → gomyck_tools-1.4.1.dist-info}/RECORD +8 -8
- {gomyck_tools-1.4.0.dist-info → gomyck_tools-1.4.1.dist-info}/WHEEL +0 -0
- {gomyck_tools-1.4.0.dist-info → gomyck_tools-1.4.1.dist-info}/licenses/LICENSE +0 -0
- {gomyck_tools-1.4.0.dist-info → gomyck_tools-1.4.1.dist-info}/top_level.txt +0 -0
ctools/ai/env_config.py
CHANGED
@@ -17,6 +17,8 @@ class Configuration:
|
|
17
17
|
"""Initialize configuration with environment variables."""
|
18
18
|
if not os.path.exists(dotenv_path): raise FileNotFoundError(f"Could not find .env file at {dotenv_path}")
|
19
19
|
self.env = DotEnv(dotenv_path=dotenv_path)
|
20
|
+
for key, value in self.env.dict().items():
|
21
|
+
if value: os.environ[key] = value
|
20
22
|
|
21
23
|
def get_env(self, key: str, default: Optional[Any] = None) -> Any:
|
22
24
|
value = self.env.get(key)
|
ctools/ai/llm_client.py
CHANGED
@@ -3,7 +3,7 @@ import os
|
|
3
3
|
|
4
4
|
import httpx
|
5
5
|
|
6
|
-
from ctools import sys_log, cjson
|
6
|
+
from ctools import sys_log, cjson, call
|
7
7
|
from ctools.ai.llm_exception import LLMException
|
8
8
|
|
9
9
|
logging.getLogger("httpcore").setLevel(logging.WARNING)
|
@@ -20,11 +20,17 @@ def process_SSE(line):
|
|
20
20
|
return "[DONE]"
|
21
21
|
return data
|
22
22
|
|
23
|
-
shared_client =
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
shared_client = None
|
24
|
+
|
25
|
+
@call.once
|
26
|
+
def init_shared_client():
|
27
|
+
global shared_client
|
28
|
+
shared_client = httpx.AsyncClient(
|
29
|
+
base_url=os.getenv("LLM_BASE_URL", "https://api.siliconflow.cn/v1/"),
|
30
|
+
timeout=httpx.Timeout(connect=10.0, read=60.0, write=10.0, pool=5.0),
|
31
|
+
limits=httpx.Limits(max_connections=100, max_keepalive_connections=20),
|
32
|
+
)
|
33
|
+
return shared_client
|
28
34
|
|
29
35
|
class LLMClient:
|
30
36
|
"""Manages communication with the LLM provider."""
|
@@ -51,6 +57,7 @@ class LLMClient:
|
|
51
57
|
self.top_p = top_p
|
52
58
|
self.top_k = top_k
|
53
59
|
self.frequency_penalty = frequency_penalty
|
60
|
+
init_shared_client()
|
54
61
|
|
55
62
|
async def model_completion(self, messages: list[dict[str, str]]):
|
56
63
|
self.no_think_compatible(messages)
|
ctools/ai/mcp/mcp_client.py
CHANGED
@@ -292,6 +292,7 @@ def is_image_content(content: dict) -> bool:
|
|
292
292
|
@asynccontextmanager
|
293
293
|
async def init_mcp_clients(mcp_server_config: dict[str, Any]) -> list[MCPClient]:
|
294
294
|
mcp_clients = []
|
295
|
+
if not mcp_server_config["mcpServers"]: yield mcp_clients
|
295
296
|
for name, sc in mcp_server_config["mcpServers"].items():
|
296
297
|
try:
|
297
298
|
mc = MCPClient(name, sc)
|
@@ -14,12 +14,12 @@ ctools/similar.py,sha256=7mBbp7JrGGyAgA_hDmCvGJ6hGE1Lh43ocyqPkLGclyc,695
|
|
14
14
|
ctools/sys_info.py,sha256=T5pcRblNHEmXEvPk2PPvQga7Hh5aDnNN72pt4U176SE,4270
|
15
15
|
ctools/sys_log.py,sha256=T-tgOcrFggSJ2I6pLHhKpj4fvVFk_vbZBOrInKC6y3Q,2789
|
16
16
|
ctools/ai/__init__.py,sha256=gTYAICILq48icnFbg0HCbsQO8PbU02EDOQ0JeMvfqTY,98
|
17
|
-
ctools/ai/env_config.py,sha256=
|
17
|
+
ctools/ai/env_config.py,sha256=pZ8dG-4-CeMjBdgFHvljY2xMfyBE_0bM961UjIzm6xs,1400
|
18
18
|
ctools/ai/llm_chat.py,sha256=dAFar0A5h3ws_kjx9MlWZAawLPYHIwvfdyO_umJgkpU,8655
|
19
|
-
ctools/ai/llm_client.py,sha256=
|
19
|
+
ctools/ai/llm_client.py,sha256=nQKjQj8WzDqCnMsYag3Td5hYTXep2PthRm6KS7Qyc8U,5661
|
20
20
|
ctools/ai/llm_exception.py,sha256=wsCVl0m53Mk7Xfug1obocAthlX0oEo4dytg1eOhWHPg,389
|
21
21
|
ctools/ai/mcp/__init__.py,sha256=gTYAICILq48icnFbg0HCbsQO8PbU02EDOQ0JeMvfqTY,98
|
22
|
-
ctools/ai/mcp/mcp_client.py,sha256=
|
22
|
+
ctools/ai/mcp/mcp_client.py,sha256=9T22s8BmerT7FrmRJr2VRhvNaV17Xz-C8jGNp08PYu0,11649
|
23
23
|
ctools/ai/tools/__init__.py,sha256=gPc-ViRgtFlfX7JUbk5wQZ3wkJ5Ylh14CIqPwa83VPs,98
|
24
24
|
ctools/ai/tools/json_extract.py,sha256=bgubZ2RwTo_R1X0CzMnvBWu61hglB1l6oO553645RXc,4842
|
25
25
|
ctools/ai/tools/quick_tools.py,sha256=WeUFDLLHrP6PCs1pM3G_hRS2YSTp5XjCrJ077u06jeo,2369
|
@@ -75,8 +75,8 @@ ctools/web/ctoken.py,sha256=CdHm6-ykBLh7Lv8ZRMunSW40qMTkRH0ITeMLuG9z1ts,883
|
|
75
75
|
ctools/web/download_util.py,sha256=EVN3fxwbUE5Q8nurAya5IYialIKBMoFtSOy0uPKyV-E,1951
|
76
76
|
ctools/web/params_util.py,sha256=2vAuwn8OPydv_7BPKypqk4zuerPZqOGcf95wV19H1Ks,824
|
77
77
|
ctools/web/upload_util.py,sha256=xH4Z-sz-s7EVDEz2gKXoP9OZTLc-er5yvsiLqhSDFm8,1076
|
78
|
-
gomyck_tools-1.4.
|
79
|
-
gomyck_tools-1.4.
|
80
|
-
gomyck_tools-1.4.
|
81
|
-
gomyck_tools-1.4.
|
82
|
-
gomyck_tools-1.4.
|
78
|
+
gomyck_tools-1.4.1.dist-info/licenses/LICENSE,sha256=X25ypfH9E6VTht2hcO8k7LCSdHUcoG_ALQt80jdYZfY,547
|
79
|
+
gomyck_tools-1.4.1.dist-info/METADATA,sha256=CDdnfnwdeNZsLWRZqCrx7cneqAbQgwXraoYDbI4ahg0,1595
|
80
|
+
gomyck_tools-1.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
81
|
+
gomyck_tools-1.4.1.dist-info/top_level.txt,sha256=-MiIH9FYRVKp1i5_SVRkaI-71WmF1sZSRrNWFU9ls3s,7
|
82
|
+
gomyck_tools-1.4.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|