mirror of https://github.com/buster-so/buster.git
tests passing
This commit is contained in:
parent
5838285c81
commit
84445efa60
|
@ -307,19 +307,14 @@ export const analystAgentTask: ReturnType<
|
||||||
const braintrustMetadataPromise = getBraintrustMetadata({ messageId: payload.message_id });
|
const braintrustMetadataPromise = getBraintrustMetadata({ messageId: payload.message_id });
|
||||||
|
|
||||||
// Wait for all operations to complete
|
// Wait for all operations to complete
|
||||||
const [
|
const [messageContext, conversationHistory, dataSource, datasets, braintrustMetadata] =
|
||||||
messageContext,
|
await Promise.all([
|
||||||
conversationHistory,
|
messageContextPromise,
|
||||||
dataSource,
|
conversationHistoryPromise,
|
||||||
datasets,
|
dataSourcePromise,
|
||||||
braintrustMetadata,
|
datasetsPromise,
|
||||||
] = await Promise.all([
|
braintrustMetadataPromise,
|
||||||
messageContextPromise,
|
]);
|
||||||
conversationHistoryPromise,
|
|
||||||
dataSourcePromise,
|
|
||||||
datasetsPromise,
|
|
||||||
braintrustMetadataPromise,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const dataLoadEnd = Date.now();
|
const dataLoadEnd = Date.now();
|
||||||
const dataLoadTime = dataLoadEnd - dataLoadStart;
|
const dataLoadTime = dataLoadEnd - dataLoadStart;
|
||||||
|
|
|
@ -89,13 +89,13 @@ describe('re-ask-strategy', () => {
|
||||||
input: JSON.stringify(correctedToolCall.input), // FIXED: Now returns stringified input
|
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 calls = mockGenerateText.mock.calls[0];
|
||||||
const messages = calls?.[0]?.messages;
|
const messages = calls?.[0]?.messages;
|
||||||
const assistantMessage = messages?.find((m: any) => m.role === 'assistant');
|
const assistantMessage = messages?.find((m: any) => m.role === 'assistant');
|
||||||
const content = assistantMessage?.content?.[0];
|
const content = assistantMessage?.content?.[0];
|
||||||
if (content && typeof content === 'object' && 'input' in content) {
|
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(
|
expect(mockGenerateText).toHaveBeenCalledWith(
|
||||||
|
@ -338,7 +338,7 @@ describe('re-ask-strategy', () => {
|
||||||
const assistantMessage = messages?.find((m: any) => m.role === 'assistant');
|
const assistantMessage = messages?.find((m: any) => m.role === 'assistant');
|
||||||
const content = assistantMessage?.content?.[0];
|
const content = assistantMessage?.content?.[0];
|
||||||
if (content && typeof content === 'object' && 'input' in content) {
|
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
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -90,6 +90,7 @@ describe('structured-output-strategy', () => {
|
||||||
model: 'mock-model',
|
model: 'mock-model',
|
||||||
schema: tool?.inputSchema,
|
schema: tool?.inputSchema,
|
||||||
prompt: expect.stringContaining('Fix these tool arguments'),
|
prompt: expect.stringContaining('Fix these tool arguments'),
|
||||||
|
mode: 'json',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue