refactor(instruction): remove governance instruction handling and update related tests
This commit is contained in:
@@ -48,7 +48,6 @@ func (c *RuntimeTraceCollector) SetInstructionSummary(summary InstructionTraceSu
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.Data.Instruction.SectionTitles = append([]string(nil), summary.SectionTitles...)
|
||||
c.Data.Instruction.HasGovernanceRule = summary.HasGovernanceRule
|
||||
c.Data.Instruction.HasAgentRule = summary.HasAgentRule
|
||||
c.Data.Instruction.HasSkillRule = summary.HasSkillRule
|
||||
c.Data.Instruction.HasToolRule = summary.HasToolRule
|
||||
|
||||
@@ -70,11 +70,10 @@ type RetrieverPolicyTraceItem struct {
|
||||
}
|
||||
|
||||
type InstructionTraceSummary struct {
|
||||
SectionTitles []string
|
||||
HasGovernanceRule bool
|
||||
HasAgentRule bool
|
||||
HasSkillRule bool
|
||||
HasToolRule bool
|
||||
SectionTitles []string
|
||||
HasAgentRule bool
|
||||
HasSkillRule bool
|
||||
HasToolRule bool
|
||||
}
|
||||
|
||||
type RuntimeTraceData struct {
|
||||
@@ -91,11 +90,10 @@ type RuntimeTraceData struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
} `json:"model"`
|
||||
Instruction struct {
|
||||
SectionTitles []string `json:"sectionTitles,omitempty"`
|
||||
HasGovernanceRule bool `json:"hasGovernanceRule,omitempty"`
|
||||
HasAgentRule bool `json:"hasAgentRule,omitempty"`
|
||||
HasSkillRule bool `json:"hasSkillRule,omitempty"`
|
||||
HasToolRule bool `json:"hasToolRule,omitempty"`
|
||||
SectionTitles []string `json:"sectionTitles,omitempty"`
|
||||
HasAgentRule bool `json:"hasAgentRule,omitempty"`
|
||||
HasSkillRule bool `json:"hasSkillRule,omitempty"`
|
||||
HasToolRule bool `json:"hasToolRule,omitempty"`
|
||||
} `json:"instruction"`
|
||||
Input struct {
|
||||
HistoryMessageCount int `json:"historyMessageCount,omitempty"`
|
||||
|
||||
@@ -56,7 +56,7 @@ func NewAgentFactory() *AgentFactory {
|
||||
return &AgentFactory{
|
||||
chatModelFactory: NewChatModelFactory(),
|
||||
toolFactory: NewToolFactory(),
|
||||
instructionService: instruction.NewService(),
|
||||
instructionService: instruction.NewService(nil, nil, nil),
|
||||
handlerService: NewAgentHandlerService(nil),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ func TestAgentHandlerServiceBuildWithCollectorOnly(t *testing.T) {
|
||||
handlers, err := service.Build(context.Background(), BuildAgentHandlersInput{
|
||||
Collector: collector,
|
||||
InstructionSummary: einocallbacks.InstructionTraceSummary{
|
||||
SectionTitles: []string{"系统治理规则"},
|
||||
HasGovernanceRule: true,
|
||||
SectionTitles: []string{"Agent 规则"},
|
||||
HasAgentRule: true,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
@@ -24,7 +24,7 @@ func TestAgentHandlerServiceBuildWithCollectorOnly(t *testing.T) {
|
||||
if len(handlers) != 1 {
|
||||
t.Fatalf("expected 1 handler, got %d", len(handlers))
|
||||
}
|
||||
if !collector.Data.Instruction.HasGovernanceRule {
|
||||
if !collector.Data.Instruction.HasAgentRule {
|
||||
t.Fatalf("instruction summary was not written to collector: %#v", collector.Data.Instruction)
|
||||
}
|
||||
if len(collector.Data.Instruction.SectionTitles) != 1 {
|
||||
|
||||
@@ -14,11 +14,10 @@ import (
|
||||
|
||||
func buildInstructionTraceSummary(summary runtimeinstruction.AssemblySummary) einocallbacks.InstructionTraceSummary {
|
||||
return einocallbacks.InstructionTraceSummary{
|
||||
SectionTitles: append([]string(nil), summary.SectionTitles...),
|
||||
HasGovernanceRule: summary.HasGovernanceRule,
|
||||
HasAgentRule: summary.HasAgentRule,
|
||||
HasSkillRule: summary.HasSkillRule,
|
||||
HasToolRule: summary.HasToolRule,
|
||||
SectionTitles: append([]string(nil), summary.SectionTitles...),
|
||||
HasAgentRule: summary.HasAgentRule,
|
||||
HasSkillRule: summary.HasSkillRule,
|
||||
HasToolRule: summary.HasToolRule,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,17 +8,16 @@ import (
|
||||
|
||||
func TestBuildInstructionTraceSummary(t *testing.T) {
|
||||
got := buildInstructionTraceSummary(runtimeinstruction.AssemblySummary{
|
||||
SectionTitles: []string{"系统治理规则", "当前技能上下文"},
|
||||
HasGovernanceRule: true,
|
||||
HasAgentRule: true,
|
||||
HasSkillRule: true,
|
||||
HasToolRule: false,
|
||||
SectionTitles: []string{"Agent 规则", "当前技能上下文"},
|
||||
HasAgentRule: true,
|
||||
HasSkillRule: true,
|
||||
HasToolRule: false,
|
||||
})
|
||||
|
||||
if len(got.SectionTitles) != 2 {
|
||||
t.Fatalf("unexpected section titles: %#v", got.SectionTitles)
|
||||
}
|
||||
if !got.HasGovernanceRule || !got.HasAgentRule || !got.HasSkillRule {
|
||||
if !got.HasAgentRule || !got.HasSkillRule {
|
||||
t.Fatalf("unexpected summary flags: %#v", got)
|
||||
}
|
||||
if got.HasToolRule {
|
||||
|
||||
Reference in New Issue
Block a user