]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix naming
authorshamoon <4887959+shamoon@users.noreply.github.com>
Fri, 25 Apr 2025 19:03:45 +0000 (12:03 -0700)
committershamoon <4887959+shamoon@users.noreply.github.com>
Wed, 2 Jul 2025 18:01:58 +0000 (11:01 -0700)
docs/configuration.md
src/paperless/ai/embedding.py
src/paperless/models.py
src/paperless/settings.py
src/paperless/tests/test_ai_classifier.py

index f0fad94cb3122177f57ba736f1190d26c099833e..07a2be19dffc9d375abbb1e4eff904a15b4ba151 100644 (file)
@@ -1771,9 +1771,9 @@ suggestions. This setting is required to be set to true in order to use the AI f
 
 #### [`PAPERLESS_LLM_EMBEDDING_BACKEND=<str>`](#PAPERLESS_LLM_EMBEDDING_BACKEND) {#PAPERLESS_LLM_EMBEDDING_BACKEND}
 
-: The embedding backend to use for RAG. This can be either "openai" or "local".
+: The embedding backend to use for RAG. This can be either "openai" or "huggingface".
 
-    Defaults to "local".
+    Defaults to None.
 
 #### [`PAPERLESS_LLM_EMBEDDING_MODEL=<str>`](#PAPERLESS_LLM_EMBEDDING_MODEL) {#PAPERLESS_LLM_EMBEDDING_MODEL}
 
index 1c33f197c2d69e444e7ce247c88e7f82ad8081ca..9d6a5faef65f8a327de24c9fac65b7e439942fab 100644 (file)
@@ -4,6 +4,7 @@ from llama_index.embeddings.openai import OpenAIEmbedding
 from documents.models import Document
 from documents.models import Note
 from paperless.config import AIConfig
+from paperless.models import LLMEmbeddingBackend
 
 EMBEDDING_DIMENSIONS = {
     "text-embedding-3-small": 1536,
@@ -15,12 +16,12 @@ def get_embedding_model():
     config = AIConfig()
 
     match config.llm_embedding_backend:
-        case "openai":
+        case LLMEmbeddingBackend.OPENAI:
             return OpenAIEmbedding(
                 model=config.llm_embedding_model or "text-embedding-3-small",
                 api_key=config.llm_api_key,
             )
-        case "local":
+        case LLMEmbeddingBackend.HUGGINGFACE:
             return HuggingFaceEmbedding(
                 model_name=config.llm_embedding_model
                 or "sentence-transformers/all-MiniLM-L6-v2",
index fb8a44986a0c2338e60bf90d605f9231e9d7e088..54fcacd7ba4b9dc8f0fea3f45675b840f982524f 100644 (file)
@@ -76,7 +76,7 @@ class ColorConvertChoices(models.TextChoices):
 
 class LLMEmbeddingBackend(models.TextChoices):
     OPENAI = ("openai", _("OpenAI"))
-    LOCAL = ("local", _("Local"))
+    HUGGINGFACE = ("huggingface", _("Huggingface"))
 
 
 class LLMBackend(models.TextChoices):
index fb8b161d44e7b27ff074ae1a80d9bb564e9bc1f2..dc5e36ffe3f97e347fb417c3333a08c51a258926 100644 (file)
@@ -1419,7 +1419,7 @@ OUTLOOK_OAUTH_ENABLED = bool(
 AI_ENABLED = __get_boolean("PAPERLESS_AI_ENABLED", "NO")
 LLM_EMBEDDING_BACKEND = os.getenv(
     "PAPERLESS_LLM_EMBEDDING_BACKEND",
-)  # "local" or "openai"
+)  # "huggingface" or "openai"
 LLM_EMBEDDING_MODEL = os.getenv("PAPERLESS_LLM_EMBEDDING_MODEL")
 LLM_BACKEND = os.getenv("PAPERLESS_LLM_BACKEND")  # "ollama" or "openai"
 LLM_MODEL = os.getenv("PAPERLESS_LLM_MODEL")
index a473652fc2078e31be51a95f423546f1020b6781..9302d6fd222a6b52f729a8c70ad9cbc5ee71a068 100644 (file)
@@ -66,7 +66,7 @@ def test_parse_llm_classification_response_invalid_json():
 @patch("paperless.ai.client.AIClient.run_llm_query")
 @patch("paperless.ai.ai_classifier.build_prompt_with_rag")
 @override_settings(
-    LLM_EMBEDDING_BACKEND="local",
+    LLM_EMBEDDING_BACKEND="huggingface",
     LLM_EMBEDDING_MODEL="some_model",
     LLM_BACKEND="ollama",
     LLM_MODEL="some_model",