mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-01 02:04:24 +00:00
Bump lithos-llm to 43a42ac and migrate catalogs to the codecs schema
Move the lithos-llm pin from 55add459 to 43a42ac28e9d9bcf40a91abc02be4f12ca274ebb, and the three Pebble pins from a39f43e to 67c9f48, Pebble `main`, which pins that same lithos-llm revision so Cargo holds one lithos-llm crate. lithos-llm `main` (ca19fac) is one commit further; that commit touches only its nightly workflow, so this pin stays on the revision Pebble unifies with. The `openai`, `anthropic`, `gemini`, and `openai-compatible` features are gone upstream; each expanded to `runtime`, which `bedrock` implies, so the four names leave the fabro-llm feature list. Every other manifest already names `runtime`. The catalog schema now names one adapter and many codecs per provider. `adapter` defaults to `http`, `codecs = [...]` replaces `codec` and defaults to `["openai-chat"]`, and the loader rejects the old `codec` key and the four protocol-named adapter ids. Every inline catalog in tests and docs moves to the new shape: the `openai-compatible` + `openai-chat` pair is dropped as the default, `adapter = "openai"` + `codec = "openai-responses"` becomes `codecs = ["openai-responses"]`, and the one test that swaps in a custom adapter id now adds the line instead of replacing one. The settings reference, the API schema's `Provider.adapter` description, and the SDK page describe the new fields; the three `docs/superpowers/plans/` files that show the old shape are dated, unchecked historical plans and are left as they are. The implied agent profile for an operator provider that declares none used to read the removed protocol adapter ids; it now reads the provider's first codec (Anthropic Messages and Gemini map to their harnesses, the `bedrock` adapter to Anthropic, everything else to OpenAI), with a test for the codec path. Absorbing the rest of the range: OpenRouter and Fireworks now ship enabled, so the two fabro-llm tests that used OpenRouter as the disabled fixture use `bedrock-openai`, and the docs and comments that said the two ship disabled are corrected. The built-in catalog grew past 100 enabled model rows (Vercel, TypeSafe, and the enabled OpenRouter and Fireworks rosters), so the pagination shape test walks `page[offset]` to the last page instead of assuming one page fits. `cargo update -p` on the four crates also re-resolved a few already-locked edges to match the lithos-llm lockfile: `windows-sys` 0.61.2/0.60.2 -> 0.59.0 under dirs-sys, errno, nu-ansi-term, quinn-udp, rustix, rustls-platform-verifier, tempfile, terminal_size, and winapi-util; `windows-core` 0.61.2 -> 0.62.2 under iana-time-zone; `errno` 0.2.8 -> 0.3.14 under signal-hook-registry; and `indexmap` 2.13.0 as a new public dependency of lithos-llm. No package version was added or removed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
22f46031f5
commit
3e065b806b
29 changed files with 112 additions and 108 deletions
31
Cargo.lock
generated
31
Cargo.lock
generated
|
|
@ -2063,7 +2063,7 @@ dependencies = [
|
|||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2190,7 +2190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4358,7 +4358,7 @@ dependencies = [
|
|||
"js-sys",
|
||||
"log",
|
||||
"wasm-bindgen",
|
||||
"windows-core 0.61.2",
|
||||
"windows-core 0.62.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4888,7 +4888,7 @@ checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
|
|||
[[package]]
|
||||
name = "lithos-llm"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/lithos-llm?rev=55add4596b861a0623d00c3a54aa5c147c8d504b#55add4596b861a0623d00c3a54aa5c147c8d504b"
|
||||
source = "git+https://github.com/lithoscomputer/lithos-llm?rev=43a42ac28e9d9bcf40a91abc02be4f12ca274ebb#43a42ac28e9d9bcf40a91abc02be4f12ca274ebb"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"aws-config",
|
||||
|
|
@ -4900,6 +4900,7 @@ dependencies = [
|
|||
"crc32fast",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
"indexmap 2.13.0",
|
||||
"mime_guess",
|
||||
"reqwest 0.13.4",
|
||||
"serde",
|
||||
|
|
@ -5304,7 +5305,7 @@ version = "0.50.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -5869,7 +5870,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pebble-agent"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/pebble?rev=a39f43e26effdf99635eaf343f095c17157c9c93#a39f43e26effdf99635eaf343f095c17157c9c93"
|
||||
source = "git+https://github.com/lithoscomputer/pebble?rev=67c9f486dd28f15c04e8d590a91e6f5563f7605d#67c9f486dd28f15c04e8d590a91e6f5563f7605d"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"futures-util",
|
||||
|
|
@ -5886,7 +5887,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pebble-cli-core"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/pebble?rev=a39f43e26effdf99635eaf343f095c17157c9c93#a39f43e26effdf99635eaf343f095c17157c9c93"
|
||||
source = "git+https://github.com/lithoscomputer/pebble?rev=67c9f486dd28f15c04e8d590a91e6f5563f7605d#67c9f486dd28f15c04e8d590a91e6f5563f7605d"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
|
@ -5915,7 +5916,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "pebble-coding-agent"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lithoscomputer/pebble?rev=a39f43e26effdf99635eaf343f095c17157c9c93#a39f43e26effdf99635eaf343f095c17157c9c93"
|
||||
source = "git+https://github.com/lithoscomputer/pebble?rev=67c9f486dd28f15c04e8d590a91e6f5563f7605d#67c9f486dd28f15c04e8d590a91e6f5563f7605d"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"futures-util",
|
||||
|
|
@ -6284,7 +6285,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"socket2",
|
||||
"tracing",
|
||||
"windows-sys 0.60.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -6761,7 +6762,7 @@ dependencies = [
|
|||
"errno 0.3.14",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -6820,7 +6821,7 @@ dependencies = [
|
|||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"webpki-root-certs",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -7467,7 +7468,7 @@ version = "1.4.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
|
||||
dependencies = [
|
||||
"errno 0.2.8",
|
||||
"errno 0.3.14",
|
||||
"libc",
|
||||
]
|
||||
|
||||
|
|
@ -8032,7 +8033,7 @@ dependencies = [
|
|||
"getrandom 0.4.1",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -8067,7 +8068,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874"
|
||||
dependencies = [
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -9134,7 +9135,7 @@ version = "0.1.11"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ insta = "1"
|
|||
fabro-test = { path = "lib/foundation/fabro-test" }
|
||||
# Provider-neutral LLM catalog and client. Pinned to a revision until 0.x is
|
||||
# published to crates.io.
|
||||
lithos-llm = { git = "https://github.com/lithoscomputer/lithos-llm", rev = "55add4596b861a0623d00c3a54aa5c147c8d504b", default-features = false }
|
||||
lithos-llm = { git = "https://github.com/lithoscomputer/lithos-llm", rev = "43a42ac28e9d9bcf40a91abc02be4f12ca274ebb", default-features = false }
|
||||
# Deterministic OpenAI twin used by twin-mode E2E tests; the same revision
|
||||
# lithos-llm verifies its codecs against.
|
||||
twin-openai = { git = "https://github.com/lithoscomputer/twins", rev = "ca45f0e50a6716d716aa2f638ca3cf767e88f613" }
|
||||
|
|
@ -124,9 +124,9 @@ sandbox-driver-testing = { git = "https://github.com/lithoscomputer/sandbox-driv
|
|||
# sandbox, so the pebble and sandbox-driver pins move independently. Pebble
|
||||
# pins the same lithos-llm rev as fabro, and its lockfile policy is that
|
||||
# every shared crate resolves to the version lithos-llm locks.
|
||||
pebble-agent = { git = "https://github.com/lithoscomputer/pebble", rev = "a39f43e26effdf99635eaf343f095c17157c9c93" }
|
||||
pebble-coding-agent = { git = "https://github.com/lithoscomputer/pebble", rev = "a39f43e26effdf99635eaf343f095c17157c9c93", features = ["mcp", "search-providers"] }
|
||||
pebble-cli-core = { git = "https://github.com/lithoscomputer/pebble", rev = "a39f43e26effdf99635eaf343f095c17157c9c93" }
|
||||
pebble-agent = { git = "https://github.com/lithoscomputer/pebble", rev = "67c9f486dd28f15c04e8d590a91e6f5563f7605d" }
|
||||
pebble-coding-agent = { git = "https://github.com/lithoscomputer/pebble", rev = "67c9f486dd28f15c04e8d590a91e6f5563f7605d", features = ["mcp", "search-providers"] }
|
||||
pebble-cli-core = { git = "https://github.com/lithoscomputer/pebble", rev = "67c9f486dd28f15c04e8d590a91e6f5563f7605d" }
|
||||
sentry = { version = "0.35", default-features = false, features = ["backtrace", "contexts", "ureq", "rustls"] }
|
||||
fork = "0.2"
|
||||
exec = "0.3"
|
||||
|
|
|
|||
|
|
@ -8417,8 +8417,8 @@ components:
|
|||
example: "Anthropic"
|
||||
adapter:
|
||||
type: string
|
||||
description: "lithos adapter id the provider speaks, such as `anthropic`, `openai`, `gemini`, or `openai-compatible`."
|
||||
example: "anthropic"
|
||||
description: "lithos adapter id the provider uses: `http` or `bedrock`, or a custom adapter's id."
|
||||
example: "http"
|
||||
base_url:
|
||||
type: string
|
||||
description: Effective API base URL, including any operator override.
|
||||
|
|
|
|||
|
|
@ -80,13 +80,11 @@ Claude Fable 5 is available as an explicit model but is not the default Anthropi
|
|||
|
||||
Fabro's catalog is the [lithos-llm](https://docs.rs/lithos-llm) built-in catalog. The `[llm]` table in settings is a second layer over it: a lithos catalog overlay that adds providers and models or changes existing entries. Later layers win. Tables merge key by key and every other value replaces. Models are nested under their provider, so two providers can expose the same model id without overwriting each other.
|
||||
|
||||
Provider and model facts use lithos field names: `adapter`, `codec`, `base_url`, `auth`, `enabled`, `limits`, `capabilities`, `pricing`, `small_default`, `probe`, `family`, and the cutoffs. The coding harness a model expects lives under `metadata.agent`, a namespace lithos ships and other agents such as Pebble read too. See [Settings Configuration](/reference/user-configuration#llm) for every key.
|
||||
Provider and model facts use lithos field names: `adapter`, `codecs`, `base_url`, `auth`, `enabled`, `limits`, `capabilities`, `pricing`, `small_default`, `probe`, `family`, and the cutoffs. The coding harness a model expects lives under `metadata.agent`, a namespace lithos ships and other agents such as Pebble read too. See [Settings Configuration](/reference/user-configuration#llm) for every key.
|
||||
|
||||
```toml title="settings.toml"
|
||||
[llm.providers.proxy]
|
||||
display_name = "Acme Gateway"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://llm-gateway.example.com/v1"
|
||||
auth = { type = "bearer" }
|
||||
aliases = ["gateway"]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ title: "Fireworks AI"
|
|||
description: "Run open-weights models on Fireworks AI's serverless inference platform"
|
||||
---
|
||||
|
||||
[Fireworks AI](https://fireworks.ai/) serves open-weights models (Kimi, DeepSeek, GLM, Qwen, GPT-OSS, and more) behind an OpenAI-compatible API. Fabro ships a disabled `fireworks` provider entry with a curated model catalog, so you can opt in from `settings.toml` without changing Fabro code.
|
||||
[Fireworks AI](https://fireworks.ai/) serves open-weights models (Kimi, DeepSeek, GLM, Qwen, GPT-OSS, and more) behind an OpenAI-compatible API. Fabro ships an enabled `fireworks` provider entry with a curated model catalog; it needs only an API key, and `settings.toml` can adjust it without changing Fabro code.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ title: "OpenRouter"
|
|||
description: "Route Fabro models through OpenRouter's multi-provider gateway"
|
||||
---
|
||||
|
||||
[OpenRouter](https://openrouter.ai/) is an aggregator that fronts hundreds of models behind one OpenAI-compatible API. Fabro ships a disabled `openrouter` provider entry with a curated model catalog, so you can opt in from `settings.toml` without changing Fabro code.
|
||||
[OpenRouter](https://openrouter.ai/) is an aggregator that fronts hundreds of models behind one OpenAI-compatible API. Fabro ships an enabled `openrouter` provider entry with a curated model catalog; it needs only an API key, and `settings.toml` can adjust it without changing Fabro code.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ let result = client.complete_with_context(request, context).await;
|
|||
|
||||
### Provider adapters
|
||||
|
||||
Providers are lithos adapters selected by the catalog `adapter` id: `anthropic`, `openai`, `gemini`, `openai-compatible`, and `bedrock`. A new OpenAI-compatible endpoint needs a catalog entry, not code.
|
||||
A provider names one lithos adapter in `adapter` (`http`, the default, or `bedrock`) and lists the wire codecs its host speaks in `codecs` (`openai-chat`, the default, `openai-responses`, `anthropic-messages`, `gemini-generate`, or `bedrock-converse`). A new OpenAI-compatible endpoint needs a catalog entry, not code.
|
||||
|
||||
To add a custom transport, implement the lithos `ProviderAdapter` trait and register it with `ClientOptions::with_adapter`. `fabro_llm::gateway::GatewayAdapter` is Fabro's own example: it posts each request to a Fabro server's completions endpoint, which returns lithos `Response` JSON and streams lithos `StreamEvent` JSON verbatim.
|
||||
|
||||
|
|
|
|||
|
|
@ -89,8 +89,6 @@ level = "info"
|
|||
|
||||
[llm.providers.proxy]
|
||||
display_name = "Acme Gateway"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://llm-gateway.example.com/v1"
|
||||
auth = { type = "bearer" }
|
||||
aliases = ["gateway"]
|
||||
|
|
@ -154,8 +152,6 @@ Several built-in providers ship with `enabled = false`. Turn one on by setting
|
|||
```toml title="settings.toml"
|
||||
[llm.providers.proxy]
|
||||
display_name = "Acme Gateway"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://llm-gateway.example.com/v1"
|
||||
auth = { type = "bearer" }
|
||||
priority = 50
|
||||
|
|
@ -195,11 +191,11 @@ Define or override an LLM provider. The keys are the lithos provider record.
|
|||
| Key | Type / values | Default | Description |
|
||||
|---|---|---|---|
|
||||
| `display_name` | string | required for new providers | Human-readable provider name. |
|
||||
| `adapter` | string | required for new providers | lithos adapter id: `anthropic`, `openai`, `gemini`, `openai-compatible`, or `bedrock`. |
|
||||
| `codec` | string | required for new providers | Wire codec: `anthropic-messages`, `openai-responses`, `openai-chat`, `gemini-generate`, or `bedrock-converse`. |
|
||||
| `base_url` | string | required for new providers | Provider API base URL. The `openai-compatible` adapter appends `/v1/chat/completions` unless the URL already ends in a version segment. |
|
||||
| `adapter` | string | `"http"` | lithos adapter id: `http` or `bedrock`. Any other id names a custom adapter the application registered. |
|
||||
| `codecs` | array<string> | `["openai-chat"]` | Wire codecs the host speaks, in preference order: `openai-chat`, `openai-responses`, `anthropic-messages`, `gemini-generate`, or `bedrock-converse`. A Chat Completions host needs no line. |
|
||||
| `base_url` | string | required for new providers | Provider API base URL. The `openai-chat` codec appends `/v1/chat/completions` unless the URL already ends in a version segment. |
|
||||
| `auth` | table | required for new providers | Auth scheme: `{ type = "bearer" }`, `{ type = "header", name = "x-api-key" }`, `{ type = "headers" }`, `{ type = "none" }`, or `{ type = "aws" }`. |
|
||||
| `enabled` | boolean | `true` | Set `false` to hide a provider from Fabro. `bedrock`, `bedrock-openai`, `fireworks`, `litellm`, `modal`, `ollama`, and `openrouter` ship disabled. |
|
||||
| `enabled` | boolean | `true` | Set `false` to hide a provider from Fabro. `bedrock`, `bedrock-openai`, `litellm`, `modal`, and `ollama` ship disabled. |
|
||||
| `priority` | integer | `0` | Higher-priority ready providers win unqualified model and default selection. |
|
||||
| `aliases` | array<string> | `[]` | Additional provider names accepted by model routing and fallback config. |
|
||||
| `default_model` | string | None | The provider's default model id. |
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ fn exec_accepts_configured_custom_provider_from_settings() {
|
|||
let context = test_context!();
|
||||
context.write_home(
|
||||
".fabro/settings.toml",
|
||||
"_version = 1\n\n[llm.providers.acme-aws]\ndisplay_name = \"Acme AWS\"\nadapter = \"openai-compatible\"\ncodec = \"openai-chat\"\nbase_url = \"https://bedrock.example.invalid/v1\"\nauth = { type = \"bearer\" }\nallow_passthrough = true\n\n[llm.providers.acme-aws.metadata.agent]\nprofile = \"openai\"\n\n[cli.exec.model]\nprovider = \"acme-aws\"\nname = \"acme-claude-sonnet-4-6\"\n",
|
||||
"_version = 1\n\n[llm.providers.acme-aws]\ndisplay_name = \"Acme AWS\"\nbase_url = \"https://bedrock.example.invalid/v1\"\nauth = { type = \"bearer\" }\nallow_passthrough = true\n\n[llm.providers.acme-aws.metadata.agent]\nprofile = \"openai\"\n\n[cli.exec.model]\nprovider = \"acme-aws\"\nname = \"acme-claude-sonnet-4-6\"\n",
|
||||
);
|
||||
|
||||
let mut cmd = context.exec_cmd();
|
||||
|
|
@ -398,7 +398,7 @@ fn exec_server_target_accepts_configured_custom_provider_from_settings() {
|
|||
let context = test_context!();
|
||||
context.write_home(
|
||||
".fabro/settings.toml",
|
||||
"_version = 1\n\n[llm.providers.acme-aws]\ndisplay_name = \"Acme AWS\"\nadapter = \"openai-compatible\"\ncodec = \"openai-chat\"\nbase_url = \"https://bedrock.example.invalid/v1\"\nauth = { type = \"bearer\" }\nallow_passthrough = true\n\n[llm.providers.acme-aws.metadata.agent]\nprofile = \"openai\"\n\n[cli.exec.model]\nprovider = \"acme-aws\"\nname = \"acme-claude-sonnet-4-6\"\n",
|
||||
"_version = 1\n\n[llm.providers.acme-aws]\ndisplay_name = \"Acme AWS\"\nbase_url = \"https://bedrock.example.invalid/v1\"\nauth = { type = \"bearer\" }\nallow_passthrough = true\n\n[llm.providers.acme-aws.metadata.agent]\nprofile = \"openai\"\n\n[cli.exec.model]\nprovider = \"acme-aws\"\nname = \"acme-claude-sonnet-4-6\"\n",
|
||||
);
|
||||
let server = MockServer::start();
|
||||
server.mock(|when, then| {
|
||||
|
|
|
|||
|
|
@ -3039,8 +3039,6 @@ digraph Demo {
|
|||
r#"
|
||||
[providers.acme]
|
||||
display_name = "Acme"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://api.acme.test/v1"
|
||||
auth = { type = "bearer" }
|
||||
default_model = "acme-large"
|
||||
|
|
|
|||
|
|
@ -1530,8 +1530,8 @@ mod tests {
|
|||
}
|
||||
|
||||
/// OpenAI and OpenRouter both offer `gpt-5.6-sol` under the `gpt-56-sol`
|
||||
/// alias; OpenRouter ships disabled, so enable it the way an operator
|
||||
/// would.
|
||||
/// alias; both ship enabled, and the overlay makes it the default on
|
||||
/// each.
|
||||
fn portable_session_catalog() -> Catalog {
|
||||
fabro_llm::test_support::test_catalog_with_overlay(
|
||||
r#"
|
||||
|
|
|
|||
|
|
@ -335,8 +335,6 @@ fn acme_overlay(base_url: &str) -> String {
|
|||
r#"
|
||||
[providers.acme]
|
||||
display_name = "Acme"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = {base_url}
|
||||
auth = {{ type = "bearer" }}
|
||||
priority = 120
|
||||
|
|
@ -8417,8 +8415,6 @@ async fn model_api_keeps_duplicate_ids_provider_scoped_and_selects_ready_priorit
|
|||
r#"
|
||||
[providers.direct]
|
||||
display_name = "Direct"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = {direct}
|
||||
auth = {{ type = "bearer" }}
|
||||
priority = 120
|
||||
|
|
@ -8436,8 +8432,6 @@ capabilities = {{ text = true }}
|
|||
|
||||
[providers.aggregator]
|
||||
display_name = "Aggregator"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = {aggregator}
|
||||
auth = {{ type = "bearer" }}
|
||||
priority = 110
|
||||
|
|
@ -8600,8 +8594,6 @@ async fn test_model_forwards_and_validates_reasoning_effort() {
|
|||
r#"
|
||||
[providers.acme]
|
||||
display_name = "Acme"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = {base_url}
|
||||
auth = {{ type = "bearer" }}
|
||||
priority = 120
|
||||
|
|
@ -9152,8 +9144,8 @@ async fn test_providers_registration_issue_returns_error_without_probe() {
|
|||
// An adapter lithos does not ship cannot be built, so the provider is
|
||||
// configured (it has a vault key) yet unavailable.
|
||||
let overlay = acme_overlay("https://api.acme.test/v1").replace(
|
||||
"adapter = \"openai-compatible\"",
|
||||
"adapter = \"not-an-adapter\"",
|
||||
"display_name = \"Acme\"",
|
||||
"display_name = \"Acme\"\nadapter = \"not-an-adapter\"",
|
||||
);
|
||||
let state = TestAppStateBuilder::new()
|
||||
.runtime_settings(default_test_server_settings(), RunLayer::default())
|
||||
|
|
@ -9226,8 +9218,7 @@ async fn test_providers_mixed_results_preserve_catalog_order_and_counts() {
|
|||
r#"
|
||||
[providers.zeta]
|
||||
display_name = "Zeta"
|
||||
adapter = "openai"
|
||||
codec = "openai-responses"
|
||||
codecs = ["openai-responses"]
|
||||
base_url = {base_url}
|
||||
auth = {{ type = "bearer" }}
|
||||
priority = 50
|
||||
|
|
@ -9242,8 +9233,7 @@ probe = true
|
|||
|
||||
[providers.alpha]
|
||||
display_name = "Alpha"
|
||||
adapter = "openai"
|
||||
codec = "openai-responses"
|
||||
codecs = ["openai-responses"]
|
||||
base_url = {base_url}
|
||||
auth = {{ type = "bearer" }}
|
||||
priority = 40
|
||||
|
|
|
|||
|
|
@ -72,16 +72,31 @@ async fn paginated_endpoints_return_correct_shape() {
|
|||
let app = fabro_server::test_support::build_test_router(state);
|
||||
|
||||
for ep in ENDPOINTS {
|
||||
// Large limit: paginated shape, has_more = false (all fixture items fit).
|
||||
// Using an explicit large limit instead of the server default so the test
|
||||
// stays robust when datasets (e.g. the built-in model catalog) grow.
|
||||
let json = get_json(app.clone(), &format!("{}?page[limit]=100", ep.path)).await;
|
||||
assert_paginated_shape(&json, ep.name);
|
||||
assert_eq!(
|
||||
json["meta"]["has_more"], false,
|
||||
"{}: large limit should have has_more=false",
|
||||
ep.name
|
||||
);
|
||||
// Walk the collection at the largest page the API allows: every page
|
||||
// has the paginated shape, and the last one reports has_more = false.
|
||||
// The built-in model catalog is larger than one page, so the walk
|
||||
// follows `page[offset]` rather than assuming one page fits.
|
||||
let mut offset = 0;
|
||||
loop {
|
||||
let json = get_json(
|
||||
app.clone(),
|
||||
&format!("{}?page[limit]=100&page[offset]={offset}", ep.path),
|
||||
)
|
||||
.await;
|
||||
assert_paginated_shape(&json, &format!("{} offset={offset}", ep.name));
|
||||
let page_len = json["data"].as_array().unwrap().len();
|
||||
assert!(page_len <= 100, "{}: page exceeded the limit", ep.name);
|
||||
if json["meta"]["has_more"] == false {
|
||||
break;
|
||||
}
|
||||
assert!(
|
||||
page_len == 100,
|
||||
"{}: has_more=true on a page shorter than the limit",
|
||||
ep.name
|
||||
);
|
||||
offset += page_len;
|
||||
assert!(offset < 10_000, "{}: has_more never turned false", ep.name);
|
||||
}
|
||||
|
||||
// limit=1: at most 1 item, has_more = true (all fixtures have >1 item)
|
||||
let json = get_json(app.clone(), &format!("{}?page[limit]=1", ep.path)).await;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ fabro-redact.workspace = true
|
|||
fabro-static.workspace = true
|
||||
fabro-types = { path = "../../foundation/fabro-types" }
|
||||
futures.workspace = true
|
||||
lithos-llm = { workspace = true, features = ["builtin-catalog", "openai", "anthropic", "gemini", "openai-compatible", "bedrock", "bedrock-aws", "local-files"] }
|
||||
lithos-llm = { workspace = true, features = ["builtin-catalog", "bedrock", "bedrock-aws", "local-files"] }
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
strum.workspace = true
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ use fabro_static::EnvVars;
|
|||
use fabro_types::AgentProfileKind;
|
||||
pub use lithos_llm::catalog::Offering;
|
||||
use lithos_llm::catalog::{
|
||||
Catalog, CatalogBuilder, CatalogError, CatalogModel, CatalogProvider, Metadata,
|
||||
Catalog, CatalogBuilder, CatalogError, CatalogModel, CatalogProvider, CodecId, Metadata,
|
||||
adapter_ids, codec_ids,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
|
||||
|
|
@ -101,11 +102,16 @@ fn implied_agent_profiles(catalog: &Catalog) -> String {
|
|||
}
|
||||
|
||||
/// The profile a provider's wire protocol implies, for a provider whose
|
||||
/// catalog entry does not name one.
|
||||
/// catalog entry does not name one. The protocol is the provider's first
|
||||
/// codec, the one the client sends a generation call on; the `bedrock`
|
||||
/// adapter speaks Converse to Anthropic-shaped models.
|
||||
fn adapter_agent_profile(provider: &CatalogProvider) -> AgentProfileKind {
|
||||
match provider.adapter().as_str() {
|
||||
"anthropic" | "bedrock" => AgentProfileKind::Anthropic,
|
||||
"gemini" => AgentProfileKind::Gemini,
|
||||
if provider.adapter().as_str() == adapter_ids::BEDROCK {
|
||||
return AgentProfileKind::Anthropic;
|
||||
}
|
||||
match provider.codecs().first().map(CodecId::as_str) {
|
||||
Some(codec_ids::ANTHROPIC_MESSAGES) => AgentProfileKind::Anthropic,
|
||||
Some(codec_ids::GEMINI_GENERATE) => AgentProfileKind::Gemini,
|
||||
_ => AgentProfileKind::OpenAi,
|
||||
}
|
||||
}
|
||||
|
|
@ -241,7 +247,7 @@ enabled = false
|
|||
Some(AgentProfileKind::OpenAi)
|
||||
);
|
||||
assert_eq!(
|
||||
agent_profile(&catalog, "openrouter", None),
|
||||
agent_profile(&catalog, "bedrock-openai", None),
|
||||
None,
|
||||
"disabled providers have no profile to offer"
|
||||
);
|
||||
|
|
@ -282,8 +288,6 @@ enabled = false
|
|||
r#"
|
||||
[providers.acme]
|
||||
display_name = "Acme"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://api.acme.test/v1"
|
||||
auth = { type = "bearer" }
|
||||
default_model = "acme-llama"
|
||||
|
|
@ -308,4 +312,27 @@ capabilities = { text = true, tools = true }
|
|||
Some(AgentProfileKind::OpenAi)
|
||||
);
|
||||
}
|
||||
|
||||
/// The implied profile follows the provider's first codec, so a host that
|
||||
/// speaks Anthropic Messages gets the Anthropic harness.
|
||||
#[test]
|
||||
fn the_implied_profile_follows_the_first_codec() {
|
||||
let overlay = LlmLayer(
|
||||
toml::from_str(
|
||||
r#"
|
||||
[providers.acme]
|
||||
display_name = "Acme"
|
||||
codecs = ["anthropic-messages"]
|
||||
base_url = "https://api.acme.test"
|
||||
auth = { type = "header", name = "x-api-key" }
|
||||
"#,
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
let catalog = build_catalog(&overlay, &|_| None).unwrap();
|
||||
assert_eq!(
|
||||
agent_profile(&catalog, "acme", None),
|
||||
Some(AgentProfileKind::Anthropic)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,12 +407,12 @@ mod tests {
|
|||
fn disabled_providers_are_not_selectable() {
|
||||
let catalog = test_catalog();
|
||||
assert!(matches!(
|
||||
select(&catalog, "gpt-5.4", None, &eligible(&["openrouter"])),
|
||||
select(&catalog, "gpt-5.4", None, &eligible(&["bedrock-openai"])),
|
||||
Err(ModelSelectionError::NoEligibleOffering { .. })
|
||||
));
|
||||
let enabled = test_catalog_with_overlay("[providers.openrouter]\nenabled = true\n");
|
||||
let entry = select(&enabled, "gpt-5.4", None, &eligible(&["openrouter"])).unwrap();
|
||||
assert_eq!(entry.provider.id(), &ProviderId::new("openrouter"));
|
||||
let enabled = test_catalog_with_overlay("[providers.bedrock-openai]\nenabled = true\n");
|
||||
let entry = select(&enabled, "gpt-5.4", None, &eligible(&["bedrock-openai"])).unwrap();
|
||||
assert_eq!(entry.provider.id(), &ProviderId::new("bedrock-openai"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -215,8 +215,6 @@ mod tests {
|
|||
r#"
|
||||
[providers.acme-venice]
|
||||
display_name = "Acme Venice"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://api.venice.ai/api/v1"
|
||||
auth = { type = "bearer" }
|
||||
default_model = "venice-large"
|
||||
|
|
|
|||
|
|
@ -286,8 +286,9 @@ mod tests {
|
|||
|
||||
use super::*;
|
||||
|
||||
/// Modal and OpenRouter ship disabled; enable them the way an operator
|
||||
/// would so their models become fallback targets.
|
||||
/// Modal ships disabled; enable it the way an operator would so its
|
||||
/// models become fallback targets. OpenRouter ships enabled; the line
|
||||
/// is kept so the overlay reads the same for both.
|
||||
fn enabled_fallback_catalog() -> Catalog {
|
||||
test_catalog_with_overlay(
|
||||
"[providers.modal]\nenabled = true\n\n[providers.openrouter]\nenabled = true\n",
|
||||
|
|
|
|||
|
|
@ -680,8 +680,6 @@ mod tests {
|
|||
r#"
|
||||
[providers.acme]
|
||||
display_name = "Acme"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://api.acme.test/v1"
|
||||
auth = { type = "bearer" }
|
||||
default_model = "acme-claude"
|
||||
|
|
@ -756,8 +754,6 @@ mod tests {
|
|||
r#"
|
||||
[providers.acme]
|
||||
display_name = "Acme"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://api.acme.test/v1"
|
||||
auth = { type = "bearer" }
|
||||
default_model = "acme-claude"
|
||||
|
|
|
|||
|
|
@ -1481,8 +1481,6 @@ mod tests {
|
|||
r#"
|
||||
[providers.acme]
|
||||
display_name = "Acme"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://api.acme.test/v1"
|
||||
auth = { type = "bearer" }
|
||||
default_model = "acme-claude"
|
||||
|
|
|
|||
|
|
@ -779,8 +779,6 @@ mod tests {
|
|||
r#"
|
||||
[providers.mock]
|
||||
display_name = "Mock"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "http://mock.invalid/v1"
|
||||
auth = { type = "bearer" }
|
||||
allow_passthrough = true
|
||||
|
|
|
|||
|
|
@ -167,8 +167,6 @@ mod tests {
|
|||
r#"
|
||||
[providers.acme-venice]
|
||||
display_name = "Acme Venice"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://api.venice.ai/api/v1"
|
||||
auth = { type = "bearer" }
|
||||
priority = 200
|
||||
|
|
|
|||
|
|
@ -2682,8 +2682,6 @@ async fn shared_thread_compaction_before_routing_audit_succeeds() {
|
|||
r#"
|
||||
[providers.compact]
|
||||
display_name = "Compact"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = {base_url}
|
||||
auth = {{ type = "bearer" }}
|
||||
default_model = "compact-model"
|
||||
|
|
|
|||
|
|
@ -133,8 +133,6 @@ fn provider_toml(name: &str, model: &str, base_url: &str, profile: &str) -> Stri
|
|||
r#"
|
||||
[providers.{name}]
|
||||
display_name = "{name}"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = {base_url}
|
||||
auth = {{ type = "bearer" }}
|
||||
default_model = "{model}"
|
||||
|
|
|
|||
|
|
@ -383,8 +383,6 @@ mod tests {
|
|||
r#"
|
||||
[providers.gateway]
|
||||
display_name = "Gateway"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://gateway.test/v1"
|
||||
auth = { type = "bearer" }
|
||||
default_headers = { "x-portkey-api-key" = "{{ secrets.PORTKEY_API_KEY }}", "x-portkey-config" = "@prod" }
|
||||
|
|
|
|||
|
|
@ -690,8 +690,6 @@ methods = ["dev-token"]
|
|||
|
||||
[llm.providers.acme]
|
||||
display_name = "Acme"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://api.acme.test/v1"
|
||||
auth = { type = "bearer" }
|
||||
enabled = true
|
||||
|
|
|
|||
|
|
@ -229,8 +229,6 @@ Several built-in providers ship with `enabled = false`. Turn one on by setting
|
|||
```toml title="settings.toml"
|
||||
[llm.providers.proxy]
|
||||
display_name = "Acme Gateway"
|
||||
adapter = "openai-compatible"
|
||||
codec = "openai-chat"
|
||||
base_url = "https://llm-gateway.example.com/v1"
|
||||
auth = { type = "bearer" }
|
||||
priority = 50
|
||||
|
|
@ -270,11 +268,11 @@ Define or override an LLM provider. The keys are the lithos provider record.
|
|||
| Key | Type / values | Default | Description |
|
||||
|---|---|---|---|
|
||||
| `display_name` | string | required for new providers | Human-readable provider name. |
|
||||
| `adapter` | string | required for new providers | lithos adapter id: `anthropic`, `openai`, `gemini`, `openai-compatible`, or `bedrock`. |
|
||||
| `codec` | string | required for new providers | Wire codec: `anthropic-messages`, `openai-responses`, `openai-chat`, `gemini-generate`, or `bedrock-converse`. |
|
||||
| `base_url` | string | required for new providers | Provider API base URL. The `openai-compatible` adapter appends `/v1/chat/completions` unless the URL already ends in a version segment. |
|
||||
| `adapter` | string | `"http"` | lithos adapter id: `http` or `bedrock`. Any other id names a custom adapter the application registered. |
|
||||
| `codecs` | array<string> | `["openai-chat"]` | Wire codecs the host speaks, in preference order: `openai-chat`, `openai-responses`, `anthropic-messages`, `gemini-generate`, or `bedrock-converse`. A Chat Completions host needs no line. |
|
||||
| `base_url` | string | required for new providers | Provider API base URL. The `openai-chat` codec appends `/v1/chat/completions` unless the URL already ends in a version segment. |
|
||||
| `auth` | table | required for new providers | Auth scheme: `{ type = "bearer" }`, `{ type = "header", name = "x-api-key" }`, `{ type = "headers" }`, `{ type = "none" }`, or `{ type = "aws" }`. |
|
||||
| `enabled` | boolean | `true` | Set `false` to hide a provider from Fabro. `bedrock`, `bedrock-openai`, `fireworks`, `litellm`, `modal`, `ollama`, and `openrouter` ship disabled. |
|
||||
| `enabled` | boolean | `true` | Set `false` to hide a provider from Fabro. `bedrock`, `bedrock-openai`, `litellm`, `modal`, and `ollama` ship disabled. |
|
||||
| `priority` | integer | `0` | Higher-priority ready providers win unqualified model and default selection. |
|
||||
| `aliases` | array<string> | `[]` | Additional provider names accepted by model routing and fallback config. |
|
||||
| `default_model` | string | None | The provider's default model id. |
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ pub struct Model {
|
|||
pub struct Provider {
|
||||
pub id: ProviderId,
|
||||
pub display_name: String,
|
||||
/// lithos adapter id, such as `openai` or `openai-compatible`.
|
||||
/// lithos adapter id: `http` or `bedrock`, or a custom adapter's id.
|
||||
pub adapter: String,
|
||||
pub base_url: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export interface Provider {
|
|||
*/
|
||||
'display_name': string;
|
||||
/**
|
||||
* lithos adapter id the provider speaks, such as `anthropic`, `openai`, `gemini`, or `openai-compatible`.
|
||||
* lithos adapter id the provider uses: `http` or `bedrock`, or a custom adapter's id.
|
||||
*/
|
||||
'adapter': string;
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue