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

Function build_system_prompt

core/src/llm/structured.rs:952–973  ·  view source on GitHub ↗
(req: &StructuredRequest, mode: StructuredMode)

Source from the content-addressed store, hash-verified

950}
951
952fn build_system_prompt(req: &StructuredRequest, mode: StructuredMode) -> String {
953 let base = req.system.as_deref().unwrap_or("");
954
955 match mode {
956 StructuredMode::Tool => {
957 format!(
958 "{}{}You MUST respond by calling the `emit_{}` tool exactly once with a valid argument matching the schema. Do not output any text outside the tool call.",
959 base,
960 if base.is_empty() { "" } else { "\n\n" },
961 req.schema_name
962 )
963 }
964 StructuredMode::Prompt | StructuredMode::Json => {
965 format!(
966 "{}{}You are a structured data extraction assistant. Always respond with valid JSON only, no markdown fences, no explanation text.",
967 base,
968 if base.is_empty() { "" } else { "\n\n" },
969 )
970 }
971 _ => base.to_string(),
972 }
973}
974
975fn build_tools(req: &StructuredRequest, mode: StructuredMode) -> Vec<ToolDefinition> {
976 match mode {

Callers 2

generate_blockingFunction · 0.85
generate_streamingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected