mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-15 08:17:15 +00:00
Render prompts according to the agent interface
Prompt parameters (available tools/markers and the tool name mapping) are now computed per agent interface (SerenaAgent.PromptParams). In REPL mode, the available tools comprise the exposed tools and the enabled facade methods, and the tool name mapping resolves tool names to the qualified names of the corresponding facade methods (e.g. `lsp.find_symbol`), such that prompts refer to operations as they are used in REPL code. The parameters are re-computed whenever the active tools change. FacadeMethod refers to its parent facade and provides facade_name and qualified_name; its name is taken from its info. Prompt templates use the tool name mapping consistently (fixing a template syntax error in the editing mode) and use interface-neutral wording.
This commit is contained in:
1 parent
337d545c4b
commit
6716193d71
6 files changed
+157
-66
No files matched your search
@@ -918,6 +918,11 @@ class TestSerenaAgent:
|
||||
expected = {"serena_repl", "initial_instructions"} | (set() if context.single_project else {"activate_project"})
|
||||
assert exposed == expected
|
||||
assert "s.lsp" in agent.get_tool(SerenaReplTool).apply("s.info()")
|
||||
|
||||
# prompts refer to operations by their qualified REPL names, e.g. `lsp.find_symbol` instead of the tool name
|
||||
system_prompt = agent.create_system_prompt()
|
||||
assert "`lsp.find_symbol`" in system_prompt
|
||||
assert "`find_symbol`" not in system_prompt
|
||||
finally:
|
||||
agent.on_shutdown(timeout=5)
|
||||
|
||||
|
||||
Reference in new issue
Block a user