# Serve your own adapter

> Load a LoRA adapter you trained on the base, give it its own temperatures, check that the server serves it, and know what it does to certificates.

Source: https://opendecisio.com/docs/deploy/adapter/

Answer a [question](https://opendecisio.com/docs/glossary/#question) with your own fine-tuned adapter or with the base, on one server, by naming the adapter in the request. You need a vLLM-format LoRA adapter trained on the base, its temperature file, and a GPU server.

 

Start the server with the adapter, then name it in the request:

 shell

```
pip install "decisio[serve]==0.60.0"
python -m decisio.serve.vllm_engine --adapter my-adapter=/models/my-adapter \
  --adapter-temperatures my-adapter=decisio_adapter.json --images on
```

 

Needs Linux with one NVIDIA card and a LoRA adapter.

 shell

```
curl -s http://127.0.0.1:8000/v1/systemone -H 'Content-Type: application/json' -d '{
  "state": "I was charged twice for the same order.",
  "adapter": "my-adapter",
  "questions": {"refund": {"type": "noul", "instructions": "Does the customer want a refund?"}}
}' -D - -o answer.json | grep -i '^x-decisio-adapter'
```

 

Needs a server with an adapter loaded, on one NVIDIA card.

 

 

## What does the start do?

 

Start the server with `--adapter name=path`, once per adapter, and the adapter’s temperature file.

 

- The adapter is a vLLM-format LoRA adapter, served unmerged, on the text route, in separate mode.
- A Mac does not serve adapters.
- A request uses the adapter only when it names it; every other request is answered by the base.
- The server serves the [prompt layout](https://opendecisio.com/docs/layout/) the adapter’s file records, and plain when it records none: no adapter was measured under the [header layout](https://opendecisio.com/docs/glossary/#prompt-layout). Adapters that record different layouts cannot share a server.

 

 

## Give it its own temperatures

 

- Put the file beside the adapter’s weights as `decisio_adapter.json`, or give it with `--adapter-temperatures name=file` when the adapter’s folder is not yours to change.
- `temperatures` has one per type: `choice`, `noul` for yes/no, and `score`. A type the file does not list keeps the base’s temperature.
- `choice_bands` is optional: keys `lo-hi`, within 2 to 255 and not overlapping. A choice question is served at its band’s temperature; a count in no band is served at `temperatures.choice`, then at the base’s.
- Yes/no and score questions are not banded.
- An adapter with no file is served at the base’s temperatures, and the server says so when it starts.

 

The file is checked before the engine is built, and an unusable one stops the start. This writes decisio’s example file and has decisio check it, on any machine:

 shell

```
cat > decisio_adapter.json &#x3C;&#x3C;'EOF'
{"schema": "decisio.adapter/1",
 "temperatures": {"choice": 2.141, "noul": 3.075, "score": 4.185},
 "choice_bands": {"2-10": 1.9, "11-26": 2.6, "27-255": 3.1}}
EOF
uv run python -m decisio.serve.adapter_temperatures check decisio_adapter.json
```

 Response

```
{
  "temperatures": {
    "choice": 2.141,
    "noul": 3.075,
    "score": 4.185
  },
  "choice_bands": {
    "2-10": 1.9,
    "11-26": 2.6,
    "27-255": 3.1
  },
  "think_temperatures": {},
  "layout": null,
  "fit": null,
  "file": "decisio_adapter.json"
}
```

  Fit a temperature file when you need to create one 

Use labelled readouts from the adapter under the layout you will serve:

 shell

```
python -m decisio.serve.adapter_temperatures fit --reads reads.jsonl \
  --out decisio_adapter.json \
  --data "what the items are"
```

 

Needs your adapter's readouts on your labelled items.

 

Fit on items that are not a benchmark’s: a temperature holds for the kind of items it was fitted on. Fit on readouts taken under the layout you serve, and give `--layout` to the fit so the file records it.

  

 

## What comes back

 

The request above names the adapter in its `adapter` field.

 

- The answer carries `"adapter"` and the `x-decisio-adapter` header when the adapter answered.
- An unknown name is answered 404, with the adapters that are loaded.

 

 

## Check that it took

 shell

```
curl -s http://127.0.0.1:8000/health \
  | python3 -c 'import json, sys; h = json.load(sys.stdin); print(json.dumps({k: h.get(k) for k in ("adapter_temperatures", "adapter_identity")}, indent=1))'
```

 

Needs a server with an adapter loaded, on one NVIDIA card.

 

`/health` shows each adapter’s temperatures in `adapter_temperatures`, and the hash of its weights and configuration in `adapter_identity`.

 

 

## Answer requests that name no adapter

 

`--default-adapter NAME` makes a loaded adapter answer every request that names none, for a client that cannot send an `adapter` field.

 

- **A request with no `adapter` field** is answered by the default adapter at its own temperatures, and the response’s `adapter` field says so.
- **A request that names another loaded adapter** gets that one, and `"adapter": "none"` gets the base model.
- **[Tasks](https://opendecisio.com/docs/glossary/#task) still read the base model:** ask a registered task’s questions with `"adapter": "none"`.
- **The default is part of what a certificate covers:** `/health` shows it, and a certificate made under another default is suspended.

 

 

## What does an adapter do to certificates?

 

Requests answered by an adapter are never certified. A request combining an adapter with a question matched by a registered task is refused; use the base model for that task.

 

Loaded adapter settings are part of the [serving setup](https://opendecisio.com/docs/glossary/#serving-setup) recorded by a base task’s certificate. After loading, retraining or changing an adapter, certify affected base tasks again on the resulting setup.

 

## What next

 

- [Server flags](https://opendecisio.com/docs/flags/#every-flag): `--adapter` and `--adapter-temperatures` in full.
- [The HTTP API](https://opendecisio.com/docs/api/): the `adapter` field and its errors.
- [Certify answers](https://opendecisio.com/docs/tasks/certify/): certify a task again on the new setup.
