Skip to content
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

AzureChatOpenAI BadRequestError: 400 Missing required parameter #405

Open
jamesdam opened this issue Aug 28, 2024 · 0 comments
Open

AzureChatOpenAI BadRequestError: 400 Missing required parameter #405

jamesdam opened this issue Aug 28, 2024 · 0 comments

Comments

@jamesdam
Copy link

I am trying out the example from README, except that I use AzureChatOpenAI instead of ChatAnthropic

Here is how I init the model

const model = new AzureChatOpenAI({
  model: "gpt-4o-mini",
  temperature: 0,
  maxRetries: 2,
  azureOpenAIApiKey: process.env.AZURE_OPENAI_API_KEY, // In Node.js defaults to process.env.AZURE_OPENAI_API_KEY
  azureOpenAIApiInstanceName: process.env.AZURE_OPENAI_API_INSTANCE_NAME, // In Node.js defaults to process.env.AZURE_OPENAI_API_INSTANCE_NAME
  azureOpenAIApiDeploymentName: process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME, // In Node.js defaults to process.env.AZURE_OPENAI_API_DEPLOYMENT_NAME
  azureOpenAIApiVersion: process.env.AZURE_OPENAI_API_VERSION, // In Node.js defaults to process.env.AZURE_OPENAI_API_VERSION
});

The first app.invoke call works fine, but the second one throws error.

BadRequestError: 400 Missing required parameter: 'messages[1].function_call.name'.
    at APIError.generate ([xxx]/notebooks/node_modules/openai/error.js:45:20)
    at AzureOpenAI.makeStatusError ([xxx]/notebooks/node_modules/openai/core.js:275:33)
    at AzureOpenAI.makeRequest ([xxx]/notebooks/node_modules/openai/core.js:318:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async [xxx]/notebooks/node_modules/@langchain/openai/dist/chat_models.cjs:1351:29
    at async RetryOperation._fn ([xxx]/notebooks/node_modules/p-retry/index.js:50:12) {
  status: 400,
  headers: {
    'apim-request-id': '0b0db2bf-e4f1-4b9a-8544-bf120a0e9f5d',
    'azureml-model-session': 'd005-20240823162121',
    'content-length': '225',
    'content-type': 'application/json',
    date: 'Wed, 28 Aug 2024 02:09:37 GMT',
    'ms-azureml-model-error-reason': 'model_error',
    'ms-azureml-model-error-statuscode': '400',
    'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
    'x-content-type-options': 'nosniff',
    'x-envoy-upstream-service-time': '15',
    'x-ms-client-request-id': '0b0db2bf-e4f1-4b9a-8544-bf120a0e9f5d',
    'x-ms-rai-invoked': 'true',
    'x-ms-region': 'East US',
    'x-ratelimit-remaining-requests': '9987',
    'x-ratelimit-remaining-tokens': '997041',
    'x-request-id': '538835ed-eb05-42fe-a0fb-2a9e4bfc5a64'
  },
  request_id: '538835ed-eb05-42fe-a0fb-2a9e4bfc5a64',
  error: {
    message: "Missing required parameter: 'messages[1].function_call.name'.",
    type: 'invalid_request_error',
    param: 'messages[1].function_call.name',
    code: 'missing_required_parameter'
  },
  code: 'missing_required_parameter',
  param: 'messages[1].function_call.name',
  type: 'invalid_request_error',
  attemptNumber: 1,
  retriesLeft: 2,
  pregelTaskId: '44d3da58-e21d-550c-b539-de1e4ee50fcf'
}

My package.json dependencies:

"@langchain/langgraph": "^0.1.4",
"@langchain/openai": "^0.2.8",
"langchain": "^0.2.17",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant