llm_mcp/
llm-mcp.rs

1use blockless_sdk::*;
2
3/// This example demonstrates how to use the Blockless SDK to interact with two different LLM models
4/// and use MCP to call the tools.
5fn main() {
6    // large model
7    let mut llm = BlocklessLlm::new(Models::Custom(
8        "Llama-3.1-8B-Instruct-q4f16_1-MLC".to_string(),
9    ))
10    .unwrap();
11
12    // Assume we have two tools running on different ports
13    // 1. http://localhost:3001/sse - add
14    // 2. http://localhost:3002/sse - multiply
15    llm.set_options(LlmOptions::default().with_tools_sse_urls(vec![
16        "http://localhost:3001/sse".to_string(),
17        "http://localhost:3002/sse".to_string(),
18    ]))
19    .unwrap();
20
21    let response = llm
22        .chat_request("Add the following numbers: 1215, 2213")
23        .unwrap();
24    println!("llm Response: {}", response);
25
26    let response = llm.chat_request("Multiply 1215 by 2213").unwrap();
27    println!("llm Response: {}", response);
28}