SetSearchKey and SetEmbeddingKey return "does not contain a definition for ..."

Copper Contributor

I'm currently using Azure.AI.OpenAI 1.0 beta 12, I'm using the samples provided by Microsoft however when I compile the code I get the following error

'AzureCognitiveSearchChatExtensionConfiguration' does not contain a definition for 'SetSearchKey' and no accessible extension method 'SetSearchKey' accepting a first argument of type 'AzureCognitiveSearchChatExtensionConfiguration' could be found (are you missing a using directive or an assembly reference?)

 

and

 

'AzureCognitiveSearchChatExtensionConfiguration' does not contain a definition for 'SetEmbeddingKey' and no accessible extension method 'SetEmbeddingKey' accepting a first argument of type 'AzureCognitiveSearchChatExtensionConfiguration' could be found (are you missing a using directive or an assembly reference?).

 

The lines of code I'm using are

// Initialize the AzureCognitiveSearchChatExtensionConfiguration
var search = new AzureCognitiveSearchChatExtensionConfiguration()
{
    SearchEndpoint = new Uri(searchEndpoint),
    IndexName = searchIndexName
};
 
// Set the SearchKey
search.SetSearchKey(searchKey);
 
// Set the EmbeddingKey
search.SetEmbeddingKey(embeddingKey);
 

I've checked the solution and it has the correct version of Azure.AI.OpenAI installed.

 

Any thoughts welcome.

 

Thanks

Rob Ireland

1 Reply

@Robert Ireland 

Use version beta 9 instead of 12 and it will work. In the new version 12, they somehow removed this method. I ran through same problem and fixed when used 9.

Use below:

"dotnet add package Azure.AI.OpenAI --version 1.0.0-beta.9"