amrita_plugin_memory 0.2.5__tar.gz → 0.2.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.
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/PKG-INFO +1 -1
- amrita_plugin_memory-0.2.6/amrita_plugin_memory/rethinking/__init__.py +13 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/_state.py +8 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/runner.py +3 -9
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/tools.py +1 -2
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/PKG-INFO +1 -1
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/pyproject.toml +1 -1
- amrita_plugin_memory-0.2.5/amrita_plugin_memory/rethinking/__init__.py +0 -20
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/LICENSE +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/README.md +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/__init__.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/config.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/embed.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/matchers.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/backend.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/consts.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/hooks.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/nodes.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/schemas.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/workflow.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/tools.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/vector.py +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/SOURCES.txt +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/dependency_links.txt +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/requires.txt +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/top_level.txt +0 -0
- {amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/setup.cfg +0 -0
{amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/_state.py
RENAMED
|
@@ -4,6 +4,8 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
from typing import TYPE_CHECKING, Any
|
|
6
6
|
|
|
7
|
+
from amrita.plugins.chat.config import config_manager
|
|
8
|
+
from amrita_core import ModelPreset
|
|
7
9
|
from amrita_core.tools.manager import MultiToolsManager
|
|
8
10
|
|
|
9
11
|
if TYPE_CHECKING:
|
|
@@ -15,6 +17,12 @@ _pending_messages: list[dict[str, Any]] = []
|
|
|
15
17
|
_SUBCONSCIOUS_TOOLS = MultiToolsManager()
|
|
16
18
|
|
|
17
19
|
|
|
20
|
+
async def get_preset() -> ModelPreset:
|
|
21
|
+
return await config_manager.get_preset(
|
|
22
|
+
(await config_manager.safe_get_config()).preset
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
18
26
|
def get_runner() -> SubconsciousRunner | None:
|
|
19
27
|
return _runner
|
|
20
28
|
|
{amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/runner.py
RENAMED
|
@@ -16,7 +16,7 @@ from amrita_core.base.backend import BackendSlots
|
|
|
16
16
|
from amrita_core.builtins.agent import ReActAgentStrategy
|
|
17
17
|
from amrita_core.chatmanager import ChatObject
|
|
18
18
|
from amrita_core.config import get_config
|
|
19
|
-
from amrita_core.preset import
|
|
19
|
+
from amrita_core.preset import ModelPreset
|
|
20
20
|
from amrita_core.types import Message, UniResponseUsage
|
|
21
21
|
from amrita_core.utils import gather_usage
|
|
22
22
|
from amrita_sense import WorkflowInterpreter
|
|
@@ -123,18 +123,13 @@ class SubconsciousRunner:
|
|
|
123
123
|
self._is_running = True
|
|
124
124
|
self._iter_stop_result = {}
|
|
125
125
|
|
|
126
|
-
preset =
|
|
126
|
+
preset = await _state.get_preset()
|
|
127
127
|
prompt_text = await self._load_prompt()
|
|
128
128
|
user_msg_text = (
|
|
129
129
|
f"现在是第 {self._total_runs + 1} 次潜意识推理循环。"
|
|
130
130
|
f"请检查用户 (ID: {self._config.target_user_id}) 的记忆库,执行必要的整理操作。"
|
|
131
131
|
f"完成后务必调用 subconscious_iter_stop。"
|
|
132
132
|
)
|
|
133
|
-
if self._is_native_thinking():
|
|
134
|
-
user_msg_text += (
|
|
135
|
-
" (注意:你的模型启用了内置思考模式,请务必调用 think_and_reason。)"
|
|
136
|
-
)
|
|
137
|
-
|
|
138
133
|
train = Message(role="system", content=prompt_text)
|
|
139
134
|
user_input = user_msg_text
|
|
140
135
|
|
|
@@ -181,8 +176,7 @@ class SubconsciousRunner:
|
|
|
181
176
|
await self._post_process(chat_obj)
|
|
182
177
|
|
|
183
178
|
@staticmethod
|
|
184
|
-
def _is_native_thinking() -> bool:
|
|
185
|
-
preset = PresetManager().get_default_preset()
|
|
179
|
+
def _is_native_thinking(preset: ModelPreset) -> bool:
|
|
186
180
|
return (
|
|
187
181
|
preset.thinking_config is not None
|
|
188
182
|
and preset.thinking_config.thinking_type == "enabled"
|
{amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/tools.py
RENAMED
|
@@ -8,7 +8,6 @@ from typing import Any
|
|
|
8
8
|
|
|
9
9
|
from amrita_core import on_tools
|
|
10
10
|
from amrita_core.libchat import call_completion, get_last_response
|
|
11
|
-
from amrita_core.preset import PresetManager
|
|
12
11
|
from amrita_core.types import CONTENT_LIST_TYPE, Message
|
|
13
12
|
from chromadb import GetResult
|
|
14
13
|
from jinja2 import Template
|
|
@@ -308,7 +307,7 @@ async def _generate_send_content(intent: str, memory_context: str) -> str:
|
|
|
308
307
|
current_time=datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC"),
|
|
309
308
|
character_prompt=character_prompt,
|
|
310
309
|
)
|
|
311
|
-
preset =
|
|
310
|
+
preset = await _state.get_preset()
|
|
312
311
|
messages: CONTENT_LIST_TYPE = [
|
|
313
312
|
Message(role="system", content=system_content),
|
|
314
313
|
Message(
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"""潜意识推理循环(rethinking 子包)。
|
|
2
|
-
|
|
3
|
-
导入此包时触发工具注册和 hook 注册。
|
|
4
|
-
注意:避免模块级导入 tools/runner 等会触发循环导入的子模块。
|
|
5
|
-
这些模块的副作用(@on_tools 注册、hook 注册)通过 hooks 和 tools 内部的延迟导入自动生效。
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from . import _state, backend, hooks, nodes, schemas, workflow
|
|
9
|
-
|
|
10
|
-
__all__ = [
|
|
11
|
-
"_state",
|
|
12
|
-
"backend",
|
|
13
|
-
"consts",
|
|
14
|
-
"hooks",
|
|
15
|
-
"nodes",
|
|
16
|
-
"runner",
|
|
17
|
-
"schemas",
|
|
18
|
-
"tools",
|
|
19
|
-
"workflow",
|
|
20
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/backend.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/consts.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/hooks.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/nodes.py
RENAMED
|
File without changes
|
{amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory/rethinking/schemas.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{amrita_plugin_memory-0.2.5 → amrita_plugin_memory-0.2.6}/amrita_plugin_memory.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|