fix(graph): increase entity extraction output budget (#2859)
parent
e3d52e8353
commit
07a5af673e
|
|
@ -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,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue