microsoft / teams-ai

SDK focused on building AI based applications and extensions for Microsoft Teams and other Bot Framework channels
MIT License
349 stars 143 forks source link

[Bug]: BadSyntax, Error while parsing citation entity with id: 1 using Azure AI Search and Azure OpenAI #1714

Closed therealjohn closed 3 weeks ago

therealjohn commented 3 weeks ago

Language

Javascript/Typescript

Version

latest

Description

Using an Azure AI Search data source with Azure OpenAI can cause an error whenever a citation is passed through if there is not title on the citation. This can happen if the AI Search index doesn't have a title field. i.e. using an existing index and not the Studio to create one.

image

This results in the name property of the citation in the activity message to be null which causes the error. To workaround this, I can override the PredicatedSayCommand and re-implement the citation logic with a small change to avoid null:

image

Reproduction Steps

1. Create an AI Search index using a file container (and by default it will only create a Content field, no Title). 
2. Connect this in your config.json
3. Ask the bot a question that would generate a citation