(tool_spec: HashMap<String, ToolSpec>)
| 963 | } |
| 964 | |
| 965 | pub fn format_tool_spec(tool_spec: HashMap<String, ToolSpec>) -> HashMap<ToolOrigin, Vec<Tool>> { |
| 966 | tool_spec |
| 967 | .into_values() |
| 968 | .fold(HashMap::<ToolOrigin, Vec<Tool>>::new(), |mut acc, v| { |
| 969 | let tool = Tool::ToolSpecification(ToolSpecification { |
| 970 | name: v.name, |
| 971 | description: v.description, |
| 972 | input_schema: v.input_schema.into(), |
| 973 | }); |
| 974 | acc.entry(v.tool_origin) |
| 975 | .and_modify(|tools| tools.push(tool.clone())) |
| 976 | .or_insert(vec![tool]); |
| 977 | acc |
| 978 | }) |
| 979 | } |
| 980 | |
| 981 | /// Represents a conversation state that can be converted into a [FigConversationState] (the type |
| 982 | /// used by the API client). Represents borrowed data, and reflects an exact [FigConversationState] |
no test coverage detected