mirror of https://github.com/buster-so/buster.git
Merge pull request #404 from buster-so/staging
Drop the trigger task compute to small-2x
This commit is contained in:
commit
bc16b942d5
|
@ -272,7 +272,7 @@ export const analystAgentTask: ReturnType<
|
||||||
>
|
>
|
||||||
> = schemaTask({
|
> = schemaTask({
|
||||||
id: 'analyst-agent-task',
|
id: 'analyst-agent-task',
|
||||||
machine: 'medium-2x',
|
machine: 'small-2x',
|
||||||
schema: AnalystAgentTaskInputSchema,
|
schema: AnalystAgentTaskInputSchema,
|
||||||
maxDuration: 600, // 10 minutes for complex analysis
|
maxDuration: 600, // 10 minutes for complex analysis
|
||||||
run: async (payload): Promise<AnalystAgentTaskOutput> => {
|
run: async (payload): Promise<AnalystAgentTaskOutput> => {
|
||||||
|
|
|
@ -12,11 +12,6 @@ import type { AnalystRuntimeContext } from '../workflows/analyst-workflow';
|
||||||
|
|
||||||
const inputSchema = thinkAndPrepWorkflowInputSchema;
|
const inputSchema = thinkAndPrepWorkflowInputSchema;
|
||||||
|
|
||||||
// Agent output schema - only for extracting values
|
|
||||||
const extractValuesAgentOutputSchema = z.object({
|
|
||||||
values: z.array(z.string()).describe('The values that the agent will search for.'),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Step output schema - what the step returns after performing the search
|
// Step output schema - what the step returns after performing the search
|
||||||
export const extractValuesSearchOutputSchema = z.object({
|
export const extractValuesSearchOutputSchema = z.object({
|
||||||
values: z.array(z.string()).describe('The values that the agent will search for.'),
|
values: z.array(z.string()).describe('The values that the agent will search for.'),
|
||||||
|
@ -35,7 +30,7 @@ export const extractValuesSearchOutputSchema = z.object({
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
versionNumber: z.number(),
|
versionNumber: z.number(),
|
||||||
metricIds: z.array(z.string()),
|
metricIds: z.array(z.string()),
|
||||||
}),
|
})
|
||||||
)
|
)
|
||||||
.optional(),
|
.optional(),
|
||||||
});
|
});
|
||||||
|
@ -93,7 +88,7 @@ Focus only on extracting meaningful, specific values that could be searched for
|
||||||
* Organizes search results by schema.table structure with columns and their values
|
* Organizes search results by schema.table structure with columns and their values
|
||||||
*/
|
*/
|
||||||
function organizeResultsBySchemaTable(
|
function organizeResultsBySchemaTable(
|
||||||
results: StoredValueResult[],
|
results: StoredValueResult[]
|
||||||
): Record<string, Record<string, string[]>> {
|
): Record<string, Record<string, string[]>> {
|
||||||
const organized: Record<string, Record<string, string[]>> = {};
|
const organized: Record<string, Record<string, string[]>> = {};
|
||||||
|
|
||||||
|
@ -149,7 +144,7 @@ function formatSearchResults(results: StoredValueResult[]): string {
|
||||||
*/
|
*/
|
||||||
async function searchStoredValues(
|
async function searchStoredValues(
|
||||||
values: string[],
|
values: string[],
|
||||||
dataSourceId: string,
|
dataSourceId: string
|
||||||
): Promise<{
|
): Promise<{
|
||||||
searchResults: string;
|
searchResults: string;
|
||||||
foundValues: Record<string, Record<string, string[]>>;
|
foundValues: Record<string, Record<string, string[]>>;
|
||||||
|
@ -173,7 +168,7 @@ async function searchStoredValues(
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
`[StoredValues] Failed to generate embedding for "${value}":`,
|
`[StoredValues] Failed to generate embedding for "${value}":`,
|
||||||
error instanceof Error ? error.message : 'Unknown error',
|
error instanceof Error ? error.message : 'Unknown error'
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +176,7 @@ async function searchStoredValues(
|
||||||
|
|
||||||
const embeddingResults = await Promise.all(embeddingPromises);
|
const embeddingResults = await Promise.all(embeddingPromises);
|
||||||
const validEmbeddings = embeddingResults.filter(
|
const validEmbeddings = embeddingResults.filter(
|
||||||
(result): result is { value: string; embedding: number[] } => result !== null,
|
(result): result is { value: string; embedding: number[] } => result !== null
|
||||||
);
|
);
|
||||||
|
|
||||||
if (validEmbeddings.length === 0) {
|
if (validEmbeddings.length === 0) {
|
||||||
|
@ -196,12 +191,12 @@ async function searchStoredValues(
|
||||||
// Search for values using each embedding concurrently with individual error handling
|
// Search for values using each embedding concurrently with individual error handling
|
||||||
const searchPromises = validEmbeddings.map(async ({ value, embedding }) => {
|
const searchPromises = validEmbeddings.map(async ({ value, embedding }) => {
|
||||||
try {
|
try {
|
||||||
const results = await searchValuesByEmbedding(dataSourceId, embedding, { limit: 30 });
|
const results = await searchValuesByEmbedding(dataSourceId, embedding, { limit: 100 });
|
||||||
return results;
|
return results;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
`[StoredValues] Failed to search stored values for "${value}":`,
|
`[StoredValues] Failed to search stored values for "${value}":`,
|
||||||
error instanceof Error ? error.message : 'Unknown error',
|
error instanceof Error ? error.message : 'Unknown error'
|
||||||
);
|
);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -278,7 +273,7 @@ const extractValuesSearchStepExecution = async ({
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Extract Values',
|
name: 'Extract Values',
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
extractedValues = await tracedValuesExtraction();
|
extractedValues = await tracedValuesExtraction();
|
||||||
|
|
Loading…
Reference in New Issue