(req: &StructuredRequest, mode: StructuredMode)
| 950 | } |
| 951 | |
| 952 | fn 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 | |
| 975 | fn build_tools(req: &StructuredRequest, mode: StructuredMode) -> Vec<ToolDefinition> { |
| 976 | match mode { |
no outgoing calls
no test coverage detected