AI-Studio/app/MindWork AI Studio/Provider/SelfHosted/HostExtensions.cs

41 lines
894 B
C#
Raw Normal View History

2024-12-03 14:24:40 +00:00
namespace AIStudio.Provider.SelfHosted;
public static class HostExtensions
{
public static string Name(this Host host) => host switch
{
Host.NONE => "None",
Host.LM_STUDIO => "LM Studio",
2026-01-07 14:28:44 +00:00
Host.LLAMA_CPP => "llama.cpp",
2024-12-03 14:24:40 +00:00
Host.OLLAMA => "ollama",
Host.VLLM => "vLLM",
2024-12-03 14:24:40 +00:00
_ => "Unknown",
};
public static string BaseURL(this Host host) => host switch
{
_ => "/v1/",
};
public static string ChatURL(this Host host) => host switch
{
_ => "chat/completions",
};
2026-01-07 14:30:23 +00:00
public static bool IsEmbeddingSupported(this Host host)
2024-12-03 14:24:40 +00:00
{
switch (host)
{
case Host.LM_STUDIO:
case Host.OLLAMA:
case Host.VLLM:
2024-12-03 14:24:40 +00:00
return true;
default:
2026-01-07 14:28:44 +00:00
case Host.LLAMA_CPP:
2024-12-03 14:24:40 +00:00
return false;
}
}
}