Another remote for gh:zotero-rag/zotero-rag
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: add `#[non_exhaustive]` to public enums

+27 -2
+5
zqa-rag/src/capabilities.rs
··· 21 21 /// implementations will be in the `llm/` directory. 22 22 #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] 23 23 #[serde(rename_all = "lowercase")] 24 + #[non_exhaustive] 24 25 pub enum ModelProvider { 25 26 /// Anthropic model provider 26 27 Anthropic, ··· 60 61 /// generation, you will find the structs in `llm/` or `embedding/`. 61 62 #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] 62 63 #[serde(rename_all = "lowercase")] 64 + #[non_exhaustive] 63 65 pub enum EmbeddingProvider { 64 66 /// Cohere embedding provider 65 67 Cohere, ··· 126 128 /// state, but the [`crate::embedding::voyage::VoyageAIClient`] changes this to 127 129 /// [`BatchJobState::InProgress`]. 128 130 #[derive(Debug, PartialEq, Eq)] 131 + #[non_exhaustive] 129 132 pub enum BatchJobState { 130 133 /// The batch job has been created, but it may not have started processing. 131 134 Created, ··· 216 219 /// Providers of batch embedding APIs. Structs corresponding to these should implement 217 220 /// [`BatchAPIProvider`]. By definition, this enum is a subset of [`EmbeddingProvider`]. 218 221 #[derive(Clone, Debug)] 222 + #[non_exhaustive] 219 223 pub enum BatchEmbeddingProvider { 220 224 /// Voyage AI batch API provider 221 225 VoyageAI, ··· 236 240 /// should implement the `Rerank` trait. 237 241 #[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] 238 242 #[serde(rename_all = "lowercase")] 243 + #[non_exhaustive] 239 244 pub enum RerankerProvider { 240 245 /// Cohere reranking provider 241 246 Cohere,
+1
zqa-rag/src/config.rs
··· 191 191 192 192 /// Configuration for LLM clients 193 193 #[derive(Debug, Clone)] 194 + #[non_exhaustive] 194 195 pub enum LLMClientConfig { 195 196 /// Anthropic client configuration 196 197 Anthropic(crate::config::AnthropicConfig),
+1
zqa-rag/src/embedding/common.rs
··· 95 95 96 96 /// Configuration enum for embedding providers 97 97 #[derive(Debug, Clone)] 98 + #[non_exhaustive] 98 99 pub enum EmbeddingProviderConfig { 99 100 /// Configuration for OpenAI embedding provider 100 101 OpenAI(crate::config::OpenAIConfig),
+1
zqa-rag/src/llm/errors.rs
··· 7 7 /// A wrapper for all kinds of errors to one enum that tells us what happened. 8 8 /// Variant error messages are handled via thiserror. 9 9 #[derive(Debug, Error)] 10 + #[non_exhaustive] 10 11 pub enum LLMError { 11 12 /// API errors that likely represent credential errors. 12 13 #[error("Got 4xx response, possible credentials error: {0}")]
+1
zqa-rag/src/llm/factory.rs
··· 12 12 13 13 /// Enum representing different LLM client implementations 14 14 #[derive(Debug, Clone)] 15 + #[non_exhaustive] 15 16 pub enum LLMClient { 16 17 /// Anthropic client 17 18 Anthropic(AnthropicClient),
+1
zqa-rag/src/providers/provider_id.rs
··· 7 7 /// The canonical list of providers, regardless of capabilities. The 8 8 /// [`super::registry::ProviderRegistry`] is responsible for maintaining that information. 9 9 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 10 + #[non_exhaustive] 10 11 #[allow(missing_docs)] 11 12 pub enum ProviderId { 12 13 Anthropic,
+1
zqa-rag/src/reranking/common.rs
··· 48 48 49 49 /// Configuration enum for reranking providers 50 50 #[derive(Debug, Clone)] 51 + #[non_exhaustive] 51 52 pub enum RerankProviderConfig { 52 53 /// Configuration for VoyageAI reranking provider 53 54 VoyageAI(crate::config::VoyageAIConfig),
+1
zqa-rag/src/vector/backends/lance.rs
··· 34 34 35 35 /// Errors that can occur when working with LanceDB 36 36 #[derive(Debug, Error)] 37 + #[non_exhaustive] 37 38 pub enum LanceError { 38 39 /// Error connecting to LanceDB 39 40 #[error("LanceDB connection error: {0}")]
+1
zqa-rag/src/vector/backup.rs
··· 9 9 10 10 /// Errors that can occur during backup operations 11 11 #[derive(Debug, Error)] 12 + #[non_exhaustive] 12 13 pub enum BackupError { 13 14 /// LanceDB library error during backup operations 14 15 #[error("LanceDB library error during backup: {0}")]
+7
zqa/src/config.rs
··· 314 314 .zeroentropy 315 315 .as_ref() 316 316 .map(|cfg| EmbeddingProviderConfig::ZeroEntropy(cfg.clone().into())), 317 + _ => None, 317 318 } 318 319 } 319 320 ··· 360 361 summary: None, 361 362 }) 362 363 }), 364 + _ => None, 363 365 } 364 366 } 365 367 ··· 399 401 .openrouter 400 402 .as_ref() 401 403 .and_then(|c| c.model_small.as_ref()), 404 + _ => None, 402 405 }; 403 406 404 407 if let Some(small_model_name) = small_model_name { ··· 408 411 LLMClientConfig::OpenAI(c) => c.model.clone_from(small_model_name), 409 412 LLMClientConfig::Gemini(c) => c.model.clone_from(small_model_name), 410 413 LLMClientConfig::OpenRouter(c) => c.model.clone_from(small_model_name), 414 + _ => (), 411 415 } 412 416 } 413 417 ··· 423 427 EmbeddingProviderConfig::Ollama(cfg) => cfg.embedding_model, 424 428 EmbeddingProviderConfig::Cohere(cfg) => cfg.embedding_model, 425 429 EmbeddingProviderConfig::ZeroEntropy(cfg) => cfg.embedding_model, 430 + _ => unimplemented!("unsupported embedding provider: {}", config.provider_id()), 426 431 }) 427 432 } 428 433 ··· 434 439 LLMClientConfig::OpenAI(cfg) => cfg.model, 435 440 LLMClientConfig::Gemini(cfg) => cfg.model, 436 441 LLMClientConfig::OpenRouter(cfg) => cfg.model, 442 + _ => unimplemented!("unsupported generation provider: {}", config.provider_id()), 437 443 }) 438 444 } 439 445 ··· 496 502 .openrouter 497 503 .as_ref() 498 504 .map(|cfg| LLMClientConfig::OpenRouter(cfg.clone().into())), 505 + _ => None, 499 506 } 500 507 } 501 508 }
+6 -2
zqa/src/lib.rs
··· 62 62 LLMClientConfig::OpenAI(cfg) => cfg.api_key, 63 63 LLMClientConfig::Gemini(cfg) => cfg.api_key, 64 64 LLMClientConfig::OpenRouter(cfg) => cfg.api_key, 65 - LLMClientConfig::Ollama(_) => String::new(), // Doesn't need one 65 + LLMClientConfig::Ollama(_) => String::from("foo"), // Doesn't need one 66 + _ => unimplemented!("unsupported generation provider: {}", c.provider_id()), 66 67 }) 67 68 .is_empty() 68 69 }) { ··· 84 85 EmbeddingProviderConfig::VoyageAI(cfg) => cfg.api_key, 85 86 EmbeddingProviderConfig::Gemini(cfg) => cfg.api_key, 86 87 EmbeddingProviderConfig::ZeroEntropy(cfg) => cfg.api_key, 87 - EmbeddingProviderConfig::Ollama(_) => String::new(), 88 + // Ollama doesn't need an API key so we force a false condition 89 + EmbeddingProviderConfig::Ollama(_) => String::from("foo"), 90 + _ => unimplemented!("unsupported embedding provider: {}", c.provider_id()), 88 91 }) 89 92 .is_empty() 90 93 }) { ··· 105 108 RerankProviderConfig::VoyageAI(cfg) => cfg.api_key, 106 109 RerankProviderConfig::Cohere(cfg) => cfg.api_key, 107 110 RerankProviderConfig::ZeroEntropy(cfg) => cfg.api_key, 111 + _ => unimplemented!("unsupported reranking provider: {}", c.provider_id()), 108 112 }) 109 113 .is_empty() 110 114 })
+1
zqa/src/utils/library.rs
··· 134 134 135 135 /// A general error struct for Zotero library parsing. 136 136 #[derive(Clone, Debug, Error)] 137 + #[non_exhaustive] 137 138 pub enum LibraryParsingError { 138 139 #[error("SQLite error: {0}. Try closing Zotero, which can sometimes hold a lock.")] 139 140 SqlError(String),