import re # Definición de esquema para Calling Function ADD_DECIMAL_AND_HEXADECIMAL_FUNCTION_SCHEMA = [ { "name": "add_decimal_values", "description": "Add two decimal values", "parameters": { "type": "object", "properties": { "value1": { "type": "integer", "description": "The first decimal value to add. For example, 5", }, "value2": { "type": "integer", "description": "The second decimal value to add. For example, 10", }, }, "required": ["value1", "value2"], }, }, { "name": "add_hexadecimal_values", "description": "Add two hexadecimal values", "parameters": { "type": "object", "properties": { "value1": { "type": "string", "description": "The first hexadecimal value to add. For example, 5", }, "value2": { "type": "string", "description": "The second hexadecimal value to add. For example, A", }, }, "required": ["value1", "value2"], }, }, ] # Definición de las funciones def add_decimal_values(arguments): v1 = int(re.search(r'"value1": (\d+)', str(arguments)).group(1)) v2 = int(re.search(r'"value2": (\d+)', str(arguments)).group(1)) return v1 + v2 def add_hexadecimal_values(arguments): v1 = re.search(r'"value1": "(\w+)"', str(arguments)).group(1) v2 = re.search(r'"value2": "(\w+)"', str(arguments)).group(1) return hex(int(v1, 16) + int(v2, 16))[2:]