Closed dhaksr closed 1 month ago
Can you please try following the steps here? https://github.com/Azure/azure-sdk-for-python/issues/20883
If this doesn't work - please open an issue on the azure-sdk-for-python repository.
Can you please try following the steps here? Azure/azure-sdk-for-python#20883
If this does work - please open an issue on the azure-sdk-for-python repository.
Thanks Matt. This does fix the problem. I dont understand the second part as to why I should open issue in the azure sdk repo. Can you please give more details.
Can you please try following the steps here? Azure/azure-sdk-for-python#20883 If this does work - please open an issue on the azure-sdk-for-python repository.
Thanks Matt. This does fix the problem. I dont understand the second part as to why I should open issue in the azure sdk repo. Can you please give more details.
sorry typo - "doesn't". Fixed
I am trying to use the examples provided on corporate provided laptop and I think the error is happening because the certificate is not downloadable in the laptop. Is there any workaround or alternate available? The issue happens at both office network and in personal network. However it doesnt happen in personal laptop (without doing any additional steps). So I request anyway to bypass the SSL request.
Environment used - Visual Studio Code/ Windows 10 Pro/ venv
The error I am getting is:
` File "c:\00WorkFiles\AzureOpenSearch.venv\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 600, in _run_script exec(code, module.dict) File "C:\00WorkFiles\AzureOpenSearch\azure-try3.py", line 195, in
main()
File "C:\00WorkFiles\AzureOpenSearch\azure-try3.py", line 189, in main
response, citation = perform_search(query) File "C:\00WorkFiles\AzureOpenSearch\azure-try3.py", line 152, in perform_search for result in results: File "c:\00WorkFiles\AzureOpenSearch.venv\lib\site-packages\azure\search\documents_paging.py", line 54, in next return next(self._page_iterator)
.... error azure.core.exceptions.ServiceRequestError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997) `
The code in question is attached..
`import os import streamlit as st from azure.storage.blob import BlobServiceClient from azure.search.documents.indexes import SearchIndexerClient from azure.search.documents.indexes.models import ( SearchIndexerDataContainer, SearchIndexerDataSourceConnection, SplitSkill, InputFieldMappingEntry, OutputFieldMappingEntry, AzureOpenAIEmbeddingSkill, SearchIndexerIndexProjections, SearchIndexerIndexProjectionSelector, SearchIndexerIndexProjectionsParameters, IndexProjectionMode, SearchIndexerSkillset, SearchIndexer, FieldMapping ) from azure.search.documents import SearchClient from azure.search.documents.models import VectorizableTextQuery, QueryType, QueryCaptionType, QueryAnswerType from openai import AzureOpenAI from azure.core.credentials import AzureKeyCredential from azure.core.exceptions import ResourceExistsError
import ssl ssl._create_default_https_context = ssl._create_unverified_context
Azure configuration
endpoint = os.environ["AZURE_SEARCH_SERVICE_ENDPOINT"] credential = os.environ["AZURE_SEARCH_ADMIN_KEY"] index_name = os.environ["AZURE_SEARCH_INDEX"] blob_connection_string = os.environ["BLOB_CONNECTION_STRING"] blob_container_name = os.environ["BLOB_CONTAINER_NAME"] azure_openai_endpoint = os.environ["AZURE_OPENAI_ENDPOINT"] azure_openai_key = os.environ["AZURE_OPENAI_KEY"] azure_openai_embedding_deployment = os.environ["AZURE_OPENAI_EMBEDDING_DEPLOYMENT"] azure_openai_chatgpt_deployment = os.environ["AZURE_OPENAI_CHATGPT_DEPLOYMENT"]
Set up Azure OpenAI client
openai_client = AzureOpenAI( api_key=azure_openai_key, api_version="2023-03-15-preview", azure_endpoint=azure_openai_endpoint )
def upload_to_azure(file):
Connect to Blob Storage
def perform_search(query): search_client = SearchClient(endpoint, index_name, AzureKeyCredential(credential)) vector_query = VectorizableTextQuery(text=query, k_nearest_neighbors=1, fields="vector", exhaustive=True)
def main(): st.title("RAG Chatbot")
if name == "main": main()`