| 790 | } |
| 791 | |
| 792 | fn extract_llm_tools( |
| 793 | node_config: &std::collections::HashMap<String, serde_json::Value>, |
| 794 | ) -> Vec<graphbit_core::llm::LlmTool> { |
| 795 | use graphbit_core::llm::LlmTool; |
| 796 | node_config |
| 797 | .get("tool_schemas") |
| 798 | .and_then(|v| v.as_array()) |
| 799 | .map(|schemas| { |
| 800 | schemas |
| 801 | .iter() |
| 802 | .filter_map(|schema| { |
| 803 | let name = schema.get("name")?.as_str()?; |
| 804 | let description = schema.get("description")?.as_str()?; |
| 805 | let parameters = schema.get("parameters")?; |
| 806 | Some(LlmTool::new(name, description, parameters.clone())) |
| 807 | }) |
| 808 | .collect::<Vec<LlmTool>>() |
| 809 | }) |
| 810 | .unwrap_or_default() |
| 811 | } |
| 812 | |
| 813 | fn extract_max_iterations( |
| 814 | node_config: &std::collections::HashMap<String, serde_json::Value>, |