Skip to main content

inferlab_protocol/
lib.rs

1mod wire;
2
3use schemars::generate::SchemaSettings;
4
5pub use wire::{
6    AdapterError, AdapterErrorCode, AdapterProtocol, AdapterRequest, AdapterResponse,
7    AdapterResult, BenchCaseInput, BenchClientRequest, BenchClientResult, BenchDefinitionInput,
8    BenchLoadInput, CaptureControlRequirement, CaptureTargetRequirement, ClientEndpointInput,
9    ClientStatus, EndpointAssignment, EndpointProtocol, EndpointRequirement, EvalClientRequest,
10    EvalClientResult, EvalDefinitionInput, HttpActionSpec, HttpMethod, HttpTargetRegistryReadiness,
11    IntegrationIdentity, KvTransferMechanism, LaunchFileDeclaration, Parallelism,
12    ParallelismAttention, ParallelismExperts, ParallelismOuter, PlanServeInput, PlanServeResult,
13    ProcessSpec, ProtocolVersion, PublicEndpointRequirement, RawArtifact, ReadinessProbe,
14    RenderInputDeclaration, RenderServeInput, RenderServeResult, RenderedServeProcess,
15    ServeModelInput, ServeProcessAllocation, ServeReplicaRequirement, ServeRoleInput,
16    ServeRoleKind, ServeRoleLink, ServeRoleResult, ServeTopology, SettingValue,
17    SuppliedRenderInput, TargetEndpointScheme,
18};
19
20pub const PROTOCOL_SCHEMA_ID: &str = "https://inferlab.dev/schema/adapter-protocol/v4";
21
22#[must_use]
23pub fn protocol_schema() -> schemars::Schema {
24    let mut schema = SchemaSettings::draft2020_12()
25        .for_deserialize()
26        .into_generator()
27        .into_root_schema_for::<AdapterProtocol>();
28    schema
29        .ensure_object()
30        .insert("$id".to_owned(), PROTOCOL_SCHEMA_ID.into());
31    schema
32}