{"id":50909077,"url":"https://github.com/codelibs/fess-llm-ollama","last_synced_at":"2026-06-16T08:02:23.197Z","repository":{"id":342184993,"uuid":"1172996192","full_name":"codelibs/fess-llm-ollama","owner":"codelibs","description":"An Ollama-based LLM integration for AI-powered Fess features.","archived":false,"fork":false,"pushed_at":"2026-05-01T05:24:18.000Z","size":71,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-01T07:19:58.179Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codelibs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-04T22:50:23.000Z","updated_at":"2026-05-01T05:24:24.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/codelibs/fess-llm-ollama","commit_stats":null,"previous_names":["codelibs/fess-llm-ollama"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/codelibs/fess-llm-ollama","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Ffess-llm-ollama","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Ffess-llm-ollama/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Ffess-llm-ollama/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Ffess-llm-ollama/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codelibs","download_url":"https://codeload.github.com/codelibs/fess-llm-ollama/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Ffess-llm-ollama/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34396430,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-16T08:02:22.323Z","updated_at":"2026-06-16T08:02:23.189Z","avatar_url":"https://github.com/codelibs.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ollama LLM Plugin for Fess\n==========================\n\n## Overview\n\nThis plugin provides Ollama integration for Fess's RAG (Retrieval-Augmented Generation) features. It enables Fess to use locally hosted Ollama models for AI-powered search capabilities including intent detection, answer generation, document summarization, and FAQ handling.\n\n## Download\n\nSee [Maven Repository](https://repo1.maven.org/maven2/org/codelibs/fess/fess-llm-ollama/).\n\n## Requirements\n\n- Fess 15.x or later\n- Java 21 or later\n- Ollama server running locally or accessible via network\n\n## Installation\n\n1. Download the plugin JAR from the Maven Repository\n2. Place it in your Fess plugin directory\n3. Restart Fess\n\nFor detailed instructions, see the [Plugin Administration Guide](https://fess.codelibs.org/14.19/admin/plugin-guide.html).\n\n## Configuration\n\nConfigure the following properties in `fess_config.properties`:\n\n| Property | Default | Description |\n|----------|---------|-------------|\n| `rag.llm.name` | - | Set to `ollama` to use this plugin |\n| `rag.chat.enabled` | `false` | Enable RAG chat feature |\n| `rag.llm.ollama.api.url` | `http://localhost:11434` | Ollama server root URL. The plugin appends `/api/chat` and `/api/tags`, so a trailing `/` or `/api` (the form shown in the Ollama docs, e.g. `http://localhost:11434/api` or `https://ollama.com/api`) is stripped automatically. |\n| `rag.llm.ollama.answer.context.max.chars` | `10000` | Maximum characters for document context in answer generation |\n| `rag.llm.ollama.availability.check.interval` | `60` | Interval (seconds) for checking Ollama server availability |\n| `rag.llm.ollama.chat.evaluation.max.relevant.docs` | `3` | Maximum number of relevant documents for evaluation |\n| `rag.llm.ollama.connect.timeout` | `5000` | TCP connect timeout (ms). Separate from `timeout` (read/response). |\n| `rag.llm.ollama.default.max.tokens` | (unset) | Fallback when `\u003ctype\u003e.max.tokens` is not set. |\n| `rag.llm.ollama.default.temperature` | (unset) | Fallback when `\u003ctype\u003e.temperature` is not set. |\n| `rag.llm.ollama.default.thinking.budget` | (unset) | Fallback when `\u003ctype\u003e.thinking.budget` is not set. |\n| `rag.llm.ollama.faq.context.max.chars` | `6000` | Maximum characters for document context in FAQ generation |\n| `rag.llm.ollama.model` | `gemma4:e4b` | Model name (e.g., `llama3:latest`, `mistral`) |\n| `rag.llm.ollama.retry.base.delay.ms` | `2000` | Base delay (ms) for exponential backoff with ±20% jitter. |\n| `rag.llm.ollama.retry.max` | `3` | Maximum total attempts on retryable HTTP errors (429/500/502/503/504) and connect-time IOExceptions. |\n| `rag.llm.ollama.summary.context.max.chars` | `10000` | Maximum characters for document context in summary generation |\n| `rag.llm.ollama.timeout` | `60000` | Response/read timeout (ms). For TCP connect timeout see `rag.llm.ollama.connect.timeout`. |\n\n### Recommended num_ctx Setting\n\nFor `gemma4:e4b` with 16GB GPU, set:\n\n```properties\nrag.llm.ollama.default.num.ctx=8192\n```\n\n### Per-Prompt-Type Parameters\n\nYou can configure `top_p` and `top_k` sampling parameters for each prompt type:\n\n| Property | Description |\n|----------|-------------|\n| `rag.llm.ollama.\u003cpromptType\u003e.top.p` | Top-p (nucleus) sampling parameter |\n| `rag.llm.ollama.\u003cpromptType\u003e.top.k` | Top-k sampling parameter |\n\n## Retry behavior\n\nBoth `chat()` and `streamChat()` retry on:\n\n- HTTP `429` (Too Many Requests; Ollama Cloud and rate-limited proxies)\n- HTTP `500`, `502`, `503` (Ollama queue overload via `OLLAMA_MAX_QUEUE`), `504`\n- `IOException` raised before a response is received (DNS, TCP, TLS, idle-socket failures)\n\nOther `4xx` errors are surfaced as `LlmException` immediately.\n\nStreaming retries only the initial HTTP request. Once NDJSON bytes start flowing,\nin-stream errors (HTTP transport failures **or** NDJSON `{\"error\": \"...\"}` payloads)\npropagate immediately to `LlmStreamCallback.onError(...)` — no replay.\n\nThe retry status set tracks the documented [Ollama errors](https://docs.ollama.com/api/errors).\n\nDefaults can be overridden via `rag.llm.ollama.retry.max` and\n`rag.llm.ollama.retry.base.delay.ms`.\n\n## Stream completion log\n\nA single INFO line is emitted per `streamChat()` call:\n\n```\n[LLM:OLLAMA] Stream completed. chunkCount=N, objectCount=N, firstChunkMs=N,\n  elapsedTime=Nms, doneReason=stop, totalDurationMs=N, loadDurationMs=N,\n  promptEvalDurationMs=N, evalDurationMs=N, promptEvalCount=N, evalCount=N,\n  tokensPerSecond=N.NN, parseErrorCount=0\n```\n\nA sibling WARN line is emitted when `done_reason` is anything other than `stop`,\n`load`, or `unload` — most commonly `length` (context window truncation):\n\n```\n[LLM:OLLAMA] Stream finished abnormally. doneReason=length, evalCount=N, ...\n```\n\n## Reasoning Model Configuration (e.g., qwen3.5)\n\nReasoning models like `qwen3.5` use internal thinking tokens that improve answer quality\nbut consume output tokens. Configure thinking per prompt type for optimal results.\n\n```properties\nrag.llm.ollama.model=qwen3.5:35b\nrag.llm.ollama.timeout=120000\n\n# Structured output / short responses - disable thinking\nrag.llm.ollama.intent.thinking.budget=0\nrag.llm.ollama.evaluation.thinking.budget=0\nrag.llm.ollama.unclear.thinking.budget=0\nrag.llm.ollama.noresults.thinking.budget=0\nrag.llm.ollama.docnotfound.thinking.budget=0\n\n# Answer generation - enable thinking with increased token limit\nrag.llm.ollama.answer.thinking.budget=1\nrag.llm.ollama.answer.max.tokens=16384\nrag.llm.ollama.summary.thinking.budget=1\nrag.llm.ollama.summary.max.tokens=16384\nrag.llm.ollama.direct.thinking.budget=1\nrag.llm.ollama.direct.max.tokens=8192\nrag.llm.ollama.faq.thinking.budget=1\nrag.llm.ollama.faq.max.tokens=8192\n```\n\nThe `thinking.budget` parameter controls the Ollama `think` flag as a boolean:\n- `0` — disable thinking (`think: false`)\n- Any positive value — enable thinking (`think: true`)\n- Not set — use model default (reasoning models default to thinking enabled)\n\nWhen thinking is enabled, increase `max.tokens` to accommodate both thinking and content tokens.\n\n### thinking.level (GPT-OSS and other models that ignore the boolean form)\n\nPer [Ollama's thinking docs](https://docs.ollama.com/capabilities/thinking), the `think`\nfield also accepts the string values `high`, `medium`, and `low`. GPT-OSS models in\nparticular ignore the boolean form. Use `rag.llm.ollama.\u003cpromptType\u003e.thinking.level`\n(or `rag.llm.ollama.default.thinking.level`) to send a string instead of a boolean:\n\n```properties\nrag.llm.ollama.model=gpt-oss:20b\nrag.llm.ollama.answer.thinking.level=high\nrag.llm.ollama.intent.thinking.level=low\n```\n\nWhen `thinking.level` is set, it overrides the boolean derived from `thinking.budget`\nfor that prompt type. Allowed values: `high`, `medium`, `low` (case-insensitive).\nInvalid values are ignored with a WARN log and fall back to `thinking.budget`.\n\n## Features\n\n- **Intent Detection** - Determines user intent (search, summary, FAQ, unclear) and generates Lucene queries\n- **Answer Generation** - Generates answers based on search results with citation support\n- **Document Summarization** - Summarizes specific documents\n- **FAQ Handling** - Provides direct, concise answers to FAQ-type questions\n- **Relevance Evaluation** - Identifies the most relevant documents for answer generation\n- **Streaming Support** - Real-time response streaming via NDJSON format\n- **Availability Checking** - Validates Ollama server and model availability at configurable intervals\n\n## Ollama API Endpoints Used\n\n- `GET /api/tags` - Lists available models for availability checking\n- `POST /api/chat` - Performs chat completion (supports both standard and streaming modes)\n\n## Development\n\n### Building from Source\n\n```bash\nmvn clean package\n```\n\n### Running Tests\n\n```bash\nmvn test\n```\n\n## License\n\nApache License 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelibs%2Ffess-llm-ollama","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodelibs%2Ffess-llm-ollama","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelibs%2Ffess-llm-ollama/lists"}