Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/prime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/prime.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -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: '' });
Expand Down