|
38 | 38 | from typing_extensions import Any |
39 | 39 |
|
40 | 40 | from veadk.config import settings |
41 | | -from veadk.consts import ( |
42 | | - DEFAULT_AGENT_NAME, |
43 | | - DEFAULT_MODEL_EXTRA_CONFIG, |
44 | | -) |
| 41 | +from veadk.consts import DEFAULT_AGENT_NAME, DEFAULT_MODEL_EXTRA_CONFIG |
45 | 42 | from veadk.knowledgebase import KnowledgeBase |
46 | 43 | from veadk.memory.long_term_memory import LongTermMemory |
47 | 44 | from veadk.memory.short_term_memory import ShortTermMemory |
@@ -88,6 +85,7 @@ class Agent(LlmAgent): |
88 | 85 | auto_save_session (bool): Whether to automatically save sessions to long-term memory. |
89 | 86 | skills (list[str]): List of skills that equip the agent with specific capabilities. |
90 | 87 | example_store (Optional[BaseExampleProvider]): Example store for providing example Q/A. |
| 88 | + enable_shadowchar (bool): Whether to enable shadow character for the agent. |
91 | 89 | """ |
92 | 90 |
|
93 | 91 | model_config = ConfigDict(arbitrary_types_allowed=True, extra="allow") |
@@ -154,6 +152,8 @@ class Agent(LlmAgent): |
154 | 152 |
|
155 | 153 | enable_supervisor: bool = False |
156 | 154 |
|
| 155 | + enable_ghostchar: bool = False |
| 156 | + |
157 | 157 | def model_post_init(self, __context: Any) -> None: |
158 | 158 | super().model_post_init(None) # for sub_agents init |
159 | 159 |
|
@@ -304,6 +304,14 @@ def model_post_init(self, __context: Any) -> None: |
304 | 304 |
|
305 | 305 | self.tools.append(ExampleTool(examples=self.example_store)) |
306 | 306 |
|
| 307 | + if self.enable_ghostchar: |
| 308 | + logger.info("Ghostchar tool enabled") |
| 309 | + from veadk.tools.ghost_char import GhostcharTool |
| 310 | + |
| 311 | + self.tools.append(GhostcharTool()) |
| 312 | + |
| 313 | + self.instruction += "Please add a character `< at the beginning of you each text-based response." |
| 314 | + |
307 | 315 | logger.info(f"VeADK version: {VERSION}") |
308 | 316 |
|
309 | 317 | logger.info(f"{self.__class__.__name__} `{self.name}` init done.") |
|
0 commit comments