beswarm 0.2.0__py3-none-any.whl → 0.2.4__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.
- beswarm/aient/setup.py +1 -1
- beswarm/aient/src/aient/core/request.py +8 -0
- beswarm/aient/src/aient/core/response.py +9 -12
- beswarm/bemcp/bemcp/decorator.py +83 -0
- beswarm/bemcp/bemcp/main.py +6 -0
- beswarm/bemcp/bemcp/utils.py +1 -1
- beswarm/bemcp/test/server.py +2 -2
- beswarm/tools/__init__.py +0 -2
- {beswarm-0.2.0.dist-info → beswarm-0.2.4.dist-info}/METADATA +12 -1
- {beswarm-0.2.0.dist-info → beswarm-0.2.4.dist-info}/RECORD +12 -12
- beswarm/tools/think.py +0 -40
- {beswarm-0.2.0.dist-info → beswarm-0.2.4.dist-info}/WHEEL +0 -0
- {beswarm-0.2.0.dist-info → beswarm-0.2.4.dist-info}/top_level.txt +0 -0
beswarm/aient/setup.py
CHANGED
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
|
|
4
4
|
|
5
5
|
setup(
|
6
6
|
name="aient",
|
7
|
-
version="1.1.
|
7
|
+
version="1.1.40",
|
8
8
|
description="Aient: The Awakening of Agent.",
|
9
9
|
long_description=Path.open(Path("README.md"), encoding="utf-8").read(),
|
10
10
|
long_description_content_type="text/markdown",
|
@@ -240,6 +240,10 @@ async def get_gemini_payload(request, engine, provider, api_key=None):
|
|
240
240
|
val = int(m.group(1))
|
241
241
|
if val < 0:
|
242
242
|
val = 0
|
243
|
+
elif val > 32768 and "gemini-2.5-pro" in original_model:
|
244
|
+
val = 32768
|
245
|
+
elif val < 128 and "gemini-2.5-pro" in original_model:
|
246
|
+
val = 128
|
243
247
|
elif val > 24576:
|
244
248
|
val = 24576
|
245
249
|
payload["generationConfig"]["thinkingConfig"]["thinkingBudget"] = val
|
@@ -532,6 +536,10 @@ async def get_vertex_gemini_payload(request, engine, provider, api_key=None):
|
|
532
536
|
val = int(m.group(1))
|
533
537
|
if val < 0:
|
534
538
|
val = 0
|
539
|
+
elif val > 32768 and "gemini-2.5-pro" in original_model:
|
540
|
+
val = 32768
|
541
|
+
elif val < 128 and "gemini-2.5-pro" in original_model:
|
542
|
+
val = 128
|
535
543
|
elif val > 24576:
|
536
544
|
val = 24576
|
537
545
|
payload["generationConfig"]["thinkingConfig"]["thinkingBudget"] = val
|
@@ -568,6 +568,7 @@ async def fetch_response(client, url, headers, payload, engine, model):
|
|
568
568
|
|
569
569
|
elif engine == "gemini" or engine == "vertex-gemini" or engine == "aws":
|
570
570
|
response_json = response.json()
|
571
|
+
# print("response_json", json.dumps(response_json, indent=4, ensure_ascii=False))
|
571
572
|
|
572
573
|
if isinstance(response_json, str):
|
573
574
|
import ast
|
@@ -579,7 +580,7 @@ async def fetch_response(client, url, headers, payload, engine, model):
|
|
579
580
|
else:
|
580
581
|
logger.error(f"error fetch_response: Unknown response_json type: {type(response_json)}")
|
581
582
|
parsed_data = response_json
|
582
|
-
|
583
|
+
|
583
584
|
content = ""
|
584
585
|
reasoning_content = ""
|
585
586
|
image_base64 = ""
|
@@ -596,15 +597,6 @@ async def fetch_response(client, url, headers, payload, engine, model):
|
|
596
597
|
reasoning_content += chunk
|
597
598
|
else:
|
598
599
|
content += chunk
|
599
|
-
# for item in parsed_data:
|
600
|
-
# chunk = safe_get(item, "candidates", 0, "content", "parts", 0, "text")
|
601
|
-
# is_think = safe_get(item, "candidates", 0, "content", "parts", 0, "thought", default=False)
|
602
|
-
# # logger.info(f"chunk: {repr(chunk)}")
|
603
|
-
# if chunk:
|
604
|
-
# if is_think:
|
605
|
-
# reasoning_content += chunk
|
606
|
-
# else:
|
607
|
-
# content += chunk
|
608
600
|
|
609
601
|
usage_metadata = safe_get(parsed_data, -1, "usageMetadata")
|
610
602
|
prompt_tokens = safe_get(usage_metadata, "promptTokenCount", default=0)
|
@@ -618,8 +610,13 @@ async def fetch_response(client, url, headers, payload, engine, model):
|
|
618
610
|
logger.error(f"Unknown role: {role}, parsed_data: {parsed_data}")
|
619
611
|
role = "assistant"
|
620
612
|
|
621
|
-
|
622
|
-
|
613
|
+
has_think = safe_get(parsed_data, 0, "candidates", 0, "content", "parts", 0, "thought", default=False)
|
614
|
+
if has_think:
|
615
|
+
function_message_parts_index = -1
|
616
|
+
else:
|
617
|
+
function_message_parts_index = 0
|
618
|
+
function_call_name = safe_get(parsed_data, -1, "candidates", 0, "content", "parts", function_message_parts_index, "functionCall", "name", default=None)
|
619
|
+
function_call_content = safe_get(parsed_data, -1, "candidates", 0, "content", "parts", function_message_parts_index, "functionCall", "args", default=None)
|
623
620
|
|
624
621
|
timestamp = int(datetime.timestamp(datetime.now()))
|
625
622
|
yield await generate_no_stream_response(timestamp, model, content=content, tools_id=None, function_call_name=function_call_name, function_call_content=function_call_content, role=role, total_tokens=total_tokens, prompt_tokens=prompt_tokens, completion_tokens=candidates_tokens, reasoning_content=reasoning_content, image_base64=image_base64)
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import asyncio
|
2
|
+
import functools
|
3
|
+
from typing import Any, Callable, TypeVar
|
4
|
+
|
5
|
+
try:
|
6
|
+
from mcp.shared.exceptions import McpError
|
7
|
+
except ImportError:
|
8
|
+
# Define a dummy exception if mcp is not available,
|
9
|
+
# although it should be in the target environment.
|
10
|
+
class McpError(Exception):
|
11
|
+
pass
|
12
|
+
|
13
|
+
try:
|
14
|
+
from anyio import BrokenResourceError
|
15
|
+
except ImportError:
|
16
|
+
class BrokenResourceError(Exception):
|
17
|
+
pass
|
18
|
+
|
19
|
+
F = TypeVar('F', bound=Callable[..., Any])
|
20
|
+
|
21
|
+
def async_retry(max_retries: int = 2, delay: float = 1.0):
|
22
|
+
"""
|
23
|
+
A decorator to automatically retry an async function if it raises an exception.
|
24
|
+
|
25
|
+
Args:
|
26
|
+
max_retries: The maximum number of retries.
|
27
|
+
delay: The delay between retries in seconds.
|
28
|
+
"""
|
29
|
+
def decorator(func: F) -> F:
|
30
|
+
@functools.wraps(func)
|
31
|
+
async def wrapper(*args: Any, **kwargs: Any) -> Any:
|
32
|
+
last_exception = None
|
33
|
+
# The number of attempts is max_retries + 1 (the initial attempt)
|
34
|
+
for attempt in range(max_retries + 1):
|
35
|
+
try:
|
36
|
+
return await func(*args, **kwargs)
|
37
|
+
except Exception as e:
|
38
|
+
last_exception = e
|
39
|
+
if attempt < max_retries:
|
40
|
+
print(f"Attempt {attempt + 1} failed with error: {e}. Retrying in {delay}s...")
|
41
|
+
await asyncio.sleep(delay)
|
42
|
+
else:
|
43
|
+
print(f"All {max_retries + 1} attempts failed.")
|
44
|
+
if last_exception is not None:
|
45
|
+
raise last_exception
|
46
|
+
return wrapper # type: ignore
|
47
|
+
return decorator
|
48
|
+
|
49
|
+
|
50
|
+
def reconnect_on_connection_error(func: F) -> F:
|
51
|
+
"""
|
52
|
+
A decorator for MCPClient methods that automatically tries to reconnect
|
53
|
+
and retry the call if a connection-related error is caught.
|
54
|
+
It handles McpError and anyio.BrokenResourceError.
|
55
|
+
"""
|
56
|
+
@functools.wraps(func)
|
57
|
+
async def wrapper(self, *args: Any, **kwargs: Any) -> Any:
|
58
|
+
try:
|
59
|
+
return await func(self, *args, **kwargs)
|
60
|
+
except (McpError, BrokenResourceError) as e:
|
61
|
+
is_connection_error = False
|
62
|
+
if isinstance(e, McpError):
|
63
|
+
error_str = str(e).lower()
|
64
|
+
if "connection closed" in error_str or "peer closed connection" in error_str:
|
65
|
+
is_connection_error = True
|
66
|
+
elif isinstance(e, BrokenResourceError):
|
67
|
+
is_connection_error = True
|
68
|
+
|
69
|
+
if is_connection_error:
|
70
|
+
print(f"Connection error detected ({type(e).__name__}): {e}. Attempting to reconnect...")
|
71
|
+
try:
|
72
|
+
await self.disconnect()
|
73
|
+
await self.connect()
|
74
|
+
print("Reconnected successfully. Retrying the operation...")
|
75
|
+
return await func(self, *args, **kwargs)
|
76
|
+
except Exception as reconnect_e:
|
77
|
+
print(f"Failed to reconnect and retry: {reconnect_e}")
|
78
|
+
# If reconnect fails, raise the original connection error
|
79
|
+
raise e
|
80
|
+
else:
|
81
|
+
# Not a connection-related McpError, re-raise it.
|
82
|
+
raise
|
83
|
+
return wrapper # type: ignore
|
beswarm/bemcp/bemcp/main.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import asyncio
|
2
2
|
from typing import Any, Dict, List, Optional
|
3
3
|
from contextlib import AsyncExitStack
|
4
|
+
from .decorator import async_retry, reconnect_on_connection_error
|
4
5
|
|
5
6
|
from mcp import ClientSession, StdioServerParameters
|
6
7
|
from mcp.client.stdio import stdio_client
|
@@ -36,6 +37,7 @@ class MCPClient:
|
|
36
37
|
"""Disconnects from the MCP server and cleans up resources."""
|
37
38
|
return await self.__aexit__(None, None, None)
|
38
39
|
|
40
|
+
@async_retry(max_retries=2)
|
39
41
|
async def __aenter__(self):
|
40
42
|
"""Connects to the MCP server and initializes resources."""
|
41
43
|
if self.session:
|
@@ -68,6 +70,7 @@ class MCPClient:
|
|
68
70
|
self._exit_stack = None
|
69
71
|
print("Disconnected from server.")
|
70
72
|
|
73
|
+
@reconnect_on_connection_error
|
71
74
|
async def list_tools(self) -> List[types.Tool]:
|
72
75
|
"""Lists available tools from the server."""
|
73
76
|
if not self.session:
|
@@ -75,12 +78,14 @@ class MCPClient:
|
|
75
78
|
response = await self.session.list_tools()
|
76
79
|
return response.tools
|
77
80
|
|
81
|
+
@reconnect_on_connection_error
|
78
82
|
async def call_tool(self, name: str, args: Dict[str, Any]) -> types.CallToolResult:
|
79
83
|
"""Calls a tool on the server."""
|
80
84
|
if not self.session:
|
81
85
|
raise ConnectionError("Not connected to any server.")
|
82
86
|
return await self.session.call_tool(name, args)
|
83
87
|
|
88
|
+
@reconnect_on_connection_error
|
84
89
|
async def list_resources(self) -> List[types.Resource]:
|
85
90
|
"""Lists available resources from the server."""
|
86
91
|
if not self.session:
|
@@ -88,6 +93,7 @@ class MCPClient:
|
|
88
93
|
response = await self.session.list_resources()
|
89
94
|
return response.resources
|
90
95
|
|
96
|
+
@reconnect_on_connection_error
|
91
97
|
async def read_resource(self, uri: str) -> types.ReadResourceResult:
|
92
98
|
"""Reads a resource from the server."""
|
93
99
|
if not self.session:
|
beswarm/bemcp/bemcp/utils.py
CHANGED
beswarm/bemcp/test/server.py
CHANGED
beswarm/tools/__init__.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
from .think import think
|
2
1
|
from .edit_file import edit_file
|
3
2
|
from .worker import worker, worker_gen
|
4
3
|
from .screenshot import save_screenshot_to_file
|
@@ -25,7 +24,6 @@ from ..aient.src.aient.plugins import (
|
|
25
24
|
)
|
26
25
|
|
27
26
|
__all__ = [
|
28
|
-
"think",
|
29
27
|
"edit_file",
|
30
28
|
"worker",
|
31
29
|
"worker_gen",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: beswarm
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.4
|
4
4
|
Summary: MAS
|
5
5
|
Requires-Python: >=3.11
|
6
6
|
Description-Content-Type: text/markdown
|
@@ -79,6 +79,17 @@ docker run --gpus all -it --rm --entrypoint nvidia-smi yym68686/beswarm
|
|
79
79
|
docker run -it --rm --entrypoint cat yym68686/beswarm /app/beswarm/aient/src/aient/models/chatgpt.py
|
80
80
|
```
|
81
81
|
|
82
|
+
beswarm docker debug 命令
|
83
|
+
|
84
|
+
```bash
|
85
|
+
cd /Users/yanyuming/Downloads/GitHub/beswarm
|
86
|
+
docker run --rm -it \
|
87
|
+
--network="host" \
|
88
|
+
--env-file .env \
|
89
|
+
-v ./work/test:/app/work yym68686/beswarm \
|
90
|
+
--goal '帮我写一个简单的python脚本打印hello world' /bin/bash
|
91
|
+
```
|
92
|
+
|
82
93
|
服务器安装
|
83
94
|
|
84
95
|
```bash
|
@@ -2,13 +2,13 @@ beswarm/__init__.py,sha256=HZjUOJtZR5QhMuDbq-wukQQn1VrBusNWai_ysGo-VVI,20
|
|
2
2
|
beswarm/prompt.py,sha256=3WoI_1lwqvK9O3WF4a3gaZGgQICsa1ygn07iOfuSzyI,31984
|
3
3
|
beswarm/utils.py,sha256=lm0drN1ebXM9haoKaW2DLzJJRCOpLmiJ864mH4jAdB4,6697
|
4
4
|
beswarm/aient/main.py,sha256=SiYAIgQlLJqYusnTVEJOx1WNkSJKMImhgn5aWjfroxg,3814
|
5
|
-
beswarm/aient/setup.py,sha256=
|
5
|
+
beswarm/aient/setup.py,sha256=rROoj5y5L8xuCRH08xVIiLgkk9BilfVZVZ3AOOIShIY,487
|
6
6
|
beswarm/aient/src/aient/__init__.py,sha256=SRfF7oDVlOOAi6nGKiJIUK6B_arqYLO9iSMp-2IZZps,21
|
7
7
|
beswarm/aient/src/aient/core/__init__.py,sha256=NxjebTlku35S4Dzr16rdSqSTWUvvwEeACe8KvHJnjPg,34
|
8
8
|
beswarm/aient/src/aient/core/log_config.py,sha256=kz2_yJv1p-o3lUQOwA3qh-LSc3wMHv13iCQclw44W9c,274
|
9
9
|
beswarm/aient/src/aient/core/models.py,sha256=d4MISNezTSe0ls0-fjuToI2SoT-sk5fWqAJuKVinIlo,7502
|
10
|
-
beswarm/aient/src/aient/core/request.py,sha256=
|
11
|
-
beswarm/aient/src/aient/core/response.py,sha256=
|
10
|
+
beswarm/aient/src/aient/core/request.py,sha256=gXHdx61emExUTZbUyLng_AYmlfyKl3uOcCmlAY5eN98,72330
|
11
|
+
beswarm/aient/src/aient/core/response.py,sha256=mAVsCnNhWY09DXNe0lyPUJq-1ljtGjC67Az-Uh7ozIw,35166
|
12
12
|
beswarm/aient/src/aient/core/utils.py,sha256=fhI5wBxr01lVEp8nMfjG9dQ859AE-VdrWyb9suLzzqM,27400
|
13
13
|
beswarm/aient/src/aient/core/test/test_base_api.py,sha256=pWnycRJbuPSXKKU9AQjWrMAX1wiLC_014Qc9hh5C2Pw,524
|
14
14
|
beswarm/aient/src/aient/core/test/test_geminimask.py,sha256=HFX8jDbNg_FjjgPNxfYaR-0-roUrOO-ND-FVsuxSoiw,13254
|
@@ -72,10 +72,11 @@ beswarm/aient/test/test_whisper.py,sha256=GxKYzhh3lA8t62V_DDj42VQTXkdjocSFcl5u96
|
|
72
72
|
beswarm/aient/test/test_wildcard.py,sha256=EQwwNrTMHV4CEcZKdwUVGrwtNUsF0CCKbM-_W9IOYsk,693
|
73
73
|
beswarm/aient/test/test_yjh.py,sha256=MsHuBLNOqi3fyX-uboBKmTevkZW_KVv12p-pkF5ir3Y,787
|
74
74
|
beswarm/bemcp/bemcp/__init__.py,sha256=Ss6bDXiZJgVIZS6KWytcGwXmIFu7SsagIXa5NpeWJ7c,140
|
75
|
-
beswarm/bemcp/bemcp/
|
76
|
-
beswarm/bemcp/bemcp/
|
75
|
+
beswarm/bemcp/bemcp/decorator.py,sha256=23bNgwLjuUkpod5VcRv-UqlJTf91_wfztf8ls7-Gg08,3218
|
76
|
+
beswarm/bemcp/bemcp/main.py,sha256=gtl3oyjAM_rwFw3kR-m-cUpS0FFTASnUOB8-fMrVT7g,8608
|
77
|
+
beswarm/bemcp/bemcp/utils.py,sha256=GnasmxcPjG668WCu_mpI2r3w1TtSmWyF2pORZl4ZIjg,951
|
77
78
|
beswarm/bemcp/test/client.py,sha256=j7PDg5Esyri-e2vz2ubZ4foDSAq5Iv8Yfl_xyzTDsFY,1593
|
78
|
-
beswarm/bemcp/test/server.py,sha256=
|
79
|
+
beswarm/bemcp/test/server.py,sha256=XqSrk88FC-dk7AcEn-OyS_fR0W0V9OnL2ONpkNEKJKE,1159
|
79
80
|
beswarm/queries/tree-sitter-language-pack/README.md,sha256=ivZSEuWqYfUVLZl2AZZGRlm0bQsaG-VTBKBwACyM07k,291
|
80
81
|
beswarm/queries/tree-sitter-language-pack/arduino-tags.scm,sha256=HbgdothT9Jjk56COXTtUkVAdZ14rZNnqzLbWVLeRs5U,177
|
81
82
|
beswarm/queries/tree-sitter-language-pack/c-tags.scm,sha256=EIz45o5hBh8yEuck5ZR_4IpcGyWSeNrzxFmtkKZGt2k,461
|
@@ -124,7 +125,7 @@ beswarm/queries/tree-sitter-languages/ruby-tags.scm,sha256=vIidsCeE2A0vdFN18yXKq
|
|
124
125
|
beswarm/queries/tree-sitter-languages/rust-tags.scm,sha256=9ljM1nzhfPs_ZTRw7cr2P9ToOyhGcKkCoN4_HPXSWi4,1451
|
125
126
|
beswarm/queries/tree-sitter-languages/scala-tags.scm,sha256=UxQjz80JIrrJ7Pm56uUnQyThfmQNvwk7aQzPNypB-Ao,1761
|
126
127
|
beswarm/queries/tree-sitter-languages/typescript-tags.scm,sha256=OMdCeedPiA24ky82DpgTMKXK_l2ySTuF2zrQ2fJAi9E,1253
|
127
|
-
beswarm/tools/__init__.py,sha256=
|
128
|
+
beswarm/tools/__init__.py,sha256=xTA2aKUlQj5sAglk71i5xV2Y32SH8T8vMb-0zoe4cBc,1160
|
128
129
|
beswarm/tools/click.py,sha256=TygaekCXTmU3fIu6Uom7ZcyzEgYMlCC_GX-5SmWHuLI,20762
|
129
130
|
beswarm/tools/edit_file.py,sha256=iwWl7a8sTVq4vj0e1ny3H6UGcHfYnxALRGcLuk5hZS8,9155
|
130
131
|
beswarm/tools/planner.py,sha256=lguBCS6kpwNPoXQvqH-WySabVubT82iyWOkJnjt6dXw,1265
|
@@ -132,9 +133,8 @@ beswarm/tools/repomap.py,sha256=YsTPq5MXfn_Ds5begcvHDnY_Xp2d4jH-xmWqNMHnNHY,4523
|
|
132
133
|
beswarm/tools/screenshot.py,sha256=u6t8FCgW5YHJ_Oc4coo8e0F3wTusWE_-H8dFh1rBq9Q,1011
|
133
134
|
beswarm/tools/search_arxiv.py,sha256=GpuIOYX8T0iRC-X-hmuR9AUJVn15WWZq864DaoC7BUc,8004
|
134
135
|
beswarm/tools/search_web.py,sha256=w0T0aCqOVlb6Of5hn_TtpnrGXo6bMtw2aKZdkrYjycI,12069
|
135
|
-
beswarm/tools/think.py,sha256=WLw-7jNIsnS6n8MMSYUin_f-BGLENFmnKM2LISEp0co,1760
|
136
136
|
beswarm/tools/worker.py,sha256=ubZ0nqmHlY9a02SL4_HwKEzYec0bVZI-0gJWIfWTJg4,21058
|
137
|
-
beswarm-0.2.
|
138
|
-
beswarm-0.2.
|
139
|
-
beswarm-0.2.
|
140
|
-
beswarm-0.2.
|
137
|
+
beswarm-0.2.4.dist-info/METADATA,sha256=3rdScnu9Ulr2a3u3OBumzr8fshqUZeN7ZFKhlXmOb7w,3846
|
138
|
+
beswarm-0.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
139
|
+
beswarm-0.2.4.dist-info/top_level.txt,sha256=pJw4O87wvt5882smuSO6DfByJz7FJ8SxxT8h9fHCmpo,8
|
140
|
+
beswarm-0.2.4.dist-info/RECORD,,
|
beswarm/tools/think.py
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
from ..aient.src.aient.plugins import register_tool
|
2
|
-
from pdfminer.high_level import extract_text
|
3
|
-
|
4
|
-
@register_tool()
|
5
|
-
def think(thought: str):
|
6
|
-
"""
|
7
|
-
为模型(即我自己)提供的结构化思考空间
|
8
|
-
|
9
|
-
作为语言模型,当我处理复杂问题时,有时需要停下来整理思路。这个工具创建了一个专门的空间,
|
10
|
-
让我可以在不直接回复用户的情况下,先进行结构化的思考和推理。
|
11
|
-
|
12
|
-
当我应该使用此工具:
|
13
|
-
- 在处理多步骤工具调用链时,需要分析前一步的结果再决定下一步行动
|
14
|
-
- 面对复杂的政策或规则,需要逐条检查合规性
|
15
|
-
- 解决需要深入推理的问题,特别是当中间步骤很重要时
|
16
|
-
- 需要评估多个可能的解决方案并选择最佳方案时
|
17
|
-
- 在不确定如何进行时,通过结构化思考来明确下一步
|
18
|
-
|
19
|
-
思考内容建议结构:
|
20
|
-
1. 问题分解:将复杂问题分解为更小的部分
|
21
|
-
2. 信息分析:整理已知信息,识别缺失的关键信息
|
22
|
-
3. 解决方案生成:考虑多种可能的解决方案
|
23
|
-
4. 方案评估:分析每种方案的优缺点
|
24
|
-
5. 决策计划:确定最终行动计划和下一步
|
25
|
-
|
26
|
-
注意:这与"扩展思考"不同。"扩展思考"发生在开始生成回复之前,而此工具用于我在已开始
|
27
|
-
回复后需要处理新信息时的思考过程。
|
28
|
-
|
29
|
-
参数:
|
30
|
-
thought (str): 我的详细思考过程
|
31
|
-
|
32
|
-
返回:
|
33
|
-
str: 确认已记录思考内容的消息(这不会直接展示给用户)
|
34
|
-
"""
|
35
|
-
# 仅记录思考过程,不执行实际操作
|
36
|
-
return f"已记录思考。请遵从思考内容,进行下一步操作。"
|
37
|
-
|
38
|
-
|
39
|
-
if __name__ == "__main__":
|
40
|
-
print(think("我想吃火锅"))
|
File without changes
|
File without changes
|