miurla / morphic

An AI-powered search engine with a generative UI

Home Page:https://morphic.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using Google Provider has issues

miurla opened this issue · comments

Issues

  • May fail on the first API call
  • Tool Calling
    • Even if tool_choices is set to 'required', there are cases where the tool is not used
      • gemini-1.5-pro
        • Does not use the search tool after the second time
      • gemini-1.5-flash
        • Does not use from the first time

Related: #191

it is now possible to support https://mistral.ai/

In the current AI SDK version(3.2.1), an error occurs in the Researcher.

APICallError [AI_APICallError]: Request contains an invalid argument.

commented

by default morphic uses openai even when the Gemini Keys are provided and gpt4o are not. This causes unhandledRejection: APICallError [AI_APICallError]:

commented

How do I force morphic to use gemini so I can further debug this issue?

When I updated the AI SDK, errors started occurring, so it should work if you check out version 0.2.15: https://github.com/miurla/morphic/releases/tag/v0.2.15

ref: #192 (comment)

The error continues for me

commented

Downgrading the sdk doesn't make any sense unless its to debug. Currently Gemini-1.5-latest works for the inquiry agent & Generative UI for ai-sdk 3.3.6 but throws the error when tool calling after inquiry agent.
Here is the indepth error after inquiry agent has processed the query with Gemini 1.5

⨯ unhandledRejection: APICallError [AI_APICallError]: Invalid JSON payload received. Unknown name "default" at 'tools.function_declarations[0].parameters.properties[2].value': Cannot find field.
at /.next/server/chunks/ssr/node_modules_c0965b..js:2207:24
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async postToApi (/.next/server/chunks/ssr/node_modules_c0965b.
.js:2121:36)
at async GoogleGenerativeAILanguageModel.doStream (/.next/server/chunks/ssr/node_modules_c0965b..js:3766:54)
at async retryWithExponentialBackoff (/.next/server/chunks/ssr/9c4c19..js:381:16)
at async streamText (/.next/server/chunks/ssr/9c4c19..js:1461:47)
at async researcher (/.next/server/chunks/ssr/[root of the server]__1706c0.
.js:1930:20)
at async processEvents (/.next/server/chunks/ssr/[root of the server]__1706c0.
.js:2313:63) {
url: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-latest:streamGenerateContent?alt=sse',
requestBodyValues: {
generationConfig: {
topK: undefined,
maxOutputTokens: 2500,
temperature: 0,
topP: undefined
},
contents: [
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object], [Object],
[Object]
],
tools: { functionDeclarations: [Array] }
},
statusCode: 400,
responseHeaders: {
'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
'content-length': '655',
'content-type': 'text/event-stream',
date: 'Thu, 11 Jul 2024 07:06:08 GMT',
server: 'scaffolding on HTTPServer2',
'server-timing': 'gfet4t7; dur=347',
vary: 'Origin, X-Origin, Referer',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-xss-protection': '0'
},
responseBody: '{\n' +
' "error": {\n' +
' "code": 400,\n' +
"message": "Invalid JSON payload received. Unknown name \\"default\\" at 'tools.function_declarations[0].parameters.properties[2].value': Cannot find field.",\n +
' "status": "INVALID_ARGUMENT",\n' +
' "details": [\n' +
' {\n' +
' "@type": "type.googleapis.com/google.rpc.BadRequest",\n' +
' "fieldViolations": [\n' +
' {\n' +
' "field": "tools.function_declarations[0].parameters.properties[2].value",\n' +
"description": "Invalid JSON payload received. Unknown name \\"default\\" at 'tools.function_declarations[0].parameters.properties[2].value': Cannot find field."\n +
' }\n' +
' ]\n' +
' }\n' +
' ]\n' +
' }\n' +
'}\n',
cause: undefined,
isRetryable: false,
data: {
error: {
code: 400,
message: Invalid JSON payload received. Unknown name "default" at 'tools.function_declarations[0].parameters.properties[2].value': Cannot find field.,
status: 'INVALID_ARGUMENT'
}
}
}

Here is the bug from the release you are referring before ai-sdk update.
Screen Shot 2024-07-11 at 10 34 27 AM

OK, confirmed. Even with the supported morphic version(v0.2.11) , errors occur, so it probably won't work unless fundamentally fixed.

So, can we expect a fix or something soon?

Resolved this error in PR #254
FYI: @avalynndev @ngoiyaeric

w bro