tests passing

This commit is contained in:
dal 2025-08-21 08:58:43 -06:00
parent 5838285c81
commit 84445efa60
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
3 changed files with 12 additions and 16 deletions

View File

@ -307,13 +307,8 @@ export const analystAgentTask: ReturnType<
const braintrustMetadataPromise = getBraintrustMetadata({ messageId: payload.message_id });
// Wait for all operations to complete
const [
messageContext,
conversationHistory,
dataSource,
datasets,
braintrustMetadata,
] = await Promise.all([
const [messageContext, conversationHistory, dataSource, datasets, braintrustMetadata] =
await Promise.all([
messageContextPromise,
conversationHistoryPromise,
dataSourcePromise,

View File

@ -89,13 +89,13 @@ describe('re-ask-strategy', () => {
input: JSON.stringify(correctedToolCall.input), // FIXED: Now returns stringified input
});
// Verify the tool input is properly formatted as a string in the messages
// Verify the tool input is properly formatted as an object in the messages
const calls = mockGenerateText.mock.calls[0];
const messages = calls?.[0]?.messages;
const assistantMessage = messages?.find((m: any) => m.role === 'assistant');
const content = assistantMessage?.content?.[0];
if (content && typeof content === 'object' && 'input' in content) {
expect(content.input).toEqual(JSON.stringify({ param: 'value' }));
expect(content.input).toEqual({ param: 'value' });
}
expect(mockGenerateText).toHaveBeenCalledWith(
@ -338,7 +338,7 @@ describe('re-ask-strategy', () => {
const assistantMessage = messages?.find((m: any) => m.role === 'assistant');
const content = assistantMessage?.content?.[0];
if (content && typeof content === 'object' && 'input' in content) {
expect(content.input).toEqual('{"already":"valid"}'); // Now expects stringified JSON
expect(content.input).toEqual({ already: 'valid' }); // Expects parsed object
}
});
});

View File

@ -90,6 +90,7 @@ describe('structured-output-strategy', () => {
model: 'mock-model',
schema: tool?.inputSchema,
prompt: expect.stringContaining('Fix these tool arguments'),
mode: 'json',
});
});