using AIStudio.Models.Matching;
using AIStudio.Provider;
namespace AIStudio.Models.Hosting;
///
/// One place a model can be reached from, and what reaching it that way does to the answer.
///
///
/// This is the routing graph, written down instead of grown into the rules. The old code solved
/// gateways and resellers by having one vendor's rules call another's, which turned into mutual
/// recursion -- Mistral into the open weights, the open weights back into Anthropic, Google, and
/// OpenAI -- and nobody could say from reading it which way a name would travel.
///
/// A host does two things, and only these two. It unwraps a name until the model underneath is
/// visible, and it says what the transport takes away. Unwrapping is iterative on purpose, because
/// the wrappings stack: Hugging Face first drops the routing suffix, then the organization prefix.
/// A host which serves other people's models under their plain names unwraps nothing and only
/// trims the transport, which is the same mechanism rather than a special case.
///
public interface IModelHost
{
///
/// The provider this host answers for.
///
LLMProviders Provider { get; }
///
/// Where the statements about this host were read, and when.
///
ModelSource Source { get; }
///
/// Takes one wrapping off a name, if there is one.
///
///
/// Called again with whatever comes out, until it says no. A host which declares who built the
/// model saves the rules from having to guess it from the name.
///
/// The name as it arrived.
/// The name with one wrapping removed.
/// Who the wrapping says built the model, when it says so.
/// True, when a wrapping was removed.
bool TryUnwrap(in ModelId id, out ModelId inner, out ModelVendor? declaredVendor);
///
/// Takes away what this host cannot offer, whatever the model itself can do.
///
///
/// A provider reselling somebody else's model speaks its own dialect, not the vendor's: the
/// model may well be able to answer through a vendor specific API, but not here.
///
/// What the model can do.
/// What it can do through this host.
ModelProfile ApplyTransport(in ModelProfile profile);
}