Added vLLM support (#524)

Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
Peer SchüttandThorsten Sommer authored and GitHub committed 2025-08-10 16:26:25 +02:00
1 parent fe2baa8c00
commit b75d90b13f
12 files changed
+24 -21

No files matched your search

@@ -285,7 +285,7 @@ public static class LLMProvidersExtensions
LLMProviders.GWDG => true,
LLMProviders.HUGGINGFACE => true,
LLMProviders.SELF_HOSTED => host is Host.OLLAMA,
LLMProviders.SELF_HOSTED => host is (Host.OLLAMA or Host.VLLM),
_ => false,
};
@@ -322,6 +322,7 @@ public static class LLMProvidersExtensions
case Host.OLLAMA:
case Host.LM_STUDIO:
case Host.VLLM:
return true;
}
}
@@ -6,11 +6,8 @@ namespace AIStudio.Provider.SelfHosted;
/// <param name="Model">Which model to use for chat completion.</param>
/// <param name="Messages">The chat messages.</param>
/// <param name="Stream">Whether to stream the chat completion.</param>
/// <param name="MaxTokens">The maximum number of tokens to generate.</param>
public readonly record struct ChatRequest(
string Model,
IList<Message> Messages,
bool Stream,
int MaxTokens
bool Stream
);
@@ -7,4 +7,5 @@ public enum Host
LM_STUDIO,
LLAMACPP,
OLLAMA,
VLLM,
}
@@ -9,6 +9,7 @@ public static class HostExtensions
Host.LM_STUDIO => "LM Studio",
Host.LLAMACPP => "llama.cpp",
Host.OLLAMA => "ollama",
Host.VLLM => "vLLM",
_ => "Unknown",
};
@@ -29,6 +30,7 @@ public static class HostExtensions
{
case Host.LM_STUDIO:
case Host.OLLAMA:
case Host.VLLM:
return true;
default:
@@ -58,8 +58,7 @@ public sealed class ProviderSelfHosted(ILogger logger, Host host, string hostnam
}).ToList()],
// Right now, we only support streaming completions:
Stream = true,
MaxTokens = -1,
Stream = true
}, JSON_SERIALIZER_OPTIONS);
async Task<HttpRequestMessage> RequestBuilder()
@@ -101,6 +100,7 @@ public sealed class ProviderSelfHosted(ILogger logger, Host host, string hostnam
case Host.LM_STUDIO:
case Host.OLLAMA:
case Host.VLLM:
return await this.LoadModels(["embed"], [], token, apiKeyProvisional);
}
@@ -127,6 +127,7 @@ public sealed class ProviderSelfHosted(ILogger logger, Host host, string hostnam
{
case Host.LM_STUDIO:
case Host.OLLAMA:
case Host.VLLM:
return await this.LoadModels([], ["embed"], token, apiKeyProvisional);
}