Open MikeAlhayek opened 5 months ago
@bleroy can you please confirm that StringCollection
should be searchable just like String
type would in Azure Search AI? I am just trying to determine if this is a limitation in the Azure Search AI or an issue or limitation in chat completion on your own data?
When I search for a string using "Search explorer" UI on Azure, I am able to see results. So I am guessing this isn't a limitation on Azure Search AI.
@MikeAlhayek not sure why you're tagging me. I think so, but that's not my area of expertise.
Sorry! I thought you had an answer to the Azure Search AI portion.
I work on the indexer. You'll want to ask someone on the search engine side of the team. As far as I can tell from the documentation, collections of strings are supported: https://learn.microsoft.com/en-us/rest/api/searchservice/supported-data-types
Thank you for your feedback. Tagging and routing to the team member best able to assist.
@MikeAlhayek - Azure AI Search supports both string and collection of strings, both of which are searchable. Check out an example here, where HotelName
is a string field and Tags
is a collection of strings, both marked as searchable.
Refer to the docs here for more details:
"searchable": true (default where applicable) | false (only Edm.String and Collection(Edm.String) fields can be searchable).
Are you possibly missing FieldMappingOptions in the provided code snippet? Consider the following:
AzureExtensionsOptions = new AzureChatExtensionsOptions()
{
Extensions =
{
new AzureCognitiveSearchChatExtensionConfiguration()
{
SearchEndpoint = new Uri("https://my-endpoint"),
Key = "My key",
IndexName = "the-azure-search-ai-index-name",
FieldMappingOptions = new AzureCognitiveSearchIndexFieldMappingOptions()
{
ContentFieldNames = { "MyContentField" }
}
},
}
}
For more details on using extensions in OpenAI, @trrwilson or @joseharriaga can provide additional assistance.
@ShivangiReja FieldMappingOptions
is optional and not required. I am not sure if providing them will enhance the result. Any how, I tried adding them and ended up with the same result.
Please note that my code works on a different index. For example, if you look at this other index, searching works as expected. The key difference between the two indexes is that this one has at least one searchable String
type field whereas the other one has searchable SearchCollection
fields.
@MikeAlhayek Even if you have no searchable string field and only have searchable SearchCollection
fields, it should still be a valid index, and the functionality should work as intended. I've added a sample based on your scenario using the search library. You can review the example here, showcasing only a searchable SearchCollection
field and no searchable string field (lines 74-75). The sample works correctly and returns the expected results.
Could you please try utilizing only the search library to determine if it provides the expected response? If an error persists, it might be related to the Azure AI Search. If there's no issue, then it could indicate a problem with Azure Open AI.
@ShivangiReja your code does not use the Chat Completion code. It utilizes the Search AI index by creating an index, pushing content and then performing a search. This all works for me as expected as well. This is all working as part of OrchardCore CMS
The part that isn't working as expected in the GetChatCompletionsAsync
using AzureCognitiveSearchChatExtensionConfiguration
. Again the same code work fine when my index contains searchable String field. But it does not seems to search when there are no searchable String field.
@joseharriaga could you please help @MikeAlhayek with utilizing the extensions in OpenAI?
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @arv100kri @bleroy @jpalvarezl @tjacobhi @trrwilson.
@ShivangiReja @joseharriaga There has been no activity on this issue. I am wondering if there is a plan to fix this issue soon? In a short summary, it appears that the Azure OpenAI (C# SDK) on your own data does not search within a string-collection field types. I can't imagine this being a limitation, so I am assuming it is a bug in the SDK.
Library name and version
Azure.AI.OpenAI 1.0.0-beta.12
Describe the bug
When trying to search an index that only has searchable field of type
StringCollection
I get a bad request response. as you can see hereExpected behavior
In Azure AI Search, both field types
String
andStringCollection
are searchable. So I should be able to search the index using any searchable field regardless of it's type.Actual behavior
When running the code I get HTTP code 400 response from the API.
Reproduction Steps
Create an Azure Search AI index with no
String
fields. Add at least oneStringCollection
field.Then try to use
Azure.AI.OpenAI
model to search that index. This throw the exception listed aboveHere is the code I use to search my Azure Search AI index
The above code works when searching an index that has
String
field.Environment
No response