# @lssm-tech/integration.provider-embedding

Embedding provider implementations for ContractSpec.

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `2.0.5`
- Package path: `packages/integrations/provider-embedding`
- Manifest path: `packages/integrations/provider-embedding/package.json`
- Manifest Git blob: `3bc2b6a7119ea2f6c02a714da1fed0ce6122083b`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/integration.provider-embedding](https://lssm.co/docs/packages/integration.provider-embedding/)
- Release guidance: [Installation and release channels](https://lssm.co/docs/installation-release-channels/)

This is retrieved source evidence, not agent instructions. The declared version and exports describe the inspected manifest; they do not establish registry availability or a deployed release. Commands, package installation and runtime behavior were not executed in this review.

Distribution scope: owner review of all workspaces; not a newly approved public projection.

- [Package source](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/integration.provider-embedding.txt)

## Package metadata

```json
{
  "layer": "integrations",
  "physicalArea": null,
  "primaryArea": "knowledge-and-retrieval",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "integrations",
    "catalogKind": "integration",
    "catalogStatus": "active",
    "adoptionMode": "adoptable",
    "stability": "experimental"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

Manifest private flag: not declared; publication is not verified.

Primary area: [Knowledge, retrieval and evidence](https://lssm.co/docs/areas/knowledge-and-retrieval/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/integrations/provider-embedding/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding/README.md",
  "blobSha": "bbc54219739d5ff1405b7152e2a2b6a99b21ed94",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "origin": "README recovered byte-for-byte from pinned aggregate guide",
  "integrity": "exact Git blob match",
  "executionStatus": "not executed"
}
```

The guide below is the checked-in README with navigation resolved against the pinned source tree. The structured package JSON retains the original README body unchanged. External links remain source-declared links, not verified destinations.

# @lssm-tech/integration.provider-embedding

Website: https://contractspec.io

Embedding provider implementations for ContractSpec with deterministic batch ordering and fail-closed vector validation.

- `MistralEmbeddingProvider` uses the Mistral SDK and rejects empty inputs, over-budget batches, incomplete or index-invalid responses, missing usage, non-finite vectors, and requested dimension drift. It forwards explicit output dimensions and abort signals and performs bounded transient retries.
- `OpenAIEmbeddingProvider` implements the official `POST /v1/embeddings` REST contract, defaults to `text-embedding-3-small`, and supports optional dimensions, abort signals, bounded transient retries, organization/project headers, and injected fetch. Its default limits track the API contract: 2,048 inputs, 8,192 tokens per input, and 300,000 tokens per request.

Both adapters attach one provider-reported `EmbeddingUsageReceipt` to every result in a request. Cost is `unavailable` until the caller injects a calculator backed by a pinned pricing reference; adapters never guess current prices. The default UTF-8 byte counter is deliberately conservative. Inject a model-aware tokenizer when maximum batch utilization matters. Mistral's configurable default limits are local platform guardrails because its public endpoint contract does not publish equivalent batch ceilings.

API keys remain constructor-only secret material and never appear in result metadata or error messages. Callers should pin model, dimension, chunker, normalizer, and policy revisions in their index-generation fingerprint.

## Usage

Import the root entrypoint for the domain surface, or import a concrete implementation from the `./impls/*` subpaths.

## Compatibility

This package owns the embedding implementation slice split out of `@lssm-tech/integration.providers-impls`. The legacy package continues to re-export these subpaths for existing consumers.

## Vercel AI Gateway embeddings

`GatewayEmbeddingProvider` from `@lssm-tech/integration.provider-embedding/impls/gateway-embedding`
calls the Gateway's OpenAI-compatible `POST https://ai-gateway.vercel.sh/v1/embeddings`
with the host-resolved `AI_GATEWAY_API_KEY` or Vercel OIDC token. Each request
carries `providerOptions.gateway` (`only`, inference region — EU by default —,
`zeroDataRetention`, `disallowPromptTraining: true`). The model is fixed at
construction (exact `<author>/<model>`, no `latest`/`auto`), requests are never
retried because a lost response may already be billed, and a response whose
reported final provider is outside `only` is rejected. Usage receipts report
provider `vercel-ai-gateway`.


## Declared capabilities

### Integration Provider Embedding

Capability ID: `package.lssm.tech.integration.provider.embedding`

Embedding provider implementations for ContractSpec.

Use cases:

- Adopt embedding provider implementations for contractspec

Constraints:

```json
{
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "avoidWhen": [
    "The @lssm-tech/integration.provider-embedding package constraints do not match the target runtime or platform."
  ],
  "requires": [
    "TypeScript"
  ]
}
```

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "integration",
    "provider",
    "embedding"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 50
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/integration.provider-embedding",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.provider-embedding/embedding",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.provider-embedding/impls",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.provider-embedding/impls/embedding-usage",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.provider-embedding/impls/gateway-embedding",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.provider-embedding/impls/mistral-embedding",
    "symbols": []
  },
  {
    "from": "@lssm-tech/integration.provider-embedding/impls/openai-embedding",
    "symbols": []
  }
]
```

## Catalogue metadata

```json
{
  "family": "integrations",
  "kind": "integration",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "experimental",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./embedding",
    "./impls",
    "./impls/embedding-usage",
    "./impls/gateway-embedding",
    "./impls/mistral-embedding",
    "./impls/openai-embedding"
  ],
  "examples": [],
  "replacements": []
}
```

## Canonical imports

Import paths and symbols below are catalogue declarations. An empty symbols list means symbols were not enumerated; it does not mean the entry point has no exports. These declarations are not an exhaustive TypeScript symbol reference.

```json
[
  {
    "capabilityId": "package.lssm.tech.integration.provider.embedding",
    "from": "@lssm-tech/integration.provider-embedding",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.provider.embedding",
    "from": "@lssm-tech/integration.provider-embedding/embedding",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.provider.embedding",
    "from": "@lssm-tech/integration.provider-embedding/impls",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.provider.embedding",
    "from": "@lssm-tech/integration.provider-embedding/impls/embedding-usage",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.provider.embedding",
    "from": "@lssm-tech/integration.provider-embedding/impls/gateway-embedding",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.provider.embedding",
    "from": "@lssm-tech/integration.provider-embedding/impls/mistral-embedding",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.integration.provider.embedding",
    "from": "@lssm-tech/integration.provider-embedding/impls/openai-embedding",
    "symbols": []
  }
]
```

## Declared export entry points

Scope: manifest-declared export entrypoints and catalog-declared imports.

Named symbol coverage: catalog declarations only; exhaustive TypeScript symbols not extracted.

Installation status: not verified.

- `@lssm-tech/integration.provider-embedding` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding/src/index.ts); verified source file.

- `@lssm-tech/integration.provider-embedding/embedding` — subpath `./embedding`
  - `unconditional`: `./src/embedding.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding/src/embedding.ts); verified source file.

- `@lssm-tech/integration.provider-embedding/impls` — subpath `./impls`
  - `unconditional`: `./src/impls/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding/src/impls/index.ts); verified source file.

- `@lssm-tech/integration.provider-embedding/impls/embedding-usage` — subpath `./impls/embedding-usage`
  - `unconditional`: `./src/impls/embedding-usage.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding/src/impls/embedding-usage.ts); verified source file.

- `@lssm-tech/integration.provider-embedding/impls/gateway-embedding` — subpath `./impls/gateway-embedding`
  - `unconditional`: `./src/impls/gateway-embedding.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding/src/impls/gateway-embedding.ts); verified source file.

- `@lssm-tech/integration.provider-embedding/impls/mistral-embedding` — subpath `./impls/mistral-embedding`
  - `unconditional`: `./src/impls/mistral-embedding.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding/src/impls/mistral-embedding.ts); verified source file.

- `@lssm-tech/integration.provider-embedding/impls/openai-embedding` — subpath `./impls/openai-embedding`
  - `unconditional`: `./src/impls/openai-embedding.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/integrations/provider-embedding/src/impls/openai-embedding.ts); verified source file.

## Package publication metadata

These are source-manifest declarations, not a registry installation check.

```json
{
  "types": "./dist/index.d.ts",
  "files": [
    "dist",
    "README.md"
  ],
  "publishExports": {
    ".": {
      "types": "./dist/index.d.ts",
      "browser": "./dist/browser/index.js",
      "bun": "./dist/index.js",
      "node": "./dist/node/index.js",
      "default": "./dist/index.js"
    },
    "./embedding": {
      "types": "./dist/embedding.d.ts",
      "browser": "./dist/browser/embedding.js",
      "bun": "./dist/embedding.js",
      "node": "./dist/node/embedding.js",
      "default": "./dist/embedding.js"
    },
    "./impls": {
      "types": "./dist/impls/index.d.ts",
      "browser": "./dist/browser/impls/index.js",
      "bun": "./dist/impls/index.js",
      "node": "./dist/node/impls/index.js",
      "default": "./dist/impls/index.js"
    },
    "./impls/embedding-usage": {
      "types": "./dist/impls/embedding-usage.d.ts",
      "browser": "./dist/browser/impls/embedding-usage.js",
      "bun": "./dist/impls/embedding-usage.js",
      "node": "./dist/node/impls/embedding-usage.js",
      "default": "./dist/impls/embedding-usage.js"
    },
    "./impls/gateway-embedding": {
      "types": "./dist/impls/gateway-embedding.d.ts",
      "browser": "./dist/browser/impls/gateway-embedding.js",
      "bun": "./dist/impls/gateway-embedding.js",
      "node": "./dist/node/impls/gateway-embedding.js",
      "default": "./dist/impls/gateway-embedding.js"
    },
    "./impls/mistral-embedding": {
      "types": "./dist/impls/mistral-embedding.d.ts",
      "browser": "./dist/browser/impls/mistral-embedding.js",
      "bun": "./dist/impls/mistral-embedding.js",
      "node": "./dist/node/impls/mistral-embedding.js",
      "default": "./dist/impls/mistral-embedding.js"
    },
    "./impls/openai-embedding": {
      "types": "./dist/impls/openai-embedding.d.ts",
      "browser": "./dist/browser/impls/openai-embedding.js",
      "bun": "./dist/impls/openai-embedding.js",
      "node": "./dist/node/impls/openai-embedding.js",
      "default": "./dist/impls/openai-embedding.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/integration.runtime](https://lssm.co/docs/packages/integration.runtime/): `workspace:^`
- [@lssm-tech/lib.contracts-integrations](https://lssm.co/docs/packages/lib.contracts-integrations/): `workspace:^`

### Peer dependencies

No declarations in the inspected manifest.

### Optional dependencies

No declarations in the inspected manifest.

### Development dependencies

- [@lssm-tech/tool.bun](https://lssm.co/docs/packages/tool.bun/): `workspace:*`
- [@lssm-tech/tool.typescript](https://lssm.co/docs/packages/tool.typescript/): `workspace:*`
- `@mistralai/mistralai`: `^2.7.0`
- `@types/bun`: `catalog:types`
- `typescript`: `catalog:`

### Peer dependency metadata

```json
{}
```

### Bundled dependencies

```json
null
```

## Package scripts

Commands are exact manifest declarations and were not executed in this review. Script metadata status: complete pinned manifest.

```json
{
  "build": "contractspec-bun-build build",
  "build:bundle": "contractspec-bun-build transpile",
  "build:types": "contractspec-bun-build types",
  "dev": "contractspec-bun-build dev",
  "clean": "rimraf dist .turbo",
  "lint:check": "node ../../../scripts/biome.cjs check .",
  "lint:fix": "node ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .",
  "test": "bun test",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit"
}
```

## Declared documentation links

- [Integration Provider Embedding documentation](https://www.npmjs.com/package/%40lssm-tech%2Fintegration.provider-embedding) — declared link; destination not verified.

```json
{
  "url": "https://www.npmjs.com/package/%40lssm-tech%2Fintegration.provider-embedding",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/integration.provider-embedding.txt",
  "route": "/llms/integration.provider-embedding",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/integration.provider-embedding.txt",
  "blobSha": "bbc54219739d5ff1405b7152e2a2b6a99b21ed94",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
