diff --git a/src/prime.js b/src/prime.js index 2913013..16808b0 100644 --- a/src/prime.js +++ b/src/prime.js @@ -3,11 +3,8 @@ // One round trip, not two: since evolver 2.0.39 `/asset/fetch` recalls by text // when it is given no ids, so selecting a candidate and materialising it are the -// same call. The pair it replaces had to buy its second hop out of the wait -// budget, and that budget only ever afforded two candidates; a recall returns -// whole assets, so this limit is about how many the Hub should rank, not about -// what the step can afford to wait for. -const RECALL_LIMIT = 5; +// same call. No `limit` is sent, so the Hub's own default decides how many come +// back (two at present). const MIN_PROMPT_CHARS = 8; const PROMPT_MAX_CHARS = 400; const STEP_MAX_CHARS = 400; @@ -132,7 +129,7 @@ export async function hubGene(proxyFetch, text, { return EMPTY_MATCH; } - const recalled = await proxyJson(proxyFetch, '/asset/fetch', { text, limit: RECALL_LIMIT }, signal); + const recalled = await proxyJson(proxyFetch, '/asset/fetch', { text }, signal); if (recalled.error) { onOutcome({ status: 'proxy_error', error: recalled.error }); return EMPTY_MATCH; diff --git a/test/prime.test.js b/test/prime.test.js index d12fc70..eb625ad 100644 --- a/test/prime.test.js +++ b/test/prime.test.js @@ -38,7 +38,7 @@ test('one call recalls by text and injects that asset\'s strategy alone', async const { ids, text } = await hubGene(proxyFetch, 'add a retry to the uploader', { signal: controller.signal }); assert.deepEqual(calls.map((call) => call.path), ['/asset/fetch']); - assert.deepEqual(calls[0].body, { text: 'add a retry to the uploader', limit: 5 }); + assert.deepEqual(calls[0].body, { text: 'add a retry to the uploader' }, 'no limit: the Hub default decides'); assert.ok(!('asset_ids' in calls[0].body), 'ids would turn the recall back into a lookup'); assert.equal(calls[0].signal, controller.signal); assert.deepEqual(ids, ['sha256:abc']); @@ -54,7 +54,7 @@ test('a bounded prompt reaches the Hub, and a trivial one never does', async () const long = stubProxy({ assets: [] }); await hubGene(long.proxyFetch, 'x'.repeat(5_000)); assert.ok(long.calls[0].body.text.length <= 5_000); - assert.equal(long.calls[0].body.limit, 5); + assert.equal('limit' in long.calls[0].body, false); const trivial = stubProxy({ assets: [ASSET] }); assert.deepEqual(await hubGene(trivial.proxyFetch, 'hi'), { ids: [], text: '' });