@Nuno Rodrigues It seems you’re trying to integrate sorting functionality into the chat completions create command with an Azure Search Index as a data source. Currently, the Azure OpenAI API does not support the orderby
parameter directly in the chat completions create command. This is a common feature in Azure AI Search where you can specify the orderby
clause to sort the results based on specific fields in your index.
However, if the API does not recognize the orderby
field, it suggests that this functionality might not be exposed through the chat completions API. This could be by design, as the chat completions are likely intended to provide responses based on relevance to the input query rather than a sorted order.
To achieve the desired sorting, you might need to perform a two-step process:
Use the Azure Cognitive Search client directly to query your index with the orderby
clause and retrieve the sorted results.
Pass these results to the chat completion API to generate the completion based on the sorted data.
This approach allows you to maintain the sorting control with Azure Cognitive Search and still leverage the conversational capabilities of the chat completions.