chore: add #[non_exhaustive] and mutation methods to improve compatibility (#715)

* chore: add #[non_exhaustive] to reduce backwards-incompatible changes going forward

* fix: remove ProtocolVersion import

* fix: add a few more with_ mutator methods

---------

Co-authored-by: Alex Hancock <alexhancock@block.xyz>
This commit is contained in:
Jack Amadeo 2026-03-03 10:38:01 -05:00 • committed by GitHub
commit f63718d202
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,11 +40,11 @@ impl ClientHandler for SamplingDemoClient {
let response_text =
self.mock_llm_response(&params.messages, params.system_prompt.as_deref());
Ok(CreateMessageResult {
message: SamplingMessage::assistant_text(response_text),
model: "mock_llm".to_string(),
stop_reason: Some(CreateMessageResult::STOP_REASON_END_TURN.to_string()),
})
Ok(CreateMessageResult::new(
SamplingMessage::assistant_text(response_text),
"mock_llm".to_string(),
)
.with_stop_reason(Some(CreateMessageResult::STOP_REASON_END_TURN.to_string())))
}
}
@ -98,14 +98,11 @@ async fn main() -> Result<()> {
// Test the ask_llm tool
tracing::info!("Testing ask_llm tool...");
match client
.call_tool(CallToolRequestParams {
meta: None,
name: "ask_llm".into(),
arguments: Some(object!({
.call_tool(
CallToolRequestParams::new("ask_llm").with_arguments(object!({
"question": "Hello world"
})),
task: None,
})
)
.await
{
Ok(result) => tracing::info!("Ask LLM result: {result:#?}"),