fix(graph): increase entity extraction output budget (#2859)

main
JYao-Chen 2026-09-21 13:08:49 +08:00 committed by GitHub
parent e3d52e8353
commit 07a5af673e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -151,6 +151,9 @@ func (p *PluginExtractEntity) OnEvent(ctx context.Context,
return next()
}
// Graph extraction can return many nodes and relations; 4096 tokens can truncate the JSON payload.
const entityExtractionMaxTokens = 8192
// Extractor is a struct for extracting entities
type Extractor struct {
chat chat.Chat
@ -171,7 +174,7 @@ func NewExtractor(
template: template,
chatOpt: &chat.ChatOptions{
Temperature: 0.3,
MaxTokens: 4096,
MaxTokens: entityExtractionMaxTokens,
Thinking: &think,
},
}

View File

@ -259,3 +259,10 @@ func TestIsLikelyLanguageTag(t *testing.T) {
})
}
}
func TestNewExtractorUsesGraphOutputBudget(t *testing.T) {
extractor := NewExtractor(nil, nil)
if got := extractor.chatOpt.MaxTokens; got != 8192 {
t.Fatalf("MaxTokens = %d, want 8192", got)
}
}