diff --git a/apps/rowboat/app/lib/utils.ts b/apps/rowboat/app/lib/utils.ts index 3fe752e6..8d199b56 100644 --- a/apps/rowboat/app/lib/utils.ts +++ b/apps/rowboat/app/lib/utils.ts @@ -1,8 +1,3 @@ -import { z } from "zod"; -import { generateObject } from "ai"; -import { openai } from "@ai-sdk/openai"; -import { Message } from "./types/types"; - // create a PrefixLogger class that wraps console.log with a prefix // and allows chaining with a parent logger export class PrefixLogger { @@ -28,51 +23,4 @@ export class PrefixLogger { child(childPrefix: string): PrefixLogger { return new PrefixLogger(childPrefix, this); } -} - -export async function mockToolResponse(toolId: string, messages: z.infer[], mockInstructions: string): Promise { - const prompt = `Given below is a chat between a user and a customer support assistant. -The assistant has requested a tool call with ID {{toolID}}. - -Your job is to come up with the data that the tool call should return. - -In order to help you mock the responses, the user has provided some contextual information, -and also some instructions on how to mock the tool call. - ->>>CHAT_HISTORY -{{messages}} -<<>>MOCK_INSTRUCTIONS -{{mockInstructions}} -<< { - let tool_calls; - if ('tool_calls' in m && m.role == 'assistant') { - tool_calls = m.tool_calls; - } - let { role, content } = m; - return { - role, - content, - tool_calls, - } - }))); - // console.log(prompt); - - const { object } = await generateObject({ - model: openai("gpt-4o"), - prompt: prompt, - schema: z.object({ - result: z.any(), - }), - }); - - return JSON.stringify(object); } \ No newline at end of file