Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Settings.cs - Cannot implicitly convert type 'Microsoft.DotNet.Interactive.PasswordString' to 'string' #12

Open
georgekosmidis opened this issue Apr 8, 2024 · 2 comments

Comments

@georgekosmidis
Copy link

While trying to run "Step 1️: Set up your OpenAI or Azure OpenAI Service key"

#!import ../config/Settings.cs

bool useAzureOpenAI = false;

await Settings.AskAzureEndpoint(useAzureOpenAI);
await Settings.AskModel(useAzureOpenAI);
await Settings.AskApiKey(useAzureOpenAI);

I got the following error:

{
	"name": "Error",
	"message": "(95,26): error CS0029: Cannot implicitly convert type 'Microsoft.DotNet.Interactive.PasswordString' to 'string'\r
(100,26): error CS0029: Cannot implicitly convert type 'Microsoft.DotNet.Interactive.PasswordString' to 'string'"
}

Had to go to lines 95 and 100 of Settings.cs and change the following:

apiKey = await InteractiveKernel.GetPasswordAsync("Please enter your Azure OpenAI API key");
// and
apiKey= await InteractiveKernel.GetPasswordAsync("Please enter your OpenAI API key");

to

apiKey = (await InteractiveKernel.GetPasswordAsync("Please enter your Azure OpenAI API key")).ToString();
// and
apiKey = (await InteractiveKernel.GetPasswordAsync("Please enter your OpenAI API key")).ToString();
@XiaoYangxxxx
Copy link

Got the same error, thank you!

@wullemsb
Copy link

wullemsb commented May 13, 2024

Same here. The solution as suggested above works. This PR fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants