diff --git a/packages/llms/src/OpenAIClient.ts b/packages/llms/src/OpenAIClient.ts index be6f3af..9fe44b9 100644 --- a/packages/llms/src/OpenAIClient.ts +++ b/packages/llms/src/OpenAIClient.ts @@ -145,7 +145,7 @@ export class OpenAIClient implements LLMClient { const argString = normalizedChoice.message?.tool_calls?.[0]?.function?.arguments if (!argString) { throw new InvokeError( - InvokeErrorType.NO_TOOL_CALL, + InvokeErrorType.INVALID_TOOL_ARGS, 'No tool call arguments found', normalizedData ) diff --git a/packages/page-agent/src/utils/autoFixer.ts b/packages/page-agent/src/utils/autoFixer.ts index e9bf91a..698b36f 100644 --- a/packages/page-agent/src/utils/autoFixer.ts +++ b/packages/page-agent/src/utils/autoFixer.ts @@ -120,9 +120,9 @@ function safeJsonParse(input: any): any { } /** - * Retrieve the JSON part from a string. - * - treat content between the first `{` and the last `}` as JSON. - * - try to parse as JSON, return the parsed result if successful, otherwise return null. + * Extract and parse JSON from a string. + * - Treat content between the first `{` and the last `}` as JSON. + * - Try to parse that content as JSON and return the parsed value (object/array/primitive) if successful, otherwise return null. */ function retrieveJsonFromString(str: string): any { try {