An AI-powered search engine with a generative UI
TypeScript generative-aigenerative-uinextjsollamareactsearxngshadcn-uitailwindcsstavilytypescriptupstashvercel-ai-sdk
fix: correct TypeScript types in anthropic-message-conversion tests
Yoshiki Miuraf073bf36e3f0
diff --git a/lib/utils/__tests__/anthropic-message-conversion.test.ts b/lib/utils/__tests__/anthropic-message-conversion.test.tsindex 502a2077..35dfcab5 100644--- a/lib/utils/__tests__/anthropic-message-conversion.test.ts+++ b/lib/utils/__tests__/anthropic-message-conversion.test.ts@@ -1,5 +1,5 @@-import { describe, expect, it } from 'vitest'import type { ModelMessage } from 'ai'+import { describe, expect, it } from 'vitest'import { convertMessagesForAnthropic } from '../anthropic-message-conversion'@@ -34,7 +34,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-call',toolCallId: 'call_123',toolName: 'search',- args: { query: 'test' }+ input: { query: 'search query' }},{ type: 'text', text: 'Based on the results...' }]@@ -46,7 +46,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-result',toolCallId: 'call_123',toolName: 'search',- result: { data: 'results' }+ output: { type: 'json', value: { data: 'results' } }}]}@@ -64,7 +64,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-call',toolCallId: 'call_123',toolName: 'search',- args: { query: 'test' }+ input: { query: 'search query' }}]})@@ -85,7 +85,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-call',toolCallId: 'call_123',toolName: 'search',- args: { query: 'test' }+ input: { query: 'search query' }}]},@@ -96,7 +96,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-result',toolCallId: 'call_123',toolName: 'search',- result: { data: 'results' }+ output: { type: 'json', value: { data: 'results' } }}]}@@ -116,13 +116,13 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-call',toolCallId: 'call_123',toolName: 'search',- args: { query: 'test' }+ input: { query: 'search query' }},{type: 'tool-call',toolCallId: 'call_456',toolName: 'fetch',- args: { url: 'http://example.com' }+ input: { url: 'https://example.com' }},{ type: 'text', text: 'Here are the results...' }]@@ -134,7 +134,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-result',toolCallId: 'call_123',toolName: 'search',- result: { data: 'search results' }+ output: { type: 'json', value: { data: 'search results' } }}]}@@ -160,7 +160,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-call',toolCallId: 'call_123',toolName: 'search',- args: { query: 'test' }+ input: { query: 'search query' }}]},@@ -171,7 +171,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-result',toolCallId: 'call_123',toolName: 'search',- result: { data: 'results' }+ output: { type: 'json', value: { data: 'results' } }}]}@@ -187,10 +187,6 @@ describe('convertMessagesForAnthropic', () => {role: 'user',content: [{ type: 'text', text: 'Hello' }]},- {- role: 'system',- content: [{ type: 'text', text: 'You are a helpful assistant' }]- },{role: 'tool',content: [@@ -198,7 +194,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-result',toolCallId: 'call_123',toolName: 'search',- result: { data: 'results' }+ output: { type: 'json', value: { data: 'results' } }}]}@@ -230,7 +226,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-call',toolCallId: 'call_123',toolName: 'search',- args: { query: 'test' }+ input: { query: 'search query' }},{ type: 'text', text: 'Based on the results...' }]@@ -263,7 +259,7 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-call',toolCallId: 'call_123',toolName: 'search',- args: { query: 'test' }+ input: { query: 'search query' }},{ type: 'text', text: ' \n\t ' } // Only whitespace]@@ -275,14 +271,14 @@ describe('convertMessagesForAnthropic', () => {type: 'tool-result',toolCallId: 'call_123',toolName: 'search',- result: { data: 'results' }+ output: { type: 'json', value: { data: 'results' } }}]}]const result = convertMessagesForAnthropic(messages)-+// Should not split because text after tool-call is whitespace onlyexpect(result).toEqual(messages)})@@ -298,4 +294,4 @@ describe('convertMessagesForAnthropic', () => {const result = convertMessagesForAnthropic(messages)expect(result).toEqual(messages)})-})\ No newline at end of file+})