From 3db5f420564648f36240d836b1e26a9a1405aa4c Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 8 May 2026 07:41:13 -0700 Subject: [PATCH] Add as an option --- src-ui/src/app/data/paperless-config.ts | 1 + ...tionconfiguration_llm_embedding_backend.py | 28 +++++++++++++++++++ src/paperless/models.py | 1 + src/paperless/settings/__init__.py | 2 +- 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/paperless/migrations/0010_alter_applicationconfiguration_llm_embedding_backend.py diff --git a/src-ui/src/app/data/paperless-config.ts b/src-ui/src/app/data/paperless-config.ts index 2df5cac49..a2fb4f411 100644 --- a/src-ui/src/app/data/paperless-config.ts +++ b/src-ui/src/app/data/paperless-config.ts @@ -57,6 +57,7 @@ export const ConfigCategory = { export const LLMEmbeddingBackendConfig = { OPENAI_LIKE: 'openai-like', HUGGINGFACE: 'huggingface', + OLLAMA: 'ollama', } export const LLMBackendConfig = { diff --git a/src/paperless/migrations/0010_alter_applicationconfiguration_llm_embedding_backend.py b/src/paperless/migrations/0010_alter_applicationconfiguration_llm_embedding_backend.py new file mode 100644 index 000000000..c8d11f7b7 --- /dev/null +++ b/src/paperless/migrations/0010_alter_applicationconfiguration_llm_embedding_backend.py @@ -0,0 +1,28 @@ +# Generated by Django 5.2.6 on 2026-05-08 00:00 + +from django.db import migrations +from django.db import models + + +class Migration(migrations.Migration): + dependencies = [ + ("paperless", "0009_alter_applicationconfiguration_options"), + ] + + operations = [ + migrations.AlterField( + model_name="applicationconfiguration", + name="llm_embedding_backend", + field=models.CharField( + blank=True, + choices=[ + ("openai-like", "OpenAI-compatible"), + ("huggingface", "Huggingface"), + ("ollama", "Ollama"), + ], + max_length=128, + null=True, + verbose_name="Sets the LLM embedding backend", + ), + ), + ] diff --git a/src/paperless/models.py b/src/paperless/models.py index 91ab4a496..1cd8cc513 100644 --- a/src/paperless/models.py +++ b/src/paperless/models.py @@ -77,6 +77,7 @@ class ColorConvertChoices(models.TextChoices): class LLMEmbeddingBackend(models.TextChoices): OPENAI_LIKE = ("openai-like", _("OpenAI-compatible")) HUGGINGFACE = ("huggingface", _("Huggingface")) + OLLAMA = ("ollama", _("Ollama")) class LLMBackend(models.TextChoices): diff --git a/src/paperless/settings/__init__.py b/src/paperless/settings/__init__.py index d82694dd8..47ee44bac 100644 --- a/src/paperless/settings/__init__.py +++ b/src/paperless/settings/__init__.py @@ -1178,7 +1178,7 @@ REMOTE_OCR_ENDPOINT = os.getenv("PAPERLESS_REMOTE_OCR_ENDPOINT") AI_ENABLED = get_bool_from_env("PAPERLESS_AI_ENABLED", "NO") LLM_EMBEDDING_BACKEND = os.getenv( "PAPERLESS_AI_LLM_EMBEDDING_BACKEND", -) # "huggingface" or "openai-like" +) # "huggingface", "openai-like", or "ollama" LLM_EMBEDDING_MODEL = os.getenv("PAPERLESS_AI_LLM_EMBEDDING_MODEL") LLM_BACKEND = os.getenv("PAPERLESS_AI_LLM_BACKEND") # "ollama" or "openai-like" LLM_MODEL = os.getenv("PAPERLESS_AI_LLM_MODEL")