MSUSAzureAccelerators / Azure-Cognitive-Search-Azure-OpenAI-Accelerator

Virtual Assistant - GPT Smart Search Engine - Bot Framework + Azure OpenAI + Azure AI Search + Azure SQL + Bing API + Azure Document Intelligence + LangChain + CosmosDB
https://gptsmartsearchapp.azurewebsites.net
MIT License
336 stars 555 forks source link

03-Quering-AOpenAI.ipynb cell 6: Code fails if there are no answers #50

Closed vykhand closed 7 months ago

vykhand commented 10 months ago

Needs to be changed to

display(HTML('<h4>Top Answers</h4>'))

for index,search_results in agg_search_results.items():
    if '@search_answers' in search_results:
        for result in search_results['@search.answers']:
            if result['score'] > 0.5: # Show answers that are at least 50% of the max possible score=1
                display(HTML('<h5>' + 'Answer - score: ' + str(round(result['score'],2)) + '</h5>'))
                display(HTML(result['text']))
pablomarin commented 8 months ago

this should be fixed now