feat: Anthropic provider/inbound + embeddings

- Anthropic outbound provider: /v1/messages, system extraction, x-api-key +
  anthropic-version; streaming translates Anthropic SSE -> unified OpenAI wire format
- Anthropic inbound adapter (POST /v1/messages): non-streaming JSON + streaming SSE
  (OpenAI -> Anthropic event translation)
- Embeddings: POST /v1/embeddings inbound + Provider::embed(); embedding models
  resolvable from the pool (registry no longer skips them)
- protocols mounted always, gated on live flags; admin meta marks them implemented
This commit is contained in:
infosave2007
2026-06-30 16:50:22 +03:00
parent 70d8cde258
commit bf8534f13d
9 changed files with 528 additions and 24 deletions
+9 -1
View File
@@ -57,5 +57,13 @@ pub trait Provider: Send + Sync {
)))
}
// TODO(v0.2): async fn embed(...) -> Result<EmbedResponse>.
/// Embeddings call. `input` is the OpenAI `input` field (string or array of
/// strings); returns the provider's OpenAI-style embeddings response body.
/// Default: not supported (override per provider).
async fn embed(&self, _input: serde_json::Value) -> crate::error::Result<serde_json::Value> {
Err(GatewayError::UpstreamUnavailable(format!(
"embeddings are not supported by provider '{}'",
self.id()
)))
}
}