mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-16 06:13:48 +00:00
Add llmman as a self-hosted host for chat and embedding providers (#947)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
2bd3d41421
commit
88d1f4d96a
20 files changed
+270
-89
No files matched your search
@@ -46,11 +46,29 @@ public sealed class ReasoningDispatcherTests
|
||||
[TestCase(Host.LLAMA_CPP, """ "reasoning_budget": 0 """, ReasoningConfigurationState.EXPLICITLY_DISABLED)]
|
||||
[TestCase(Host.VLLM, """ "thinking_token_budget": 2048 """, ReasoningConfigurationState.EXPLICITLY_ENABLED)]
|
||||
[TestCase(Host.VLLM, """ "chat_template_kwargs": { "thinking": true } """, ReasoningConfigurationState.EXPLICITLY_ENABLED)]
|
||||
[TestCase(Host.LLMMAN, """ "reasoning_budget": 0 """, ReasoningConfigurationState.EXPLICITLY_DISABLED, Description = "llmman serves GGUF models with llama.cpp and hands the budget to it.")]
|
||||
[TestCase(Host.LLMMAN, """ "thinking_token_budget": 2048 """, ReasoningConfigurationState.EXPLICITLY_ENABLED, Description = "llmman serves other models with vLLM and hands the budget to it.")]
|
||||
public void EachSelfHostedEngineIsReadInItsOwn(Host host, string parameters, ReasoningConfigurationState wanted)
|
||||
{
|
||||
Assert.That(ReasoningDispatcher.WhatTheParametersSay(LLMProviders.SELF_HOSTED, host, parameters), Is.EqualTo(wanted));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LlmmanIsReadInEverythingItsEnginesAreReadIn()
|
||||
{
|
||||
//
|
||||
// llmman decides by itself whether llama.cpp or vLLM serves a model. A dialect either of
|
||||
// them learns later has to reach llmman as well, or a switch set for llmman goes unseen:
|
||||
//
|
||||
var llmman = ReasoningDispatcher.DialectsOf(LLMProviders.SELF_HOSTED, Host.LLMMAN);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(llmman, Is.SupersetOf(ReasoningDispatcher.DialectsOf(LLMProviders.SELF_HOSTED, Host.LLAMA_CPP)));
|
||||
Assert.That(llmman, Is.SupersetOf(ReasoningDispatcher.DialectsOf(LLMProviders.SELF_HOSTED, Host.VLLM)));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AProviderIsNotReadInADialectItDoesNotSpeak()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
using AIStudio.Provider;
|
||||
using AIStudio.Provider.SelfHosted;
|
||||
|
||||
namespace AIStudio.Tests.Provider.SelfHosted;
|
||||
|
||||
/// <summary>
|
||||
/// Checks that what each self-hosted engine can do is stated once, and that the statements fit together.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Which engines can list their models used to be written down twice, once for the provider and once
|
||||
/// for the dialogs, and the loading of the chat, embedding, and transcription lists repeated the
|
||||
/// engines a third time. A new engine had to be added to each of these lists, and one it was
|
||||
/// forgotten in left a list empty or a reload button disabled without anything failing. Now the
|
||||
/// host extensions state it, and these cases check that every other answer follows from them.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed class HostExtensionsTests
|
||||
{
|
||||
private static readonly Host[] ALL_HOSTS = Enum.GetValues<Host>();
|
||||
|
||||
[TestCaseSource(nameof(ALL_HOSTS))]
|
||||
public void TheDialogsOfferToLoadModelsExactlyWhereTheEngineCanListThem(Host host)
|
||||
{
|
||||
Assert.That(LLMProviders.SELF_HOSTED.CanLoadModels(host, null), Is.EqualTo(host.IsModelListSupported()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EveryEngineForChatsCanListItsModels()
|
||||
{
|
||||
//
|
||||
// There is no fixed chat model to offer instead, so such an engine would offer an empty list:
|
||||
//
|
||||
var unlisted = ALL_HOSTS.Where(host => host is not Host.NONE && host.IsChatSupported() && !host.IsModelListSupported());
|
||||
Assert.That(unlisted, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EveryEngineForEmbeddingsCanListItsModels()
|
||||
{
|
||||
//
|
||||
// There is no fixed embedding model to offer instead, so such an engine would offer an empty list:
|
||||
//
|
||||
var unlisted = ALL_HOSTS.Where(host => host.IsEmbeddingSupported() && !host.IsModelListSupported());
|
||||
Assert.That(unlisted, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnlyWhisperCppTranscribesWithoutListingItsModels()
|
||||
{
|
||||
//
|
||||
// The provider offers the one model of whisper.cpp under a fixed name. Any other engine
|
||||
// which transcribes but cannot list its models would offer an empty list:
|
||||
//
|
||||
var unlisted = ALL_HOSTS.Where(host => host.IsTranscriptionSupported() && !host.IsModelListSupported());
|
||||
Assert.That(unlisted, Is.EqualTo(new[] { Host.WHISPER_CPP }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheHostNoneLoadsNoModels()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(Host.NONE.IsModelListSupported(), Is.False);
|
||||
Assert.That(Host.NONE.IsEmbeddingSupported(), Is.False);
|
||||
Assert.That(Host.NONE.IsTranscriptionSupported(), Is.False);
|
||||
Assert.That(LLMProviders.SELF_HOSTED.CanLoadModels(Host.NONE, "a key"), Is.False);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user