Skip to content

AzureOpenAI 400 error #2105

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

Closed
pavelpiha opened this issue Jul 27, 2023 · 1 comment
Closed

AzureOpenAI 400 error #2105

pavelpiha opened this issue Jul 27, 2023 · 1 comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature auto:question A specific question about the codebase, product, project, or how to use a feature

Comments

@pavelpiha
Copy link

pavelpiha commented Jul 27, 2023

I have such simple code,

image

But it returns 404 Error,

     forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [Function: httpAdapter],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      'User-Agent': 'OpenAI/NodeJS/3.3.0',
      Authorization: 'Bearer 111111111',
      'api-key': '111111111',
      'Content-Length': 223
    },
    method: 'post',
    params: { 'api-version': '2023-03-15-preview' },
    data: '{"model":"text-davinci-003","temperature":0,"max_tokens":256,"top_p":1,"frequency_penalty":0,"presence_penalty":0,"n":1,"stream":false,"prompt":["What would be a good company name for a company that makes colorful socks?"]}',
    url: 'https://222222222.openai.azure.com/openai/222222222/completions'
  },


    _header: 'POST /openai/222222222/completions?api-version=2023-03-15-preview HTTP/1.1\r\n' +
      'Accept: application/json, text/plain, */*\r\n' +
      'Content-Type: application/json\r\n' +
      'User-Agent: OpenAI/NodeJS/3.3.0\r\n' +
      'Authorization: Bearer 11111111111\r\n' +
      'api-key: 11111111111\r\n' +
      'Content-Length: 223\r\n' +
      'Host: 222222222.openai.azure.com\r\n' +
      'Connection: close\r\n' +

This URL's are wrong
https://222222222.openai.azure.com/openai/222222222/completions
/openai/222222222/completions?api-version=2023-03-15-preview

Correct URL is https://222222222.openai.azure.com/openai/deployments?api-version=2023-03-15-preview

Any ideas how to fix this? Why langchain.js does not have AzureOpenAI but uses OpenAI
In python app it works fine

image

@dosubot dosubot bot added auto:bug Related to a bug, vulnerability, unexpected error with an existing feature auto:question A specific question about the codebase, product, project, or how to use a feature labels Jul 27, 2023
@jacoblee93
Copy link
Collaborator

We've clarified the Azure OpenAI docs pages with an example - hope that helps!

https://js.langchain.com/docs/modules/model_io/models/chat/integrations/azure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature auto:question A specific question about the codebase, product, project, or how to use a feature
Projects
None yet
Development

No branches or pull requests

2 participants