Files
s01e02/internal/domain/tools.go
2026-03-12 02:10:57 +01:00

133 lines
4.2 KiB
Go

package domain
// GetToolDefinitions returns tool definitions for function calling
func GetToolDefinitions() []Tool {
return []Tool{
{
Type: "function",
Function: FunctionDef{
Name: "get_location",
Description: "Gets the current location information for a person. Returns latitude and longitude coordinates.",
Parameters: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"name": map[string]interface{}{
"type": "string",
"description": "The first name of the person",
},
"surname": map[string]interface{}{
"type": "string",
"description": "The surname/last name of the person",
},
},
"required": []string{"name", "surname"},
},
},
},
{
Type: "function",
Function: FunctionDef{
Name: "get_access_level",
Description: "Gets the access level information for a person. Requires the person's birth year (only the year as integer, not full date). Returns access level data.",
Parameters: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"name": map[string]interface{}{
"type": "string",
"description": "The first name of the person",
},
"surname": map[string]interface{}{
"type": "string",
"description": "The surname/last name of the person",
},
"birth_year": map[string]interface{}{
"type": "integer",
"description": "The birth year of the person (only the year as integer, e.g., 1987, not full date)",
},
},
"required": []string{"name", "surname", "birth_year"},
},
},
},
{
Type: "function",
Function: FunctionDef{
Name: "get_power_plant_location",
Description: "Gets the geographical coordinates (latitude and longitude) of a power plant by its city name.",
Parameters: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"city_name": map[string]interface{}{
"type": "string",
"description": "The name of the city where the power plant is located",
},
},
"required": []string{"city_name"},
},
},
},
{
Type: "function",
Function: FunctionDef{
Name: "calculate_distance",
Description: "Calculates the distance in kilometers between two geographical points using the Haversine formula.",
Parameters: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"lat1": map[string]interface{}{
"type": "number",
"description": "Latitude of the first point",
},
"lon1": map[string]interface{}{
"type": "number",
"description": "Longitude of the first point",
},
"lat2": map[string]interface{}{
"type": "number",
"description": "Latitude of the second point",
},
"lon2": map[string]interface{}{
"type": "number",
"description": "Longitude of the second point",
},
},
"required": []string{"lat1", "lon1", "lat2", "lon2"},
},
},
},
{
Type: "function",
Function: FunctionDef{
Name: "find_nearest_point",
Description: "Finds the nearest point from a list of points to a reference point (e.g., power plant location). Returns the nearest point with its distance.",
Parameters: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"reference_lat": map[string]interface{}{
"type": "number",
"description": "Latitude of the reference point (e.g., power plant)",
},
"reference_lon": map[string]interface{}{
"type": "number",
"description": "Longitude of the reference point (e.g., power plant)",
},
"points": map[string]interface{}{
"type": "array",
"description": "Array of points to check, each point is [latitude, longitude]",
"items": map[string]interface{}{
"type": "array",
"items": map[string]interface{}{
"type": "number",
},
"minItems": 2,
"maxItems": 2,
},
},
},
"required": []string{"reference_lat", "reference_lon", "points"},
},
},
},
}
}