microsoft / sample-app-aoai-chatGPT

Sample code for a simple web chat experience through Azure OpenAI, including Azure OpenAI On Your Data.
MIT License
1.59k stars 2.49k forks source link

Error encountered while running project after sending 'Hi' message #73

Closed SyadBabarAli closed 1 year ago

SyadBabarAli commented 1 year ago

I am trying to run this project, but I encountered an error after sending the "Hi" message.

Error

HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //dummy.openai.azure.com/.openai.azure.com/openai/deployments/dummy-gpt-35-turbo/extensions/chat/completions?api-version=2023-03-15-preview (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x0000017BFF2529B0>: Failed to resolve 'https' ([Errno 11001] getaddrinfo failed)"))

I have set the following parameters in my app.py

ACS Integration Settings

AZURE_SEARCH_SERVICE = "" AZURE_SEARCH_INDEX = "" AZURE_SEARCH_KEY =""

AOAI Integration Settings

AZURE_OPENAI_RESOURCE = "" AZURE_OPENAI_MODEL = "" AZURE_OPENAI_KEY = ""

Note

My Azure Open AI chatplayground working fine with my data

pamelafox commented 1 year ago

Please check that the URL matches the URL in the studio. You can click "View code", select "curl" in the dropdown, and compare the URL there. This is what's in your error message:

//dummy.openai.azure.com/.openai.azure.com/openai/deployments/dummy-gpt-35-turbo/extensions/chat/completions?api-version=2023-03-15-preview

If the URLs are different, then your environment variables need to be adjusted.

SyadBabarAli commented 1 year ago

Thank you very much for your reply.

Before AZURE_OPENAI_RESOURCE = "https://dummyai.openai.azure.com/"

Now, I have changed it to include only my resource name without the domain "openai.azure.com".

Only this parameter in project AZURE_OPENAI_RESOURCE = "dummyai"

But new error occurs

Error Resource not found

I have reposted my parameters with dummy fields to help you better understand the problem.

ACS Integration Settings

AZURE_SEARCH_SERVICE = "dummyaicogserv" AZURE_SEARCH_INDEX = "policy-101" AZURE_SEARCH_KEY ="j3j7ijweioru8923u98jsiodfjkldummy"

AOAI Integration Settings

AZURE_OPENAI_RESOURCE = "dummyai" AZURE_OPENAI_KEY = "lksdjf98u29u09isdjfiojijsdfdummy" AZURE_OPENAI_MODEL = "dummy-gpt-35-turbo"

Note I will keep in mind that your chat completion method works fine with Python and takes the same parameters as mentioned above in AOAI Integration Settings heading.

pamelafox commented 1 year ago

Can you determine which resource triggered the "Resource not found" error? Was it openAI or ACS?

If helpful, you can enable more debug logs in the Flask app by adding this to app.py:

logging.basicConfig(level=logging.DEBUG)

Here's an example of correct config:

AZURE_OPENAI_KEY="dummy"
AZURE_OPENAI_MAX_TOKENS=1000
AZURE_OPENAI_MODEL="turbo"
AZURE_OPENAI_MODEL_NAME="gpt-35-turbo"
AZURE_OPENAI_PREVIEW_API_VERSION="2023-06-01-preview"
AZURE_OPENAI_RESOURCE="cog-7owkquzj3sveq"
AZURE_OPENAI_RESOURCE_GROUP="rg-wedspsf"
AZURE_OPENAI_SKU_NAME="S0"
AZURE_OPENAI_STOP_SEQUENCE=""
AZURE_OPENAI_STREAM="true"
AZURE_OPENAI_SYSTEM_MESSAGE="You are an AI assistant that helps people find information."
AZURE_OPENAI_TEMPERATURE=0
AZURE_OPENAI_TOP_P=1
AZURE_RESOURCE_GROUP="rg-wedspsf"
AZURE_SEARCH_CONTENT_COLUMNS="content"
AZURE_SEARCH_ENABLE_IN_DOMAIN="true"
AZURE_SEARCH_FILENAME_COLUMN="filepath"
AZURE_SEARCH_INDEX="gptkbindex"
AZURE_SEARCH_KEY="dummy"
AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG="default"
AZURE_SEARCH_SERVICE="gptkb-7owkquzj3sveq"
AZURE_SEARCH_SERVICE_RESOURCE_GROUP="rg-wedspsf"
AZURE_SEARCH_SKU_NAME="standard"
AZURE_SEARCH_TITLE_COLUMN="title"
AZURE_SEARCH_TOP_K=5
AZURE_SEARCH_URL_COLUMN="url"
AZURE_SEARCH_USE_SEMANTIC_SEARCH="false"
AZURE_STORAGE_ACCOUNT="st7owkquzj3sveq"
AZURE_STORAGE_CONTAINER="content"
AZURE_STORAGE_RESOURCE_GROUP="rg-wedspsf"

However, I do not set my config manually, I run azd up, and it sets everything for me. Instructions for deploying via azd are here:

https://github.com/microsoft/sample-app-aoai-chatGPT/blob/main/README_azd.md

SyadBabarAli commented 1 year ago

When the project start I noticed one error was already there "No identity provider found. Access to chat will be blocked" but when i bypass this Still I show this message "Resouce not found" on web page.

Here are two methods for running the project to enhance understanding: 1-I am using Visual Studio Code to run this project. 2-Run start.cmd file to run project

Thank you once again for your dedication in resolving my project issue.

SyadBabarAli commented 1 year ago

Thank you so much for your prompt and helpful response! @pamelafox

I encountered two issues that I was facing:

1.When running the code with "Visual Studio Code," I noticed that any changes I made in app.py were not taking effect.

2.In app.py, my resources were defined with a domain name.

Thank you once again for your help!

Now, I would like to create a fine-tuned model for my chatbot using the "chat-gpt-35-turbo" model. Furthermore, I am interested in deploying this project on my own server.

Note: I'm pleased to inform you that my previous issue has been resolved.

pamelafox commented 1 year ago

Ah, it looks like I didn't update start.cmd to have auto-reloading.

Please try changing the Python line to:

call python -m flask run --port=5000 --host=127.0.0.1 --reload --debug

The --reload argument should cause auto-reloading when app.py is changed. It won't auto-reload for frontend changes though.

Is #2 an issue? I don't see the question there ("my resources were defined with a domain name").

sarah-widder commented 1 year ago

Hi @SyadBabarAli as it looks like your issue has been resolved I will close this thread. For more information on fine tuning, please see the documentation: https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/fine-tuning?pivots=programming-language-studio. Let us know if you run into any other issues.

Shubhamj5 commented 7 months ago

Can you determine which resource triggered the "Resource not found" error? Was it openAI or ACS?

If helpful, you can enable more debug logs in the Flask app by adding this to app.py:

logging.basicConfig(level=logging.DEBUG)

Here's an example of correct config:

AZURE_OPENAI_KEY="dummy"
AZURE_OPENAI_MAX_TOKENS=1000
AZURE_OPENAI_MODEL="turbo"
AZURE_OPENAI_MODEL_NAME="gpt-35-turbo"
AZURE_OPENAI_PREVIEW_API_VERSION="2023-06-01-preview"
AZURE_OPENAI_RESOURCE="cog-7owkquzj3sveq"
AZURE_OPENAI_RESOURCE_GROUP="rg-wedspsf"
AZURE_OPENAI_SKU_NAME="S0"
AZURE_OPENAI_STOP_SEQUENCE=""
AZURE_OPENAI_STREAM="true"
AZURE_OPENAI_SYSTEM_MESSAGE="You are an AI assistant that helps people find information."
AZURE_OPENAI_TEMPERATURE=0
AZURE_OPENAI_TOP_P=1
AZURE_RESOURCE_GROUP="rg-wedspsf"
AZURE_SEARCH_CONTENT_COLUMNS="content"
AZURE_SEARCH_ENABLE_IN_DOMAIN="true"
AZURE_SEARCH_FILENAME_COLUMN="filepath"
AZURE_SEARCH_INDEX="gptkbindex"
AZURE_SEARCH_KEY="dummy"
AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG="default"
AZURE_SEARCH_SERVICE="gptkb-7owkquzj3sveq"
AZURE_SEARCH_SERVICE_RESOURCE_GROUP="rg-wedspsf"
AZURE_SEARCH_SKU_NAME="standard"
AZURE_SEARCH_TITLE_COLUMN="title"
AZURE_SEARCH_TOP_K=5
AZURE_SEARCH_URL_COLUMN="url"
AZURE_SEARCH_USE_SEMANTIC_SEARCH="false"
AZURE_STORAGE_ACCOUNT="st7owkquzj3sveq"
AZURE_STORAGE_CONTAINER="content"
AZURE_STORAGE_RESOURCE_GROUP="rg-wedspsf"

However, I do not set my config manually, I run azd up, and it sets everything for me. Instructions for deploying via azd are here:

https://github.com/microsoft/sample-app-aoai-chatGPT/blob/main/README_azd.md

Hey could you also provide correct Config format for COSMOS DB? Thanks