You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
730 B
C#

namespace OllamaStudy.UseExtensionsAI;
public class ExtensionAI4OpenAITest
{
private ITestOutputHelper _output;
public ExtensionAI4OpenAITest(ITestOutputHelper outputHelper)
{
_output = outputHelper;
}
[Fact]
public async Task AI_Test()
{
var openAiClient = new OpenAIClient(new ApiKeyCredential("unnecessary"), new OpenAIClientOptions() { Endpoint = new Uri("http://localhost:11434/v1")});
IChatClient client = openAiClient.GetChatClient("qwen3:0.6b").AsIChatClient();
var response = await client.GetResponseAsync("什么是AI?");
_output.WriteLine(response.Text);
Assert.NotNull(response);
Assert.NotEmpty(response.Messages);
}
}