Skip to content

Commit a2bf3b5

Browse files
committed
fix output response order so LLM does not lose the instructions
1 parent 4ff957e commit a2bf3b5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/utils/actor-response.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ Actor output data schema:
3232
${JSON.stringify(displaySchema, null, 2)}
3333
\`\`\`
3434
35-
Below this text block is a preview of the Actor output containing ${result.previewItems.length} item(s).
35+
Above this text block is a preview of the Actor output containing ${result.previewItems.length} item(s).${itemCount !== result.previewItems.length ? ` You have access only to a limited preview of the Actor output. Do not present this as the full output, as you have only ${result.previewItems.length} item(s) available instead of the full ${itemCount} item(s). Be aware of this and inform users about the currently loaded count and the total available output items count.` : ''}
3636
37-
If you need to retrieve additional data, use the "get-actor-output" tool with:
38-
datasetId: "${datasetId}"
39-
Be sure to limit the number of results when using the "get-actor-output" tool, since you never know how large the items may be and they might exceed the output limits.
37+
If you need to retrieve additional data, use the "get-actor-output" tool with: datasetId: "${datasetId}". Be sure to limit the number of results when using the "get-actor-output" tool, since you never know how large the items may be, and they might exceed the output limits.
4038
`;
4139

4240
const itemsPreviewText = result.previewItems.length > 0
@@ -45,8 +43,11 @@ Be sure to limit the number of results when using the "get-actor-output" tool, s
4543

4644
// Build content array
4745
const content: ({ type: 'text'; text: string })[] = [
48-
{ type: 'text', text: textContent },
4946
{ type: 'text', text: itemsPreviewText },
47+
/**
48+
* The metadata and instructions text must be at the end otherwise the LLM does not acknowledge it.
49+
*/
50+
{ type: 'text', text: textContent },
5051
];
5152

5253
return content;

0 commit comments

Comments
 (0)