By code, how to include AI Search results based on files data for citations using CompletionClient complete call ?
Hi,
Starting from the basic example provided in Azure AI SDK (https://learn.microsoft.com/en-us/azure/ai-studio/quickstarts/get-started-code?tabs=windows) based on the OpenAI gpt model I trained using files as datasources in AI Foundry, I wanted to do something similar to the Playground Chat application.
So in the complete() call I added: model_extras to:
return chat.complete(
model="gpt-4o-mini",
messages=system_message + messages,
temperature=1,
frequency_penalty=0.5,
presence_penalty=0.5,
model_extras=model_extras,
)
with models_extras defining my index in AI Search created by AI Foundry:
{
"data_sources": [
{
"type": "azure_search",
"parameters": {
"top_n_documents": 5,
"strictness": 3,
"in_scope": true,
"index_name": "my_index",
"semantic_configuration": "azureml-default",
"query_type": "vector_simple_hybrid",
"endpoint": "https://myaisearch.search.windows.net",
"authentication": {
"type": "api_key",
"key": "sonmekey"
},
"embedding_dependency": {
"type": "deployment_name",
"deployment_name": "text-embedding-ada-000"
},
"fields_mapping": {
"content_fields": [
"content"
],
"title_field": "title",
"url_field": "url",
"filepath_field": "filepath",
"vector_fields": [
"contentVector"
]
}
}
}
]
}
but the complete calls fails with:
azure.core.exceptions.ResourceNotFoundError: Operation returned an invalid status 'Not Found'
Content: <html><title>404: Not Found</title><body>404: Not Found</body></html>
The webapp example tool seems to use the REST API directly and an extra_body field. Is model_extra different from extra_body ?
Or better, is there a python example on our to retrieve the AI Search results as citations using the complete() call ?
Thanks !