A Python-based LibreOffice extension (.oxt) that integrates local and cloud-based Large Language Models (LLMs) directly into LibreOffice Writer.
It provides an interactive, native-looking interface for text generation and document editing without freezing the LibreOffice UI.
- Multiple Providers Supported:
- 🤖 Ollama (Local): Run offline models like
llama3,mistral, orphi3. - 💻 LM Studio (Local / OpenAI-compatible): Run any local GGUF models with OpenAI-standard chat completion.
- 🌐 Google Gemini: Access advanced cloud intelligence via Gemini APIs.
- ☁️ Anthropic Claude: Access Claude models via the Anthropic Messages API.
- 🤖 Ollama (Local): Run offline models like
- Asynchronous Design: API calls run on background threads, keeping the LibreOffice interface fully responsive while generating.
- Text Generation: Prompt the model to write new content and insert it at the cursor position.
- Context-Aware Rewrite: Select text in Writer to improve writing, fix grammar, adjust tone (casual/professional), summarize, or run custom prompts (e.g., translation).
- Dynamic Configuration UI: A custom settings menu that enables/disables API fields dynamically based on the selected provider.
- Zero External Dependencies: Implemented using Python's standard
urlliblibrary, ensuring it runs on any standard LibreOffice installation.
On Linux (Ubuntu, Debian, Mint), ensure Python-UNO support is installed:
sudo apt install libreoffice-script-provider-python(Windows and macOS bundle Python automatically with LibreOffice; no action is required.)
Download the ai_assistant.oxt file from this repository and install it:
- Via GUI:
- Open LibreOffice Writer.
- Go to Tools ▸ Extension Manager....
- Click Add, select
ai_assistant.oxt, and click Open. - Restart LibreOffice.
- Via CLI:
unopkg add ai_assistant.oxt
For detailed setup instructions and usage walkthroughs, see the AI Assistant Installation & Usage Guide (PDF) included in this repository.
- Go to AI Assistant ▸ Settings....
- Select your provider, model name, and keys/endpoints.
- Save settings.
- Click AI Assistant ▸ Generate Text....
- Enter a prompt and click Generate.
- Highlight any text in your document.
- Click AI Assistant ▸ Rewrite Selection....
- Select an action (e.g., "Fix Grammar" or "Make Professional") and click Rewrite.
To modify the extension code or rebuild it:
- Edit the files inside the
extension/directory. - Run the build script to package and auto-register it in your local LibreOffice:
./build.sh
This project is licensed under the MIT License.