Skip to content

Commit

Permalink
Update ChatAnthropicNode.ts - responseParts fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wayne-chang authored Mar 7, 2024
1 parent 945b965 commit 6120340
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ return await retry(

if (model.startsWith('claude-3')) {
const image = inputs['image' as PortId];
let responseParts: string[] = [];

if (image && image.type === 'image') {
// Use the Messages API for Claude 3 models with Vision
const response = await anthropic.messages.create({
Expand Down Expand Up @@ -412,7 +414,6 @@ return await retry(
});

// Process the response chunks and update the output
const responseParts: string[] = [];
for await (const chunk of chunks) {
if (!chunk.completion) {
continue;
Expand Down Expand Up @@ -449,7 +450,7 @@ return await retry(
}

const endTime = Date.now();

if (model.startsWith('claude-3') && image) {
// Skip token count and duration for Claude 3 models with Vision
} else {
Expand Down

0 comments on commit 6120340

Please sign in to comment.