miurla / morphic

An AI-powered search engine with a generative UI
https://morphic.sh
Apache License 2.0
6.04k stars 1.51k forks source link

Using Google Provider has issues #192

Closed miurla closed 2 months ago

miurla commented 4 months ago

Issues

Related: #191

freedomtrain commented 4 months ago

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

miurla commented 3 months ago

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

APICallError [AI_APICallError]: Request contains an invalid argument.

ngoiyaeric commented 3 months ago

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

ngoiyaeric commented 3 months ago

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

miurla commented 2 months ago

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: https://github.com/miurla/morphic/issues/192#issuecomment-2193924534

avalynndev commented 2 months ago

The error continues for me

ngoiyaeric commented 2 months ago

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_modulesc0965b..js:2207:24 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async postToApi (/.next/server/chunks/ssr/node_modulesc0965b..js:2121:36) at async GoogleGenerativeAILanguageModel.doStream (/.next/server/chunks/ssr/node_modulesc0965b..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
miurla commented 2 months ago

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

avalynndev commented 2 months ago

So, can we expect a fix or something soon?

miurla commented 2 months ago

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

avalynndev commented 2 months ago

w bro