Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions crates/libsy-protocol/src/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! The request/response envelope: the normalized [`LlmRequest`]/[`LlmResponse`] paired
//! with the original provider payload and correlation [`Metadata`].

use crate::{LlmRequest, LlmResponse, WireFormat};
use crate::{LlmRequest, LlmResponse, Metadata};
Comment thread
coderabbitai[bot] marked this conversation as resolved.
use std::collections::HashMap;

/// Per-request state threaded to an algorithm alongside a request. A placeholder
Expand All @@ -15,29 +15,6 @@ pub struct Context {
pub values: HashMap<String, String>,
}

/// Correlation and routing metadata attached to a request or response.
///
/// All fields are optional; algorithms and observers use whichever are present
/// (e.g. to key per-session state or emit correlated telemetry). `extra_metadata`
/// is a free-form escape hatch for host-specific keys.
#[derive(Clone)]
pub struct Metadata {
/// Stable id for a multi-request session/conversation.
pub session_id: Option<String>,
/// Id of the agent making the request.
pub agent_id: Option<String>,
/// Id of the task the request belongs to.
pub task_id: Option<String>,
/// External trace/request id for joining with the host's telemetry.
pub correlation_id: Option<String>,
/// Arbitrary host-defined key/value metadata.
pub extra_metadata: Option<std::collections::BTreeMap<String, String>>,
/// HTTP headers to attach when forwarding the request/response, if any.
pub http_headers: Option<std::collections::BTreeMap<String, String>>,
/// The wire format the request/response was originally encoded in, if known.
pub wire_format: Option<WireFormat>,
}

/// A request an algorithm routes: the normalized [`LlmRequest`] plus the original
/// provider payload and correlation [`Metadata`].
#[derive(Clone)]
Expand Down
2 changes: 2 additions & 0 deletions crates/libsy-protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ pub mod client;
pub mod envelope;
pub mod format;
pub mod llm;
pub mod metadata;
pub mod stream;

pub use client::*;
pub use envelope::*;
pub use format::*;
pub use llm::*;
pub use metadata::*;
pub use stream::*;

/// Build a single-turn request: one user message carrying `prompt`, for `model`.
Expand Down
Loading
Loading