From efad5ecd91f2ff67938c5316c16bbe0fb5d50199 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Thu, 8 Aug 2024 03:12:54 -0400 Subject: [PATCH] Send images after text block for better results --- src/ClaudeDev.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ClaudeDev.ts b/src/ClaudeDev.ts index 6fd6b53..5f098c6 100644 --- a/src/ClaudeDev.ts +++ b/src/ClaudeDev.ts @@ -322,8 +322,8 @@ export class ClaudeDev { if (images && images.length > 0) { const textBlock: Anthropic.TextBlockParam = { type: "text", text: text ?? "" } const imageBlocks: Anthropic.ImageBlockParam[] = this.formatImagesIntoBlocks(images) - // "Just as with document-query placement, Claude works best when images come before text. Images placed after text or interpolated with text will still perform well, but if your use case allows it, we recommend an image-then-text structure." - return [...imageBlocks, textBlock] + // Placing images after text leads to better results + return [textBlock, ...imageBlocks] } else { return text ?? "" } @@ -351,8 +351,8 @@ export class ClaudeDev { while (this.requestCount < this.maxRequestsPerTask) { const { didEndLoop, inputTokens, outputTokens } = await this.recursivelyMakeClaudeRequests([ - ...imageBlocks, textBlock, + ...imageBlocks, ]) totalInputTokens += inputTokens totalOutputTokens += outputTokens