Skip to content

Commit fd2abbd

Browse files
committed
fix schema issue
1 parent 586c79d commit fd2abbd

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

apps/web/client/src/app/api/chat/helperts/stream.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import type { ToolCall } from '@ai-sdk/provider-utils';
12
import { ASK_TOOL_SET, BUILD_TOOL_SET, getAskModeSystemPrompt, getCreatePageSystemPrompt, getSystemPrompt, initModel } from '@onlook/ai';
23
import { ChatType, LLMProvider, OPENROUTER_MODELS, type ModelConfig } from '@onlook/models';
34
import { generateObject, NoSuchToolError, type ToolSet } from 'ai';
4-
import type { ToolCall } from '@ai-sdk/provider-utils';
55

66
export async function getModelFromType(chatType: ChatType) {
77
let model: ModelConfig;
@@ -66,7 +66,7 @@ export const repairToolCall = async ({ toolCall, tools, error }: { toolCall: Too
6666

6767
const { model } = await initModel({
6868
provider: LLMProvider.OPENROUTER,
69-
model: OPENROUTER_MODELS.CLAUDE_4_SONNET,
69+
model: OPENROUTER_MODELS.OPEN_AI_GPT_5_NANO,
7070
});
7171

7272
const { object: repairedArgs } = await generateObject({
@@ -78,7 +78,7 @@ export const repairToolCall = async ({ toolCall, tools, error }: { toolCall: Too
7878
JSON.stringify(toolCall.input),
7979
`The tool accepts the following schema:`,
8080
JSON.stringify(tool?.inputSchema),
81-
'Please fix the arguments.',
81+
'Please fix the inputs. Return the fixed inputs as a JSON object, DO NOT include any other text.',
8282
].join('\n'),
8383
});
8484

apps/web/client/src/server/api/routers/chat/suggestion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const suggestionsRouter = createTRPCRouter({
2121
.mutation(async ({ ctx, input }) => {
2222
const { model, headers } = await initModel({
2323
provider: LLMProvider.OPENROUTER,
24-
model: OPENROUTER_MODELS.CLAUDE_4_SONNET,
24+
model: OPENROUTER_MODELS.OPEN_AI_GPT_5_MINI,
2525
});
2626
const { object } = await generateObject({
2727
model,
@@ -38,7 +38,7 @@ export const suggestionsRouter = createTRPCRouter({
3838
})),
3939
{
4040
role: 'user',
41-
content: 'Based on our conversation, what should I work on next to improve this page? Provide 3 specific, actionable suggestions.',
41+
content: 'Based on our conversation, what should I work on next to improve this page? Provide 3 specific, actionable suggestions. These should be realistic and achievable. Return the suggestions as a JSON object. DO NOT include any other text.',
4242
},
4343
],
4444
maxOutputTokens: 10000,

packages/models/src/llm/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ export enum ANTHROPIC_MODELS {
1212

1313
export enum OPENROUTER_MODELS {
1414
CLAUDE_4_SONNET = 'anthropic/claude-sonnet-4',
15-
OPEN_AI_GPT_5_NANO = 'openai/gpt-5-nano',
1615
OPEN_AI_GPT_5 = 'openai/gpt-5',
16+
OPEN_AI_GPT_5_MINI = 'openai/gpt-5-mini',
17+
OPEN_AI_GPT_5_NANO = 'openai/gpt-5-nano',
1718
}
1819

1920
interface ModelMapping {

0 commit comments

Comments
 (0)