Files
BeWoPlaner/AiCoreUnitTest/Ollama2FacadeTest.cs

54 lines
1.1 KiB
C#
Raw Permalink Normal View History

2025-12-03 11:06:45 +01:00
using AICore.Facade.LLM;
using BeWo.Service.Core;
2026-03-09 12:40:29 +01:00
using BS.Shared.Core;
2025-12-03 11:06:45 +01:00
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace AiCoreUnitTest
{
[TestClass]
public class Ollama2FacadeTest
{
public OllamaApiClient Client { get; set; }
[TestInitialize]
public void TestInitialize()
{
var url = "https://ai3.ownsoft.de";
var key = "mu9ZPuUXJ4aVGLU1WL2RfPCeSMRmJREwyjVJBP7bHfSz8quZRqN7e7UwnwCDi8GZ";
Client = new OllamaApiClient(url, key, BS.Shared.AiModelSource.ollama2);
}
[TestMethod]
public void GetModels()
{
var response = Client.GetAiModelle();
Assert.IsTrue(response?.Success);
}
[TestMethod]
public void SendMessage()
{
2026-03-09 13:51:33 +01:00
var logger = ServiceLogger.GetRequestLogger(out string id);
2025-12-03 11:06:45 +01:00
// Build Payload
var payload = new
{
2025-12-03 11:17:42 +01:00
model = "gemma3:12b",
2025-12-03 11:06:45 +01:00
messages = new[] {
new {
role = "user",
2025-12-03 11:17:42 +01:00
message = "why is the sky blue?"
2025-12-03 11:06:45 +01:00
}
2026-03-09 13:51:33 +01:00
},
requestid = id
2025-12-03 11:06:45 +01:00
};
var response = Client.SendAiMessageRequest(payload, out string message, out string model, out int? duration, logger);
Assert.IsTrue(response?.Success);
}
}
}