feat: replaced ollama with litellm (#18)
Some checks failed
Some checks failed
Co-authored-by: Sharang Parnerkar <parnerkarsharang@gmail.com> Reviewed-on: #18
This commit was merged in pull request #18.
This commit is contained in:
@@ -3,8 +3,8 @@ use serde::{Deserialize, Serialize};
|
||||
/// Supported LLM provider backends.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub enum LlmProvider {
|
||||
/// Self-hosted models via Ollama
|
||||
Ollama,
|
||||
/// LiteLLM proxy for unified model access
|
||||
LiteLlm,
|
||||
/// Hugging Face Inference API
|
||||
HuggingFace,
|
||||
/// OpenAI-compatible endpoints
|
||||
@@ -17,7 +17,7 @@ impl LlmProvider {
|
||||
/// Returns the display name for a provider.
|
||||
pub fn label(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Ollama => "Ollama",
|
||||
Self::LiteLlm => "LiteLLM",
|
||||
Self::HuggingFace => "Hugging Face",
|
||||
Self::OpenAi => "OpenAI",
|
||||
Self::Anthropic => "Anthropic",
|
||||
@@ -29,7 +29,7 @@ impl LlmProvider {
|
||||
///
|
||||
/// # Fields
|
||||
///
|
||||
/// * `id` - Unique model identifier (e.g. "llama3.1:8b")
|
||||
/// * `id` - Unique model identifier (e.g. "qwen3-32b")
|
||||
/// * `name` - Human-readable display name
|
||||
/// * `provider` - Which provider hosts this model
|
||||
/// * `context_window` - Maximum context length in tokens
|
||||
@@ -79,8 +79,8 @@ mod tests {
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
#[test]
|
||||
fn llm_provider_label_ollama() {
|
||||
assert_eq!(LlmProvider::Ollama.label(), "Ollama");
|
||||
fn llm_provider_label_litellm() {
|
||||
assert_eq!(LlmProvider::LiteLlm.label(), "LiteLLM");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -101,7 +101,7 @@ mod tests {
|
||||
#[test]
|
||||
fn llm_provider_serde_round_trip() {
|
||||
for variant in [
|
||||
LlmProvider::Ollama,
|
||||
LlmProvider::LiteLlm,
|
||||
LlmProvider::HuggingFace,
|
||||
LlmProvider::OpenAi,
|
||||
LlmProvider::Anthropic,
|
||||
@@ -117,10 +117,10 @@ mod tests {
|
||||
#[test]
|
||||
fn model_entry_serde_round_trip() {
|
||||
let entry = ModelEntry {
|
||||
id: "llama3.1:8b".into(),
|
||||
name: "Llama 3.1 8B".into(),
|
||||
provider: LlmProvider::Ollama,
|
||||
context_window: 8192,
|
||||
id: "qwen3-32b".into(),
|
||||
name: "Qwen3 32B".into(),
|
||||
provider: LlmProvider::LiteLlm,
|
||||
context_window: 32,
|
||||
};
|
||||
let json = serde_json::to_string(&entry).expect("serialize ModelEntry");
|
||||
let back: ModelEntry = serde_json::from_str(&json).expect("deserialize ModelEntry");
|
||||
|
||||
Reference in New Issue
Block a user