Add support for ollama (#34)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2024-07-16 10:28:13 +02:00
1 parent 179f350af5
commit 063fd0fcfa
19 files changed
+271 -75

No files matched your search

@@ -0,0 +1,42 @@
namespace AIStudio.Provider.SelfHosted;
public enum Host
{
NONE,
LM_STUDIO,
LLAMACPP,
OLLAMA,
}
public static class HostExtensions
{
public static string Name(this Host host) => host switch
{
Host.NONE => "None",
Host.LM_STUDIO => "LM Studio",
Host.LLAMACPP => "llama.cpp",
Host.OLLAMA => "ollama",
_ => "Unknown",
};
public static string BaseURL(this Host host) => host switch
{
Host.LM_STUDIO => "/v1/",
Host.LLAMACPP => "/v1/",
Host.OLLAMA => "/v1/",
_ => "/v1/",
};
public static string ChatURL(this Host host) => host switch
{
Host.LM_STUDIO => "chat/completions",
Host.LLAMACPP => "chat/completions",
Host.OLLAMA => "chat/completions",
_ => "chat/completions",
};
}