MCPcopy Create free account
hub / github.com/AI45Lab/Code / gen_content_block

Function gen_content_block

core/tests/test_persisted_schema_roundtrip.rs:232–253  ·  view source on GitHub ↗
(rng: &mut Rng)

Source from the content-addressed store, hash-verified

230}
231
232fn gen_content_block(rng: &mut Rng) -> ContentBlock {
233 match rng.below(4) {
234 0 => ContentBlock::Text { text: rng.string() },
235 1 => ContentBlock::Image {
236 source: gen_image_source(rng),
237 },
238 2 => ContentBlock::ToolUse {
239 id: rng.string(),
240 name: rng.string(),
241 input: rng.json_value(2),
242 },
243 _ => ContentBlock::ToolResult {
244 tool_use_id: rng.string(),
245 content: gen_tool_result_field(rng),
246 is_error: if rng.boolean() {
247 Some(rng.boolean())
248 } else {
249 None
250 },
251 },
252 }
253}
254
255fn gen_message(rng: &mut Rng) -> Message {
256 let roles = ["user", "assistant", "system", "tool"];

Callers 1

gen_messageFunction · 0.85

Calls 6

gen_image_sourceFunction · 0.85
gen_tool_result_fieldFunction · 0.85
belowMethod · 0.80
stringMethod · 0.80
json_valueMethod · 0.80
booleanMethod · 0.80

Tested by

no test coverage detected