To update a Custom Question Answering source in Azure without duplicating, use 'replace' for existing sources and 'add' for new ones. However, 'replace' might not refresh file sources like it does for URLs. As a workaround, manually delete and re-add the file source, but back up any external metadata or custom questions first. Microsoft may enhance this feature, so consider providing feedback. For handling project updates, refer to Azure's documentation on managing question answering projects
Update Custom Question Answering File of Knowledge Base via API
Hi there,
I am using the Azure SDK for python to update the Custom Question Answering pair sources from an Azure Blob.
For Example: If the source is already existed in Language, I would paas the 'replace' operation so that it will not duplicate the question answer pair. If the source is new , I would paas the 'add' operation.
Unfortunately with the 'replace' operation, it does not refresh the source, even if have the parameter set as refresh:True. Due to this Question answer pair remains same in the Language studio. Replace operation is not really helping!
Looks like refresh boolean is only supported today with SourceKind "url". But I want to use File instead.
Is there a best way to update the question answerpair when the source is replaced with the same name? I know i can delete and recreate the source but this will loose all the metdata and additional custom questions that may have added outside of the source!
op = "replace" if blob.name in existing_source_names else "add"
update_sources_poller = client.begin_update_sources(
project_name=project_name,
sources=[
{
"op": op,
"value": {
"displayName": blob.name,
"source": blob.name,
"sourceUri": source_uri,
"sourceKind": "file",
"refresh": True
}
}
]
)