Skip to content

Latest commit

 

History

History
64 lines (42 loc) · 2.69 KB

rust_api.md

File metadata and controls

64 lines (42 loc) · 2.69 KB

Rust API

Choose the crates your integration needs. The links below open generated Rust API documentation for the core library and its optional supporting components.

switchyard-libsy

Use libsy to construct the model pool, run built-in routing algorithms, implement a custom algorithm, or handle requested work through the Step stream.

Open the generated libsy API documentation

switchyard-protocol

Use protocol types for normalized conversations, response streams, routed LLM clients, decisions, metadata, and wire-format identifiers.

Open the generated protocol API documentation

switchyard-translation

Use translation to convert requests, responses, and streams between OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages formats.

Open the generated translation API documentation

switchyard-llm-client

Use the optional HTTP clients for LLM and decision calls, or the supplied execution helpers when your application does not drive the step stream itself.

Open the generated client API documentation

switchyard-runner

Use the optional runner to load TOML configuration, resolve named routes, and execute them inside a serving integration. See Runner and the configuration reference.

Open the generated runner API documentation

For field meanings and provider API mappings, use the LLM protocol reference or decision protocol reference.

Crate boundary

Use the Rust quickstart for compatible dependency versions. Mechanics of Libsy explains how these crates work together during a run.

Import algorithms and orchestration types from switchyard_libsy. Import requests, responses, metadata, decisions, and LLM client traits from switchyard_protocol. Keep both dependencies on compatible versions.

Add switchyard-translation when your application directly converts requests, responses, or streams between provider formats. Use a version compatible with your other Switchyard dependencies.

The runner and HTTP client are optional for direct libsy integration. Your host can construct the algorithm and execute the requested work itself. The demo server is a reference application around the runner; Python bindings expose the same routing core to Python applications.