# Overview

A plugin is a Python package that adds something to laplace**kit**: a curvature, a prior, a likelihood, a way to pick parameters, or a front door for another library’s models. Users install it and pass its objects where a built-in would go:

``` python
import laplacekit as lk

post = lk.laplace(
    model, loader, likelihood=lk.Categorical(), subset=lk.subnet.largest_magnitude(1000)
)
```

## Do you need one?

Often not. `lk.laplace` takes any object with the right methods, so a likelihood or a subset defined in your own script works as it is. [Custom likelihood](../quickstart/likelihoods.llms.md) does exactly that. You need a plugin when other people should be able to `pip install` your method, or when you want it tested and versioned on its own.

## What a plugin can add

Each kind of contribution is a protocol in `laplacekit.core`. `lk.laplace` accepts any object with the right methods and never looks anything up by name. You may subclass the protocol so that your editor checks your class, but you don’t have to. If protocols are new to you, read [Protocols in one page](../plugins/protocols.llms.md) first.

A package also declares an entry point. It only lists the plugin in `lk.plugins()` and `lk.health()`; nothing else depends on it.

| Kind | Protocol | Where it goes |
|----|----|----|
| [A subset](../plugins/subset.llms.md) | `Subset` | `lk.laplace(..., subset=)` |
| [A prior](../plugins/prior.llms.md) | `Prior`, `TunablePrior` | `lk.laplace(..., prior=)` |
| [A tuning objective](../plugins/objective.llms.md) | `Objective` | `lk.Minimize`, `lk.GridSearch` |
| [A likelihood](../plugins/likelihood.llms.md) | `Likelihood` | `lk.laplace(..., likelihood=)` |
| [A predictive](../plugins/predictive.llms.md) | `Predictive` | `lk.predict(post, x, method)` |
| [A curvature](../plugins/curvature.llms.md) | `Curvature`, `Staged` | `lk.laplace(..., hessian_approx=)` |
| [A function-space approximation](../plugins/function_space.llms.md) | `function_space.FunctionSpaceMethod` | `lk.function_space.laplace(..., method=)` |
| [A library integration](../plugins/integration.llms.md) | the above, plus a `ModelFn` | its own front door, e.g., `lk.diffusers.laplace` |

The rows go from the smallest contract to the largest. Each row links to its guide, with a worked example and its test. [Your first plugin](../plugins/first.llms.md) starts at the top, with a subset, and ships it as a package.

## First-party and third-party

Some plugins are first-party: the laplace**kit** author curates them as part of laplace**kit**, and they come with an extra and an `lk.` alias. The rest are third-party: anyone can publish one from their own repository. Mechanically, the two are the same:

|  | First-party | Third-party |
|----|----|----|
| Examples | `laplacekit-transformers`, `laplacekit-diffusers`, `laplacekit-subnet`, `laplacekit-heteroscedastic`, `laplacekit-reward`, `laplacekit-gp`, `laplacekit-marglik` | none listed yet |
| Curated with laplace**kit** | yes | no |
| Package | its own | its own |
| May import | `laplacekit` and `laplacekit.core` only | the same |
| Registers under `laplacekit.plugins` | yes | yes |
| Install | `pip install "laplacekit[transformers]"` | `pip install` with the package’s name |
| Reached as | `lk.transformers` | an import of the package |

Apart from curation, only the last two rows differ, and both are conveniences. A first-party plugin can do nothing that a third-party one can’t. [Plugin or pull request?](../plugins/plugin-or-pr.llms.md) says when a plugin becomes first-party.

The [plugin list](../plugins/index.llms.md) shows the plugins we know of.
