|
| 1 | +--- |
| 2 | +layout: integration |
| 3 | +name: Soofi |
| 4 | +description: Use Soofi S open foundation models with Haystack |
| 5 | +authors: |
| 6 | + - name: Soofi |
| 7 | + socials: |
| 8 | + github: Soofi-Project |
| 9 | + linkedin: https://www.linkedin.com/company/ki-verband/ |
| 10 | + |
| 11 | +pypi: https://pypi.org/project/ollama-haystack/ |
| 12 | +repo: https://huggingface.co/Soofi-Project |
| 13 | +type: Model Provider |
| 14 | +report_issue: https://github.com/deepset-ai/haystack-core-integrations/issues |
| 15 | +logo: /logos/soofi.svg |
| 16 | +version: Haystack 2.0 |
| 17 | +toc: true |
| 18 | +--- |
| 19 | + |
| 20 | +### **Table of Contents** |
| 21 | + |
| 22 | +- [Overview](#overview) |
| 23 | +- [Setup](#setup) |
| 24 | +- [Usage](#usage) |
| 25 | + |
| 26 | +## Overview |
| 27 | + |
| 28 | +**Soofi** ([Sovereign Open Source Foundation Models](https://www.soofi.info/)) is a German research consortium building open European foundation models for industrial AI. The first model family, **Soofi S**, is a ~30B-parameter hybrid Mamba-2 / Mixture-of-Experts model (about 3.5B active parameters) with a strong focus on English and German. |
| 29 | + |
| 30 | +Preview checkpoints are on the [Soofi-Project Hugging Face organization](https://huggingface.co/Soofi-Project). Three models are available: |
| 31 | + |
| 32 | +<div class="styled-table"> |
| 33 | + |
| 34 | +| Model | Role | |
| 35 | +| --- | --- | |
| 36 | +| [`Soofi-S-Instruct-Preview`](https://huggingface.co/Soofi-Project/Soofi-S-Instruct-Preview) | Instruct model | |
| 37 | +| [`Soofi-S-Isar-Preview`](https://huggingface.co/Soofi-Project/Soofi-S-Isar-Preview) | Reasoning model | |
| 38 | +| [`Soofi-S-Rhine-Preview`](https://huggingface.co/Soofi-Project/Soofi-S-Rhine-Preview) | Reasoning model | |
| 39 | +</div> |
| 40 | + |
| 41 | +Each model ships in several quantization variants: |
| 42 | + |
| 43 | +<div class="styled-table"> |
| 44 | + |
| 45 | +| Quantization | Approx. size | Typical runtime | |
| 46 | +| --- | --- | --- | |
| 47 | +| FP16 | ~64 GB | Hugging Face Transformers / vLLM | |
| 48 | +| FP8 | ~34 GB | vLLM | |
| 49 | +| FP8@4bit | ~19 GB | vLLM (EntQuant) | |
| 50 | +| FP8@3bit | ~16 GB | vLLM (EntQuant) | |
| 51 | +| FP8@2bit | ~14 GB | vLLM (EntQuant) | |
| 52 | +| GGUF Q8_0 | ~34 GB | Ollama / llama.cpp | |
| 53 | +| GGUF Q5_K_M | ~26 GB | Ollama / llama.cpp | |
| 54 | +</div> |
| 55 | + |
| 56 | +> **Access:** Preview weights are gated (closed beta). Request access on the model card, then authenticate before downloading. |
| 57 | +
|
| 58 | +## Setup |
| 59 | + |
| 60 | +Serve a Soofi checkpoint first, then connect Haystack to that server: |
| 61 | + |
| 62 | +- **Ollama / llama.cpp (GGUF):** follow the instructions on the [`Soofi-S-Instruct-Preview-GGUF`](https://huggingface.co/Soofi-Project/Soofi-S-Instruct-Preview-GGUF) model card (and the matching Isar / Rhine GGUF cards). See also the [Ollama](/integrations/ollama) integration. |
| 63 | +- **vLLM (FP8):** follow the serve commands on the [`Soofi-S-Instruct-Preview-FP8`](https://huggingface.co/Soofi-Project/Soofi-S-Instruct-Preview-FP8) model card (and the matching Isar / Rhine FP8 cards). See also the [vLLM](/integrations/vllm) integration. |
| 64 | +- **vLLM (EntQuant):** follow the Docker / plugin setup on the [`Soofi-S-Instruct-Preview-EntQuant-2bit`](https://huggingface.co/Soofi-Project/Soofi-S-Instruct-Preview-EntQuant-2bit) model card (sibling 3-bit / 4-bit and reasoning variants work the same way). |
| 65 | + |
| 66 | +Install the Haystack package for the runtime you use: |
| 67 | + |
| 68 | +```bash |
| 69 | +pip install ollama-haystack # Ollama |
| 70 | +pip install vllm-haystack # vLLM |
| 71 | +``` |
| 72 | + |
| 73 | +## Usage |
| 74 | + |
| 75 | +Once a model is serving, use it as the chat generator for a Haystack [`Agent`](https://docs.haystack.deepset.ai/docs/agent). |
| 76 | + |
| 77 | +### Agent with Ollama |
| 78 | + |
| 79 | +Soofi S is strong in German as well as English. This example runs the agent entirely in German: |
| 80 | + |
| 81 | +```python |
| 82 | +from typing import Annotated |
| 83 | + |
| 84 | +from haystack.components.agents import Agent |
| 85 | +from haystack.dataclasses import ChatMessage |
| 86 | +from haystack.tools import tool |
| 87 | +from haystack_integrations.components.generators.ollama import OllamaChatGenerator |
| 88 | + |
| 89 | + |
| 90 | +@tool |
| 91 | +def price_lookup(product: Annotated[str, "Produktname für die Preissuche"]) -> str: |
| 92 | + """Sucht einen Beispielpreis für ein Produkt.""" |
| 93 | + mock_prices = {"laptop": "999 €", "tastatur": "99 €", "monitor": "349 €"} |
| 94 | + return mock_prices.get(product.lower(), "Unbekanntes Produkt") |
| 95 | + |
| 96 | + |
| 97 | +agent = Agent( |
| 98 | + chat_generator=OllamaChatGenerator( |
| 99 | + model="huggingface.co/Soofi-Project/Soofi-S-Instruct-Preview-GGUF:Q5_K_M", |
| 100 | + url="http://localhost:11434", |
| 101 | + generation_kwargs={"temperature": 0.6, "top_p": 0.95, "num_ctx": 8192}, |
| 102 | + ), |
| 103 | + tools=[price_lookup], |
| 104 | + system_prompt="Du hilfst Nutzern und rufst die bereitgestellten Tools auf, wenn sie relevant sind.", |
| 105 | +) |
| 106 | + |
| 107 | +result = agent.run(messages=[ChatMessage.from_user("Was kostet ein Laptop?")]) |
| 108 | +print(result["last_message"].text) |
| 109 | +``` |
| 110 | + |
| 111 | +Adjust `model` to match `ollama list` (or a local Modelfile tag). |
| 112 | + |
| 113 | +### Agent with vLLM |
| 114 | + |
| 115 | +```python |
| 116 | +from typing import Annotated |
| 117 | + |
| 118 | +from haystack.components.agents import Agent |
| 119 | +from haystack.dataclasses import ChatMessage |
| 120 | +from haystack.tools import tool |
| 121 | +from haystack_integrations.components.generators.vllm import VLLMChatGenerator |
| 122 | + |
| 123 | + |
| 124 | +@tool |
| 125 | +def price_lookup(product: Annotated[str, "Product name to look up"]) -> str: |
| 126 | + """Look up a mock product price.""" |
| 127 | + mock_prices = {"laptop": "$999", "keyboard": "$99", "monitor": "$349"} |
| 128 | + return mock_prices.get(product.lower(), "Unknown product") |
| 129 | + |
| 130 | + |
| 131 | +agent = Agent( |
| 132 | + chat_generator=VLLMChatGenerator( |
| 133 | + # Use the served model name, e.g. Soofi-S-Instruct-Preview-EntQuant-2bit for EntQuant |
| 134 | + model="Soofi-Project/Soofi-S-Instruct-Preview-FP8", |
| 135 | + api_base_url="http://localhost:8000/v1", |
| 136 | + generation_kwargs={"temperature": 0.6, "top_p": 0.95}, |
| 137 | + ), |
| 138 | + tools=[price_lookup], |
| 139 | + system_prompt="You help users by calling the provided tools when they are relevant.", |
| 140 | +) |
| 141 | + |
| 142 | +result = agent.run(messages=[ChatMessage.from_user("How much is a laptop?")]) |
| 143 | +print(result["last_message"].text) |
| 144 | +``` |
| 145 | + |
| 146 | +For llama.cpp with an OpenAI-compatible server, use Haystack’s [`OpenAIChatGenerator`](https://docs.haystack.deepset.ai/docs/openaichatgenerator) against that endpoint the same way — see the GGUF model card for `llama-server` flags such as `--jinja`. |
0 commit comments