Default retrieval to 6 chunks instead of 2

chunks is a total per request, split across the attached sources, so an
agent with two sources and the default of 2 got a single chunk from each,
and its answers changed with whichever chunk won. 6 gives three per
source for about 4-5k more input tokens per retrieval turn.

Every literal default moves from 2 to 6: the request default, the
retrievers, the internal search tool, workflow agent nodes, scheduled and
headless runs, agent create/update/import, the source retrieval config and
the frontend forms. Existing agents and sources keep what they store; a
source saved with chunks=2 now counts as configured at 2, which is pinned
by a test.

Headless runs also read chunks=0 as unset (`or 2`), so an agent with
retrieval switched off retrieved anyway on scheduled runs; 0 now stays 0.
This commit is contained in:
arc53-machine committed 2026-09-28 14:34:50 +01:00
1 parent 1c19ed8ce2
commit ab3dbfa1be
33 files changed
+187 -46

No files matched your search

+2 -2
View File
@@ -135,7 +135,7 @@ export default function NewAgent({ mode }: { mode: 'new' | 'edit' | 'draft' }) {
image: '',
source: '',
sources: [],
chunks: '2',
chunks: '6',
retriever: 'classic',
prompt_id: 'default',
tools: [],
@@ -708,7 +708,7 @@ export default function NewAgent({ mode }: { mode: 'new' | 'edit' | 'draft' }) {
agent_type: data.agent_type || 'classic',
prompt_id: data.prompt_id || 'default',
retriever: agentSourceIds.length === 0 ? 'classic' : '',
chunks: data.chunks || '2',
chunks: data.chunks || '6',
tools: data.tools || [],
...serializeAgentSources(agentSourceIds, sourceDocs),
models: agentModels,
@@ -329,7 +329,7 @@ function createEmptyWorkflowAgent(): Agent {
description: '',
image: '',
source: '',
chunks: '2',
chunks: '6',
retriever: '',
prompt_id: '',
tools: [],
+1 -1
View File
@@ -43,7 +43,7 @@ export type SourceGraphRetrievalConfig = {
export type SourceRetrievalConfig = {
retriever?: string; // default 'classic' (only option for now)
exposure?: RetrievalExposure; // default 'prefetch'
chunks?: number; // top-k, default 2
chunks?: number; // top-k, default 6
score_threshold?: number | null; // default null
rephrase_query?: boolean; // default true
prescreen?: SourcePrescreenConfig | null; // null = off
+1 -1
View File
@@ -58,7 +58,7 @@ const initialState: Preference = {
{ name: 'creative', id: 'creative', type: 'public' },
{ name: 'strict', id: 'strict', type: 'public' },
],
chunks: '2',
chunks: '6',
selectedDocs: [],
sourceDocs: null,
conversations: {
@@ -16,6 +16,13 @@ const clone = (v: RetrievalOptionsValue): RetrievalOptionsValue =>
JSON.parse(JSON.stringify(v));
describe('configToOptions (lenient read)', () => {
it('defaults a source to 6 chunks, the backend default', () => {
// Equal to the backend's RetrievalConfig default, so a new upload is not
// read as a per-source override.
expect(DEFAULT_RETRIEVAL_OPTIONS.retrieval.chunks).toBe(6);
expect(configToOptions(undefined).retrieval.chunks).toBe(6);
});
it('returns all defaults for an absent config', () => {
expect(configToOptions(undefined)).toEqual(DEFAULT_RETRIEVAL_OPTIONS);
});
@@ -84,7 +84,7 @@ export const DEFAULT_RETRIEVAL_OPTIONS: RetrievalOptionsValue = {
retrieval: {
retriever: 'classic',
exposure: 'prefetch',
chunks: 2,
chunks: 6,
score_threshold: null,
rephrase_query: true,
prescreen: {
+1 -1
View File
@@ -38,7 +38,7 @@ const preloadedState: { preference: Preference } = {
{ name: 'creative', id: 'creative', type: 'public' },
{ name: 'strict', id: 'strict', type: 'public' },
],
chunks: JSON.parse(chunks ?? '2').toString(),
chunks: JSON.parse(chunks ?? '6').toString(),
selectedDocs: getStoredRecentDocs(),
conversations: {
data: null,