How to get non empty values in citations when I make an Azure OpenAI call with Azure Search?

Laurie CANTALOUBE 6 Reputation points
2024-05-29T09:47:28.58+00:00

Hello,

I need to retrieve the citations when I make an Azure OpenAI call with Azure Search. For now, in the response, I have null values everywhere except for the content...Null citatations

The code I use for the call is the next one (same as https://learn.microsoft.com/en-us/azure/ai-services/openai/use-your-data-quickstart?tabs=command-line%2Cpython-new&pivots=programming-language-python):

completion = client.chat.completions.create(
    model=deployment,
    messages=messages,
        extra_body={
            "data_sources":[
                {
                    "type": "azure_search",
                    "parameters": {
                        "endpoint": ai_search_endpoint,
                        "index_name": ai_search_index_name,
                        "authentication": {
                            "type": "api_key",
                            "key": ai_search_api_key,
                        }
                    }
                }
            ],
        }
    )

The thing I don't understand is that when I query my index directly in Azure search I have the information I'm looking for but not in the response call...

Azure Search query

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
813 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,500 questions
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 43,541 Reputation points Microsoft Employee
    2024-05-29T11:07:14.11+00:00

    @Laurie CANTALOUBE Did you map the fields for title, filename and URL in your BYOD configuration when the index was configured? Please see this page on how these fields are used in the response.

    Mapping these fields correctly helps ensure the model has better response and citation quality.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.
    0 comments No comments