Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
run: pnpm run generate

- name: 🧪 Run Internal Unit Tests
run: pnpm run test:internal --reporter=default --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
run: pnpm run test:internal --reporter=default --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --passWithNoTests

- name: Gather all reports
if: ${{ !cancelled() }}
Expand Down Expand Up @@ -145,4 +145,4 @@ jobs:
merge-multiple: true

- name: Merge reports
run: pnpm dlx vitest@3.1.4 run --merge-reports --pass-with-no-tests
run: pnpm dlx vitest@4.1.7 run --merge-reports --pass-with-no-tests
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
run: pnpm run generate

- name: 🧪 Run Package Unit Tests
run: pnpm run test:packages --reporter=default --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
run: pnpm run test:packages --reporter=default --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --passWithNoTests

- name: Gather all reports
if: ${{ !cancelled() }}
Expand Down Expand Up @@ -145,4 +145,4 @@ jobs:
merge-multiple: true

- name: Merge reports
run: pnpm dlx vitest@3.1.4 run --merge-reports --pass-with-no-tests
run: pnpm dlx vitest@4.1.7 run --merge-reports --pass-with-no-tests
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests-webapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
run: pnpm run generate

- name: 🧪 Run Webapp Unit Tests
run: pnpm run test:webapp --reporter=default --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
run: pnpm run test:webapp --reporter=default --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --passWithNoTests
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
DIRECT_URL: postgresql://postgres:postgres@localhost:5432/postgres
Expand Down Expand Up @@ -153,4 +153,4 @@ jobs:
merge-multiple: true

- name: Merge reports
run: pnpm dlx vitest@3.1.4 run --merge-reports --pass-with-no-tests
run: pnpm dlx vitest@4.1.7 run --merge-reports --pass-with-no-tests
Comment thread
danton267 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,19 @@ export async function action({ request, params }: ActionFunctionArgs) {
for await (const part of result.fullStream) {
switch (part.type) {
case "text-delta": {
sendEvent({ type: "thinking", content: part.textDelta });
sendEvent({ type: "thinking", content: part.text });
Comment thread
danton267 marked this conversation as resolved.
break;
}
case "tool-call": {
sendEvent({
type: "tool_call",
tool: part.toolName,
args: part.args,
args: part.input,
});

// If it's a setTimeFilter call, emit the time_filter event immediately
if (part.toolName === "setTimeFilter") {
const args = part.args as { period?: string; from?: string; to?: string };
const args = part.input as { period?: string; from?: string; to?: string };
sendEvent({
type: "time_filter",
filter: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { openai } from "@ai-sdk/openai";
import { streamText, tool } from "ai";
import { streamText, stepCountIs, tool } from "ai";
import { type ActionFunctionArgs } from "@remix-run/server-runtime";
import { z } from "zod";
import { env } from "~/env.server";
Expand Down Expand Up @@ -105,19 +105,19 @@ export async function action({ request, params }: ActionFunctionArgs) {
getTaskSourceCode: tool({
description:
"Look up the source code of the task to understand what payload shape it expects. Use this when there is no JSON Schema available and you need to infer the payload structure from the task implementation.",
parameters: z.object({}),
inputSchema: z.object({}),
execute: async () => {
return getTaskSourceCode(environment.id, environment.type, taskIdentifier);
},
}),
},
maxSteps: 3,
stopWhen: stepCountIs(3),
});

for await (const part of result.fullStream) {
switch (part.type) {
case "text-delta": {
sendEvent({ type: "thinking", content: part.textDelta });
sendEvent({ type: "thinking", content: part.text });
break;
}
case "tool-call": {
Expand Down
18 changes: 9 additions & 9 deletions apps/webapp/app/v3/services/aiQueryService.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
type TableSchema,
type ValidationIssue,
} from "@internal/tsql";
import { streamText, type LanguageModelV1, tool } from "ai";
import { streamText, stepCountIs, type LanguageModel, tool } from "ai";
import { z } from "zod";
import type { AITimeFilter } from "~/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.query/types";

Expand Down Expand Up @@ -55,7 +55,7 @@ export class AIQueryService {

constructor(
private readonly tableSchema: TableSchema[],
private readonly model: LanguageModelV1 = openai("gpt-4.1-mini")
private readonly model: LanguageModel = openai("gpt-4.1-mini")
) {}

/**
Expand All @@ -66,7 +66,7 @@ export class AIQueryService {
return tool({
description:
"Set the time filter for the query page UI instead of adding time conditions to the query. ALWAYS use this tool when the user wants to filter by time (e.g., 'last 7 days', 'past hour', 'yesterday'). The UI will apply this filter automatically using the table's time column (triggered_at for runs, bucket_start for metrics). Do NOT add triggered_at or bucket_start to the WHERE clause for time filtering - use this tool instead.",
parameters: z.object({
inputSchema: z.object({
period: z
.string()
.optional()
Expand Down Expand Up @@ -125,7 +125,7 @@ export class AIQueryService {
validateTSQLQuery: tool({
description:
"Validate a TSQL query for syntax errors and schema compliance. Always use this tool to verify your query before returning it to the user.",
parameters: z.object({
inputSchema: z.object({
query: z.string().describe("The TSQL query to validate"),
}),
execute: async ({ query }) => {
Expand All @@ -135,7 +135,7 @@ export class AIQueryService {
getTableSchema: tool({
description:
"Get detailed schema information about available tables and columns. Use this to understand what data is available and how to query it.",
parameters: z.object({
inputSchema: z.object({
tableName: z
.string()
.optional()
Expand All @@ -147,7 +147,7 @@ export class AIQueryService {
}),
setTimeFilter: this.buildSetTimeFilterTool(),
},
maxSteps: 5,
stopWhen: stepCountIs(5),
experimental_telemetry: {
isEnabled: true,
metadata: {
Expand Down Expand Up @@ -191,7 +191,7 @@ export class AIQueryService {
validateTSQLQuery: tool({
description:
"Validate a TSQL query for syntax errors and schema compliance. Always use this tool to verify your query before returning it to the user.",
parameters: z.object({
inputSchema: z.object({
query: z.string().describe("The TSQL query to validate"),
}),
execute: async ({ query }) => {
Expand All @@ -201,7 +201,7 @@ export class AIQueryService {
getTableSchema: tool({
description:
"Get detailed schema information about available tables and columns. Use this to understand what data is available and how to query it.",
parameters: z.object({
inputSchema: z.object({
tableName: z
.string()
.optional()
Expand All @@ -213,7 +213,7 @@ export class AIQueryService {
}),
setTimeFilter: this.buildSetTimeFilterTool(),
},
maxSteps: 5,
stopWhen: stepCountIs(5),
experimental_telemetry: {
isEnabled: true,
metadata: {
Expand Down
6 changes: 3 additions & 3 deletions apps/webapp/app/v3/services/aiQueryTitleService.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { openai } from "@ai-sdk/openai";
import { generateText, type LanguageModelV1 } from "ai";
import { generateText, type LanguageModel } from "ai";
import { env } from "~/env.server";

/**
Expand All @@ -13,7 +13,7 @@ export type AIQueryTitleResult =
* Service for generating concise titles for SQL queries using AI
*/
export class AIQueryTitleService {
constructor(private readonly model: LanguageModelV1 = openai("gpt-4o-mini")) {}
constructor(private readonly model: LanguageModel = openai("gpt-4o-mini")) {}

/**
* Generate a concise title for a SQL query
Expand Down Expand Up @@ -45,7 +45,7 @@ Examples:
- "Average execution time by task"
- "Recent runs with errors"`,
prompt: `Generate a concise title for this SQL query:\n\n${query}`,
maxTokens: 50,
maxOutputTokens: 50,
experimental_telemetry: {
isEnabled: true,
metadata: {
Expand Down
Loading
Loading