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

Cannot use Azure OpenAI service #163

Closed
adiazcan opened this issue May 28, 2023 · 8 comments
Closed

Cannot use Azure OpenAI service #163

adiazcan opened this issue May 28, 2023 · 8 comments
Labels
bug Something isn't working dev support Dev support tracking

Comments

@adiazcan
Copy link

I tried to use Azure OpenAI with the new @microsoft/teams-ai, version 0.1.0-preview.2, and I had the following error on the completion request:

[onTurnError] unhandled error: AxiosError: Request failed with status code 401

To reproduce the problem, I change the OpenAIPlanner for the following AzureOpenAIPlanner:

const planner = new AzureOpenAIPlanner({
  apiKey: config.openAIKey,
  defaultModel: 'gpt-35-turbo',
  logRequests: true,
  endpoint: config.openAIEndpoint,
  apiVersion: '2023-03-15-preview'
});

Debugging the problem, the code requested the OpenAI endpoint not the Azure endpoint.

image

Maybe I missed a param to configure the planner to use Azure or the Azure Planner is not correctly configured to use the Azure OpenAI client.

@adiazcan adiazcan added the bug Something isn't working label May 28, 2023
@adiazcan adiazcan changed the title [Bug]: <insert title here> Cannot user Azure OpenAI service May 28, 2023
@adiazcan adiazcan changed the title Cannot user Azure OpenAI service Cannot use Azure OpenAI service May 28, 2023
@Stevenic
Copy link
Contributor

@adiazcan the value your passing for config.openAIEndpoint is the endpoint from your Azure deployment? I can try to reproduce this today...

@adiazcan
Copy link
Author

adiazcan commented Jun 1, 2023

Hello @Stevenic

I pass the Azure endpoint from my service like https://****.openai.azure.com/

@corinagum
Copy link
Collaborator

corinagum commented Jun 1, 2023

Hey @adiazcan, could you confirm:

  1. The correct model for your Azure OpenAI subscription? Your code says 'gpt-35-turbo' but the model we use internally is a different one -- this is the first thing that stands out to me. I know Azure OpenAI has a few options for the model.
  2. No references to '@microsoft/botbuilder-m365' in any code, including package-lock and yarn.lock? It may be a good idea to do a fresh install just in case.
  3. Could you verify the api version is correct for your endpoint, and/or delete apiVersion from your settings to see if that makes a difference?

I have verified the internal AOAI endpoint/password works, so we may need to dig a little more to find the root problem in this scenario.

@adiazcan
Copy link
Author

adiazcan commented Jun 5, 2023

Hello @corinagum

Trying to answer your questions and reviewing the code I found that the OpenAIModerator object also need the endpoint parameter.

I'm going to create a PR on the documentation to put this param at the tutorial I'm following.
https://learn.microsoft.com/en-us/microsoftteams/platform/sbs-botbuilder-conversation-ai?tabs=vscode%2Cviscode&tutorial-step=3

Thanks!

@corinagum
Copy link
Collaborator

oh, nice catch. Your PR would be much appreciated! I'll close this issue as resolved. :)

@tsubakimoto
Copy link

tsubakimoto commented Jun 11, 2023

Hi @adiazcan

Based on your comment, I also tried to make TeamsChefBot compatible with Azure OpenAI Service, but it does not work.

 [onTurnError] unhandled error: AxiosError: Request failed with status code 404

I have made the following changes to this file.
js/samples/04.ai.a.teamsChefBot/src/index.ts

// https://xxx.openai.azure.com is dummy

const planner = new AzureOpenAIPlanner({
    apiKey: process.env.OPENAI_API_KEY,
    defaultModel: 'text-davinci-003',
    logRequests: true,
    endpoint: 'https://xxx.openai.azure.com',
    apiVersion: '2023-05-15'
});
const moderator = new OpenAIModerator({
    apiKey: process.env.OPENAI_API_KEY,
    moderate: 'both',
    endpoint: 'https://xxx.openai.azure.com'
});

What other responses have you made?
Thanks for your support.

@corinagum
Copy link
Collaborator

corinagum commented Jun 12, 2023

@tsubakimoto currently moderation is not fully implemented in AOAI and is in development. For me, not including moderation worked. Could you give that a try?

@tsubakimoto
Copy link

@corinagum Thank you for your support.
By commenting out moderator I was able to use AOAI.

@corinagum corinagum added the dev support Dev support tracking label Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dev support Dev support tracking
Projects
None yet
Development

No branches or pull requests

4 participants