Skip to content

Commit e41187a

Browse files
committed
fix(graph): increase entity extraction output budget
1 parent 2523dc7 commit e41187a

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

internal/application/service/chat_pipeline/extract_entity.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ func (p *PluginExtractEntity) OnEvent(ctx context.Context,
151151
return next()
152152
}
153153

154+
// Graph extraction can return many nodes and relations; 4096 tokens can truncate the JSON payload.
155+
const entityExtractionMaxTokens = 8192
156+
154157
// Extractor is a struct for extracting entities
155158
type Extractor struct {
156159
chat chat.Chat
@@ -171,7 +174,7 @@ func NewExtractor(
171174
template: template,
172175
chatOpt: &chat.ChatOptions{
173176
Temperature: 0.3,
174-
MaxTokens: 4096,
177+
MaxTokens: entityExtractionMaxTokens,
175178
Thinking: &think,
176179
},
177180
}

internal/application/service/chat_pipeline/extract_entity_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,10 @@ func TestIsLikelyLanguageTag(t *testing.T) {
259259
})
260260
}
261261
}
262+
263+
func TestNewExtractorUsesGraphOutputBudget(t *testing.T) {
264+
extractor := NewExtractor(nil, nil)
265+
if got := extractor.chatOpt.MaxTokens; got != 8192 {
266+
t.Fatalf("MaxTokens = %d, want 8192", got)
267+
}
268+
}

0 commit comments

Comments
 (0)