Hi mitttttsu
I'm glad that your issue is resolved and thank you for posting your solution so that others experiencing the same thing can easily reference this!
Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer.
Error Message:
Visual Studio Professional 2022 を用いてAzureOpenAIのチャット機能を利用したいと考えております。
以下コードのように単純な回答をさせたいのですが、
ChatMessageでエラーになってしまします。(CS0246)
何が原因か、解決方法を教えて頂きたいです。
※"dotnet add package Azure.AI.OpenAI --prerelease" をパッケージマネージャーコンソールで実施済みです。
using Azure.AI.OpenAI;
using Azure;
ーーーー一部省略ーーーーー
Console.Write("prompt:");
string prompt = Console.ReadLine() ?? "Hello.";
var response = client.GetChatCompletions( MODEL_NAME,
new ChatCompletionsOptions()
{
Messages = {
new ChatMessage(ChatRole.User,prompt),
},
});
Solution: I solved it with this code
Console.Write("prompt:");
string prompt = Console.ReadLine() ?? "Hello.";
var response = client.GetChatCompletions(
new ChatCompletionsOptions()
{
Messages = {
new ChatRequestUserMessage(prompt),
},
DeploymentName = MODEL_NAME,
});
If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.