Expand description
Dialect maps for Chat Completions, Messages, Responses, Gemini, and Converse.
Decode a vendor JSON body into IrRequest, then encode another wire.
Maps-only hosts set default-features = false.
use wiremux::{Wire, decode, parse_profile_str};
let src = br#"{"model":"gpt-4o","messages":[{"role":"user","content":"ping"}]}"#;
let (ir, _loss) = decode(Wire::ChatCompletions, src).unwrap();
assert_eq!(ir.model, "gpt-4o");
let profile = parse_profile_str(
"schema_version = 1\nid = \"example\"\nwire = \"messages\"\n",
)
.unwrap();
assert_eq!(profile.id, "example");Re-exports§
pub use ir::IrCache;pub use ir::IrDocumentSource;pub use ir::IrItem;pub use ir::IrPart;pub use ir::IrRequest;pub use ir::IrSampling;pub use ir::IrStreamEvent;pub use ir::IrTool;pub use ir::IrToolChoice;pub use ir::LossAction;pub use ir::LossEvent;pub use ir::LossReport;pub use ir::estimate_prompt_tokens;pub use map::MapError;pub use map::decode;pub use map::encode;pub use map::restore_same_wire_messages_tool_choice;pub use stream::EventStreamReader;pub use stream::MAX_CONTENT_BLOCK_INDEX;pub use stream::MAX_EVENTSTREAM_PENDING;pub use stream::MAX_SSE_PENDING;pub use stream::MAX_TOOL_CALL_INDEX;pub use stream::RawSse;pub use stream::SseFrameReader;pub use stream::StreamDecoder;pub use stream::StreamEncoder;pub use stream::ToolCallAssembler;pub use stream::decode_response;pub use stream::decode_response_with_loss;pub use stream::decode_stream_event;pub use stream::decode_stream_events;pub use stream::encode_eventstream_message;pub use stream::encode_response;pub use stream::encode_response_with_model;pub use stream::encode_stream_event;pub use stream::frame_is_terminal;pub use stream::stream_has_terminal;
Modules§
- cli
- Shared CLI helpers: profile flag, validate, login, status.
- ingest
- Turn a public vendor catalog into user-dir profile TOML.
- ir
- Item-centered IR and LossReport.
- map
- Bidirectional request encode/decode for the v1 dialects.
- proxy
- Optional local HTTP proxy: source dialect -> IR -> profile target.
- stream
- SSE encode/decode for the v1 dialects.
Structs§
- Load
Options - Catalog load inputs. Same-id layers merge field-wise (shipped < user dir < explicit file).
- Resolved
Profile - Fully resolved profile document (one
id).
Enums§
- Stream
Unknown Policy - How decode treats unrecognized SSE events.
- Tool
Type Policy - How encode treats unknown / namespaced tool types.
- Wire
- v1 wire dialects. Not a host registry name.
Constants§
- GROK_
CHAT_ PROXY_ CLIENT_ IDENTIFIER x-grok-client-identifierthis crate sends to the Grok chat proxy.- GROK_
CHAT_ PROXY_ CLIENT_ VERSION x-grok-client-versionforcli-chat-proxy.grok.com.- VERSION
- Crate version from Cargo.toml.
Functions§
- load_
profile - Load the profile whose document
idequalsid. - load_
profile_ for_ wire - Load a profile for a dialect wire.
- parse_
profile_ str - Parse a profile document from TOML or JSON text.