-
Checked other resources
Commit to Help
Example Codesee description DescriptionI'm using the But when I build an agent via **Error: 400 400: Invalid JSON payload received. Unknown name "$schema" at 'tools[0].function_declarations[0].parameters': Cannot find field.**
at Function.generate (.pnpm/openai@4.98.0_zod@3.25.62/node_modules/openai/src/error.ts:72:14)
at AzureOpenAI.makeStatusError (.pnpm/openai@4.98.0_zod@3.25.62/node_modules/openai/src/core.ts:462:21)
at AzureOpenAI.makeRequest (pnpm/openai@4.98.0_zod@3.25.62/node_modules/openai/src/core.ts:526:24)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async .pnpm/@langchain+openai@0.5.12_@langchain+core@0.3.57/node_modules/@langchain/openai/dist/chat_models.cjs:2337:29
at async RetryOperation._fn (.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js:50:12) I am not sure if this way can be work for my scene, so finding some help.(Tried to search a lot of issues and information, no valid items.) System Info"@langchain/core": "^0.3.57", |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
AzureChatOpenAI is specifically built for Azure's OpenAI-compatible endpoints and expects payloads and tool/function schemas that match the OpenAI API. Gemini models (like If you need Gemini support in LangChain, you should use the dedicated integration for Gemini models, such as If you have to use a custom endpoint or provider, you may need to subclass Let me know if you want pointers on building a custom integration or have more details about your provider's API! To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
AzureChatOpenAI is specifically built for Azure's OpenAI-compatible endpoints and expects payloads and tool/function schemas that match the OpenAI API. Gemini models (like
ggemini-2.5-pro-preview-06-05
) use a different API and schema, so AzureChatOpenAI can't connect to Gemini models directly—this is why you're seeing the JSON payload error about unknown fields like$schema
in function declarations. The error is due to a mismatch between the expected OpenAI/Azure schema and Gemini's schema requirements, not a bug in your code or configuration reference.If you need Gemini support in LangChain, you should use the dedicated integration for Gemini models, such as
ChatGoogleGenerativeAI
from…