-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working with ChatGoogleGenerativeAI #6
Comments
@bracesproul please help me resolving this |
@his-maj-esty You can't only replace ChatOpenAI with ChatGoogleGenerativeAI. Gemini takes different inputs than Open AI API. You'll need to read the Gemini docs to figure out the syntax to send to the Gemini API. Probably start here: https://ai.google.dev/gemini-api/docs/api-overview |
@dylanmclane I think langchain handles that under the hood, by providing a unified api for all the providers |
that's what I thought |
I tried using import { ChatGoogle } from "@langchain/google-webauth"; with the configuration apiVersion: "v1beta", and I had the same error. |
You can you |
Error
I am getting error like this :
unhandledRejection: GoogleGenerativeAIError: [400 Bad Request] Invalid JSON payload received. Unknown name "default" at 'tools[0].function_declarations[1].parameters.properties[1].value.items.properties[0].value': Cannot find field.
Invalid JSON payload received. Unknown name "exclusiveMinimum" at 'tools[0].function_declarations[1].parameters.properties[1].value.items.properties[2].value': Cannot find field.
Invalid JSON payload received. Unknown name "exclusiveMinimum" at 'tools[0].function_declarations[1].parameters.properties[1].value.items.properties[3].value': Cannot find field.
Invalid JSON payload received. Unknown name "additionalProperties" at 'tools[0].function_declarations[1].parameters.properties[1].value.items': Cannot find field. [{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"tools[0].function_declarations[1].parameters.properties[1].value.items.properties[0].value","description":"Invalid JSON payload received. Unknown name "default" at 'tools[0].function_declarations[1].parameters.properties[1].value.items.properties[0].value': Cannot find field."},{"field":"tools[0].function_declarations[1].parameters.properties[1].value.items.properties[2].value","description":"Invalid JSON payload received. Unknown name "exclusiveMinimum" at 'tools[0].function_declarations[1].parameters.properties[1].value.items.properties[2].value': Cannot find field."},{"field":"tools[0].function_declarations[1].parameters.properties[1].value.items.properties[3].value","description":"Invalid JSON payload received. Unknown name "exclusiveMinimum" at 'tools[0].function_declarations[1].parameters.properties[1].value.items.properties[3].value': Cannot find field."},{"field":"tools[0].function_declarations[1].parameters.properties[1].value.items","description":"Invalid JSON payload received. Unknown name "additionalProperties" at 'tools[0].function_declarations[1].parameters.properties[1].value.items': Cannot find field."}]}]
at _makeRequestInternal (webpack-internal:///(rsc)/./node_modules/@google/generative-ai/dist/index.mjs:316:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async generateContentStream (webpack-internal:///(rsc)/./node_modules/@google/generative-ai/dist/index.mjs:700:22)
at async eval (webpack-internal:///(rsc)/./node_modules/@langchain/google-genai/dist/chat_models.js:274:32)
at async RetryOperation.eval [as _fn] (webpack-internal:///(rsc)/./node_modules/p-retry/index.js:50:12) {
attemptNumber: 7,
retriesLeft: 0
}
Steps to reproduce
replace ChatOpenAi with this in graph.tsx file :
`import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
// rest of the code
const llm = new ChatGoogleGenerativeAI({
temperature: 0,
model: "gemini-1.5-flash-latest",
streaming: true,
apiVersion: "v1beta",
}).bindTools(tools);`
The text was updated successfully, but these errors were encountered: