| 44 | } |
| 45 | |
| 46 | static json create_tools() { |
| 47 | json tools = json::array(); |
| 48 | |
| 49 | json tool_weather = { |
| 50 | { "type", "function" }, |
| 51 | { "function", |
| 52 | { |
| 53 | { "name", "get_current_weather" }, |
| 54 | { "description", "Get the current weather in a given location" }, |
| 55 | { "parameters", |
| 56 | { |
| 57 | { "type", "object" }, |
| 58 | { "properties", |
| 59 | { { "location", |
| 60 | { { "type", "string" }, { "description", "The city and state, e.g. San Francisco, CA" } } }, |
| 61 | { "unit", |
| 62 | { { "type", "string" }, |
| 63 | { "enum", { "celsius", "fahrenheit" } }, |
| 64 | { "description", |
| 65 | "The temperature unit to use. Infer this from the users location." } } } } }, |
| 66 | { "required", { "location", "unit" } }, |
| 67 | } }, |
| 68 | } } |
| 69 | }; |
| 70 | tools.push_back(tool_weather); |
| 71 | |
| 72 | json tool_forecast = { |
| 73 | { "type", "function" }, |
| 74 | { "function", |
| 75 | { |
| 76 | { "name", "get_forecast" }, |
| 77 | { "description", "Get the weather forecast for a given location" }, |
| 78 | { "parameters", |
| 79 | { |
| 80 | { "type", "object" }, |
| 81 | { "properties", |
| 82 | { { "location", |
| 83 | { { "type", "string" }, { "description", "The city and state, e.g. San Francisco, CA" } } }, |
| 84 | { "unit", |
| 85 | { { "type", "string" }, |
| 86 | { "enum", { "celsius", "fahrenheit" } }, |
| 87 | { "description", "The temperature unit to use. Infer this from the users location." } } }, |
| 88 | { "days", |
| 89 | { { "type", "integer" }, |
| 90 | { "description", "Number of days to forecast (1-10)" }, |
| 91 | { "minimum", 1 }, |
| 92 | { "maximum", 10 } } } } }, |
| 93 | { "required", { "location", "unit" } }, |
| 94 | } }, |
| 95 | } } |
| 96 | }; |
| 97 | tools.push_back(tool_forecast); |
| 98 | |
| 99 | json tool_search = { |
| 100 | { "type", "function" }, |
| 101 | { "function", |
| 102 | { { "name", "search_knowledge_base" }, |
| 103 | { "description", "Search the internal technical documentation knowledge base." }, |
no test coverage detected