feat(agent): add per-agent citation output toggle
Move citation protocol injection to the system layer so custom prompts no longer own citation syntax. Agents can disable inline citations while source aliases still encode and decode tool arguments correctly.
This commit is contained in:
@@ -105,6 +105,23 @@ func withMaxIterations(n int) testEngineOption {
|
||||
}
|
||||
}
|
||||
|
||||
func withCitationsEnabled(enabled bool) testEngineOption {
|
||||
return func(cfg *types.AgentConfig) {
|
||||
cfg.CitationEnabled = &enabled
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildSystemPromptUsesInternalCitationSetting(t *testing.T) {
|
||||
model := &mockChat{}
|
||||
enabledEngine := newTestEngine(t, model)
|
||||
require.Contains(t, enabledEngine.buildSystemPrompt(context.Background()), "Source citations are enabled")
|
||||
|
||||
disabledEngine := newTestEngine(t, model, withCitationsEnabled(false))
|
||||
prompt := disabledEngine.buildSystemPrompt(context.Background())
|
||||
require.Contains(t, prompt, "Source citations are disabled")
|
||||
require.NotContains(t, prompt, "Source citations are enabled")
|
||||
}
|
||||
|
||||
func newTestEngine(t *testing.T, chatModel chat.Chat, opts ...testEngineOption) *AgentEngine {
|
||||
t.Helper()
|
||||
cfg := &types.AgentConfig{
|
||||
|
||||
Reference in New Issue
Block a user