|
|
|
@ -1,32 +1,302 @@
|
|
|
|
[
|
|
|
|
[
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"id": "GD-001",
|
|
|
|
"id": "GD-R-001",
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
"question": "What is AVAP and what is it designed for?",
|
|
|
|
"question": "What is AVAP and what is it designed for?",
|
|
|
|
"ground_truth": "AVAP (Advanced Virtual API Programming) is a Turing-complete Domain-Specific Language (DSL) architecturally designed for the secure, concurrent, and deterministic orchestration of microservices and HTTP I/O. It is not a general-purpose language; its hybrid engine and strict grammar are optimized for fast processing of HTTP transactions, in-memory data manipulation, and interaction with external connectors. AVAP does not have internal print commands — all data output is performed through the HTTP interface using commands like addResult()."
|
|
|
|
"ground_truth": "AVAP is a Turing-complete Domain-Specific Language (DSL) architecturally designed for the secure, concurrent, and deterministic orchestration of microservices and HTTP I/O. It is not a general-purpose language. Its hybrid engine and strict grammar are optimized for fast HTTP transaction processing, in-memory data manipulation, and interaction with external connectors. AVAP has no internal print commands — all data output is performed through the HTTP interface using addResult()."
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"id": "GD-002",
|
|
|
|
"id": "GD-R-002",
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
"question": "How does AVAP handle conditional logic? What commands are used and how are blocks closed?",
|
|
|
|
"question": "How does the if() conditional block work in AVAP? How are blocks closed?",
|
|
|
|
"ground_truth": "AVAP uses a mixed structural grammar for conditional logic, combining keyword fluidity with strict mathematical closures. The if() / else() / end() structure evaluates a logical or comparison expression. Every conditional block requires a mandatory end() closing statement. The if() command compares two values using a comparator operator (e.g., '==', '!=', '>', '<', '>=', '<='). An optional else() block handles the false branch. Example: if(saldo, 0, \">\") executes the true branch when the variable 'saldo' is greater than zero, otherwise the else() block runs, and end() closes the structure."
|
|
|
|
"ground_truth": "AVAP uses if() / else() / end() for conditional logic. The if() command evaluates a comparison between two values using a comparator operator (==, !=, >, <, >=, <=, in). Every conditional block must be closed with end(). The else() block is optional and handles the false branch. Example: if(saldo, 0, \">\") executes the true branch when saldo is greater than zero, otherwise the else() block runs, and end() closes the structure. AVAP also supports a mode 2 where a full Python-style expression is passed as a string: if(None, None, \"user_type == 'VIP' or compras > 100\")."
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"id": "GD-003",
|
|
|
|
"id": "GD-R-003",
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that reads a 'password' parameter, generates a SHA-256 hash of it, and returns the hash.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script reads a 'password' query parameter, hashes it using SHA-256 via encodeSHA256(), and exposes the result via addResult():\n\naddParam(\"password\", password)\nencodeSHA256(password, hashed_password)\naddResult(hashed_password)\n\nKey commands used:\n- addParam(\"password\", password): reads the 'password' HTTP parameter into the variable 'password'.\n- encodeSHA256(password, hashed_password): computes the SHA-256 hash of the input and stores the 64-character hex digest in 'hashed_password'.\n- addResult(hashed_password): adds 'hashed_password' to the HTTP JSON response body."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-004",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Show an AVAP script that loops from 1 to 5, builds a JSON object with each iteration index as a key, and returns it.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script iterates from 1 to 5 using startLoop/endLoop, dynamically builds a JSON object using AddvariableToJSON() on each iteration, and returns the result:\n\naddVar(mi_json, \"{}\")\nstartLoop(i, 1, 5)\n item = \"item_%s\" % i\n AddvariableToJSON(item, \"valor_generado\", mi_json)\nendLoop()\naddResult(mi_json)\n\nKey commands used:\n- addVar(mi_json, \"{}\"): initializes an empty JSON object.\n- startLoop(i, 1, 5) / endLoop(): iterates the variable 'i' from 1 to 5 inclusive.\n- AddvariableToJSON(item, \"valor_generado\", mi_json): inserts each generated key-value pair into the JSON object.\n- addResult(mi_json): exposes the final JSON in the HTTP response."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-005",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
"question": "How does AVAP support external HTTP calls? What commands are available and how is timeout handled?",
|
|
|
|
"question": "How does AVAP handle external HTTP calls? What commands are available and how is timeout managed?",
|
|
|
|
"ground_truth": "AVAP provides two commands for making external HTTP calls: RequestPost and RequestGet. To avoid blocking threads due to network latency, AVAP requires a mandatory timeout parameter (in milliseconds) for both commands. If the timeout is exceeded, the destination variable receives None. RequestPost(url, querystring, headers, body, destino, timeout) executes an HTTP POST and stores the response in 'destino'. RequestGet(url, querystring, headers, destino, timeout) executes an HTTP GET similarly. Both commands are part of AVAP's Section V (Third-Party Connectors and External HTTP Requests) and allow calling external APIs without additional drivers."
|
|
|
|
"ground_truth": "AVAP provides RequestGet and RequestPost for external HTTP calls. To avoid blocking threads due to network latency, AVAP requires a mandatory timeout parameter in milliseconds. If the timeout is exceeded, the destination variable receives None. RequestPost(url, querystring, headers, body, destino, timeout) executes an HTTP POST storing the response in destino. RequestGet(url, querystring, headers, destino, timeout) executes an HTTP GET. Both commands allow calling external APIs without additional drivers."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-004",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "How do functions work in AVAP? What is the scope of variables inside a function?",
|
|
|
|
|
|
|
|
"ground_truth": "Functions in AVAP are hermetic memory enclosures. When entering a function, AVAP creates a new dictionary of local variables isolated from the global context. The return() command acts as a flow switch: it injects the calculated value to the caller and releases local memory. If used inside a startLoop, it also breaks the iteration. Variables declared inside a function are only visible within that function — they are not accessible from the main flow or other functions. AVAP has three scope types: Global Scope, Main Local Scope, and Function Scope."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-005",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "What are the three types of variable scopes in AVAP and what are their visibility rules?",
|
|
|
|
|
|
|
|
"ground_truth": "AVAP uses three scope types: Global Scope contains globally declared variables, accessible from anywhere in the program and persists for the entire interpreter process lifetime. Main Local Scope contains variables declared in the main flow — accessible within the main flow but not from functions or goroutines, and disappears when script execution ends. Function Scope is created independently for each function invocation and contains function parameters and locally created variables — only visible within that function, not from outside, and is destroyed when the function terminates. If a variable does not exist in the visible scopes, the engine produces a runtime error."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-006",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "How does concurrency work in AVAP? What are goroutines and how are they launched?",
|
|
|
|
|
|
|
|
"ground_truth": "AVAP implements an advanced system based on lightweight threads (goroutines), allowing the server to process long I/O operations without blocking the main thread. The go command launches a goroutine: identifier = go function_name(parameters). It creates a new isolated execution context and returns a unique identifier. Goroutines follow the same scope rules as normal functions — they can access Global Scope and their own Function Scope, but cannot access the Main Local Scope. The gather command is used to collect results from goroutines."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-007",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "What is the addParam command and how does it capture HTTP request parameters?",
|
|
|
|
|
|
|
|
"ground_truth": "addParam captures input parameters from HTTP requests (URL query parameters, request body, or form data) and assigns them to a variable. Syntax: addParam(\"paramName\", targetVar). It reads the value of paramName from the incoming HTTP request and stores it in targetVar. If the parameter is not present in the request, the variable receives None. It is the primary mechanism for reading external input in AVAP since the language has no direct access to the request object."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-008",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "How does the startLoop / endLoop construct work in AVAP?",
|
|
|
|
|
|
|
|
"ground_truth": "startLoop and endLoop define iteration blocks in AVAP. Syntax: startLoop(varName, from, to) where varName is the loop counter, from is the start value, and to is the end value inclusive. The loop counter increments by 1 on each iteration. endLoop() closes the block. Example: startLoop(i, 1, 10) iterates i from 1 to 10. Variables modified inside the loop are accessible after endLoop. To exit a loop early, you can set the counter variable beyond the end value (e.g. i = 11 inside a loop that goes to 10)."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-009",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "What is the addResult command and how does it build the HTTP response?",
|
|
|
|
|
|
|
|
"ground_truth": "addResult adds a variable to the HTTP JSON response body. Syntax: addResult(varName). Each call to addResult adds one key-value pair to the response object where the key is the variable name and the value is its current value. AVAP has no internal print commands — addResult is the only way to expose data to the caller. Multiple addResult calls build up a JSON object with multiple fields. The HTTP status code is set separately via the _status variable."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-010",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "How does error handling work in AVAP with try() and exception()?",
|
|
|
|
|
|
|
|
"ground_truth": "AVAP uses try() / exception() / end() for error handling. The try() block wraps code that may fail. If an exception occurs inside the try block, execution jumps to the exception() block instead of halting. exception(errorVar) captures the error message into errorVar. The end() command closes the structure. Without a try block, any unhandled exception stops script execution and returns a 400 error. With a try block, you can handle the error gracefully — for example by setting _status to 500 and returning a structured error message."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-011",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "What is the replace() command in AVAP and how is it used?",
|
|
|
|
|
|
|
|
"ground_truth": "The replace() command performs string substitution in AVAP. Syntax: replace(sourceString, searchValue, replaceValue, targetVar). It replaces all occurrences of searchValue in sourceString with replaceValue and stores the result in targetVar. Example: replace(\"REF_1234_OLD\", \"OLD\", \"NEW\", ref_actualizada) stores \"REF_1234_NEW\" in ref_actualizada. The source can be a literal string or a variable name. The command does not modify the original variable — it always writes to targetVar."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-012",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "What are the reserved keywords in AVAP that cannot be used as identifiers?",
|
|
|
|
|
|
|
|
"ground_truth": "AVAP has the following reserved keywords that cannot be used as variable or function names: Control flow — if, else, end, startLoop, endLoop, try, exception, return. Function declaration — function. Concurrency — go, gather. Modularity — include, import. Logical operators — and, or, not, in, is. Literals — True, False, None. Using any of these as an identifier will cause a lexer or parser error."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-013",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "How does AVAP handle string formatting and concatenation?",
|
|
|
|
|
|
|
|
"ground_truth": "AVAP supports two main string operations. Concatenation uses the + operator: result = \"Hello, \" + name produces a concatenated string. String formatting uses Python-style % operator: log = \"Evento registrado por: %s\" % nombre substitutes the variable value into the format string. Strings support single and double quotes. Escape sequences supported include \\n (newline), \\t (tab), \\r (carriage return), \\\" (double quote), \\' (single quote), and \\\\ (backslash). Note that \\n inside a string is a data character, not a statement terminator — the physical EOL is the only statement terminator in AVAP."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-014",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "How does the encodeSHA256 command work in AVAP?",
|
|
|
|
|
|
|
|
"ground_truth": "encodeSHA256 computes the SHA-256 hash of an input value and stores the result in a destination variable. Syntax: encodeSHA256(inputValue, destVar). The result is a 64-character lowercase hexadecimal string representing the SHA-256 digest. Example: encodeSHA256(\"payload_data\", checksum) stores the hash of the string \"payload_data\" into the variable checksum. The input can be a string literal or a variable. It is commonly used for integrity verification, password hashing, and generating checksums."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-015",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "How does AVAP handle date and time operations?",
|
|
|
|
|
|
|
|
"ground_truth": "AVAP provides two date/time commands. getDateTime(format, offsetSeconds, timezone, destVar) gets the current date/time, optionally applying an offset in seconds and converting to the specified timezone. Example: getDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"Europe/Madrid\", sql_date) stores the current Madrid time formatted for SQL. getDateTime(\"\", 86400, \"UTC\", expira) gets the current UTC time plus 86400 seconds (1 day ahead), useful for expiration timestamps. stampToDatetime(unixTimestamp, format, offset, destVar) converts a Unix timestamp to a human-readable string. Example: stampToDatetime(1708726162, \"%d/%m/%Y\", 0, fecha_human)."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-016",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "What is the AddvariableToJSON command and how is it used to build JSON objects?",
|
|
|
|
|
|
|
|
"ground_truth": "AddvariableToJSON inserts a key-value pair into an existing JSON object variable. Syntax: AddvariableToJSON(key, value, jsonVar). The key can be a string literal or a variable. The value can be a string, number, or variable. The jsonVar must be an already-declared variable typically initialized as \"{}\" via addVar. Example: addVar(mi_json, \"{}\") then AddvariableToJSON(\"status\", \"ok\", mi_json) adds the key \"status\" with value \"ok\" to mi_json. It is commonly used inside loops to build dynamic JSON objects iteratively."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-017",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "How does the getListLen command work and what is it used for?",
|
|
|
|
|
|
|
|
"ground_truth": "getListLen retrieves the length of a list variable and stores it in a destination variable. Syntax: getListLen(listVar, destVar). Example: getListLen(registros, total) stores the number of elements in registros into total. It is commonly used before a startLoop to set the upper bound of iteration, enabling dynamic loops that adapt to the actual size of the data. Example pattern: getListLen(mi_lista, cantidad) followed by startLoop(i, 0, cantidad) to iterate over all elements."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-018",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "How does the randomString command work in AVAP?",
|
|
|
|
|
|
|
|
"ground_truth": "randomString generates a random string of a specified length using a character pattern. Syntax: randomString(pattern, length, destVar). The pattern is a regex-style character class defining which characters to use. Example: randomString(\"[A-Z]\\d\", 32, token_seguridad) generates a 32-character random string using uppercase letters and digits. Another example: randomString(\"[a-zA-Z0-9]\", 16, token) generates a 16-character alphanumeric token. It is commonly used for generating secure tokens, session identifiers, and temporary passwords."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-019",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "What is the $ dereference operator in AVAP and when is it used?",
|
|
|
|
|
|
|
|
"ground_truth": "The $ operator in AVAP is the dereference operator, used to access the value of a variable by reference at assignment time. Syntax: addVar(copia, $original) copies the current value of original into copia. The token is defined as DEREF in the lexer. It is used when you need to capture the current value of a variable into another variable, particularly useful when a variable may change later and you need to preserve its value at a specific point in execution."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-R-020",
|
|
|
|
|
|
|
|
"category": "RETRIEVAL",
|
|
|
|
|
|
|
|
"question": "How does AVAP handle ORM database operations? What commands are available?",
|
|
|
|
|
|
|
|
"ground_truth": "AVAP provides native ORM commands for database operations without requiring additional drivers. ormCheckTable(tableName, resultVar) checks if a table exists storing True or False in resultVar. ormCreateTable(columns, types, tableName, resultVar) creates a new table with the specified column names and types. ormDirect(query, resultVar) executes a raw SQL query directly. ormAccessSelect executes SELECT queries and ormAccessInsert executes INSERT operations. avapConnector is used to initialize the database connection. The connector and ORM commands are distinguished only by context — the UUID passed as argument determines whether the adapter resolves as a database ORM or a third-party service proxy."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-001",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that reads a 'name' parameter and returns a personalized greeting.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script reads a name parameter and returns a personalized greeting:\n\naddParam(\"name\", name)\nresult = \"Hello, \" + name\naddResult(result)\n\nKey commands: addParam reads the HTTP parameter 'name' into variable name. The + operator concatenates the greeting string with the name. addResult exposes result in the JSON response."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-002",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that reads a 'password' parameter, generates a SHA-256 hash, and returns it.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script hashes a password parameter using SHA-256:\n\naddParam(\"password\", password)\nencodeSHA256(password, hashed_password)\naddResult(hashed_password)\n\nKey commands: addParam reads the 'password' HTTP parameter. encodeSHA256 computes the SHA-256 hash and stores the 64-character hex digest in hashed_password. addResult exposes the hash in the JSON response."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-003",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that loops from 1 to 5, builds a JSON object with each index as a key, and returns it.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script builds a JSON object iteratively:\n\naddVar(mi_json, \"{}\")\nstartLoop(i, 1, 5)\n item = \"item_%s\" % i\n AddvariableToJSON(item, \"valor_generado\", mi_json)\nendLoop()\naddResult(mi_json)\n\nKey commands: addVar initializes an empty JSON object. startLoop iterates i from 1 to 5 inclusive. The % operator formats the key name dynamically. AddvariableToJSON inserts each key-value pair into mi_json. addResult exposes the final object."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-004",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that validates if a 'role' parameter belongs to a list of allowed roles and returns the access result.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script validates role membership:\n\naddParam(\"rol\", r)\nif(r, [\"admin\", \"editor\", \"root\"], \"in\")\n acceso = True\nelse()\n acceso = False\nend()\naddResult(acceso)\n\nKey commands: addParam reads the 'rol' parameter. The if() with \"in\" comparator checks list membership directly against a list literal. else() handles the false branch. end() closes the conditional block. addResult exposes the boolean result."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-005",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that makes a GET request to an external API and handles connection errors.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script performs a GET request with error handling:\n\ntry()\n RequestGet(\"https://api.test.com/data\", 0, 0, respuesta)\nexception(e)\n addVar(error_trace, \"Fallo de conexion: %s\" % e)\n addResult(error_trace)\nend()\naddResult(respuesta)\n\nKey commands: try() wraps the potentially failing operation. RequestGet fetches the URL storing the response in respuesta. exception(e) captures any error message. The % operator formats the error string. addResult exposes either the response or the error."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-006",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP function that takes two numbers and returns their sum, then call it and return the result.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script defines and calls a sum function:\n\nfunction suma(a, b){\n total = a + b\n return(total)\n}\nresultado = suma(10, 20)\naddResult(resultado)\n\nKey commands: function declares a named function with parameters a and b. The + operator adds the values. return() sends the result back to the caller and releases the function scope. The function is called with literal values 10 and 20. addResult exposes the result."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-007",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that reads a 'subtotal' parameter, computes 21% VAT, and returns the total.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script calculates the total with VAT:\n\naddParam(\"subtotal\", subtotal)\niva = subtotal * 0.21\ntotal = subtotal + iva\naddResult(total)\n\nKey commands: addParam reads the subtotal from the HTTP request. The * operator multiplies by the tax rate 0.21. The + operator adds subtotal and iva. addResult exposes the final total. AVAP supports float arithmetic natively."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-008",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that reads an 'api_key' parameter and returns status 403 if it is null.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script validates that an API key is present:\n\naddParam(\"api_key\", key)\nif(key, None, \"==\")\n addVar(_status, 403)\n addVar(error, \"Acceso denegado: falta API KEY\")\n addResult(error)\nend()\n\nKey commands: addParam reads the api_key parameter — if not present it will be None. The if() with \"==\" and None checks for null. addVar sets _status to 403 which becomes the HTTP response code. addResult exposes the error message."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-009",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that generates a 32-character random alphanumeric token and returns it.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script generates a secure random token:\n\nrandomString(\"[a-zA-Z0-9]\", 32, token_seguridad)\naddResult(token_seguridad)\n\nKey commands: randomString generates a random string using the character class [a-zA-Z0-9] at length 32 and stores it in token_seguridad. addResult exposes the token in the HTTP response."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-010",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that reads a 'lang' parameter and returns 'Hola' if it is 'es' or 'Hello' if it is 'en'.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script returns a greeting based on language:\n\naddParam(\"lang\", l)\nif(l, \"es\", \"=\")\n addVar(msg, \"Hola\")\nelse()\n addVar(msg, \"Hello\")\nend()\naddResult(msg)\n\nKey commands: addParam reads the lang parameter into l. The if() with \"=\" comparator checks string equality. else() handles all other cases. addVar sets the message. addResult exposes the localized greeting."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-011",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that checks if a database table exists and creates it if it does not.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script checks and creates a database table:\n\normCheckTable(tabla_pruebas, resultado_comprobacion)\nif(resultado_comprobacion, False, \"==\")\n ormCreateTable(\"username,age\", \"VARCHAR,INTEGER\", tabla_pruebas, resultado_creacion)\nend()\naddResult(resultado_comprobacion)\naddResult(resultado_creacion)\n\nKey commands: ormCheckTable checks if the table exists storing True or False. The if() block only executes if the check returned False. ormCreateTable creates the table with the specified columns and types. Both results are exposed via addResult."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-012",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that gets the current UTC timestamp and adds 24 hours to compute an expiration time.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script computes an expiration timestamp 24 hours from now:\n\ngetDateTime(\"\", 86400, \"UTC\", expira)\naddResult(expira)\n\nKey commands: getDateTime with an empty format string returns a raw timestamp. The second parameter 86400 is the offset in seconds (60 * 60 * 24 = 86400 = 1 day). The timezone is set to UTC. The result is stored in expira and exposed via addResult."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-013",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that receives a new password parameter, validates it is not equal to the old password, and returns a confirmation.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script validates a password change:\n\naddParam(\"password\", pass_nueva)\npass_antigua = \"password\"\nif(pass_nueva, pass_antigua, \"!=\")\n addVar(cambio, \"Contrasena actualizada\")\nend()\naddResult(cambio)\n\nKey commands: addParam reads the new password. The old password is assigned as a literal. The if() with \"!=\" comparator checks inequality. addVar sets the confirmation message only if passwords differ. addResult exposes the message."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-014",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that reads a list parameter and returns its element count.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script reads a list parameter and returns its length:\n\naddParam(\"data_list\", mi_lista)\ngetListLen(mi_lista, cantidad)\naddResult(cantidad)\n\nKey commands: addParam reads the list from the HTTP request into mi_lista. getListLen computes the number of elements and stores it in cantidad. addResult exposes the count in the JSON response."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-015",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that uses a validation function to check a token parameter and returns the authorization result.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script uses a function to validate a token:\n\nfunction es_valido(token){\n response = False\n if(token, \"SECRET\", \"=\")\n response = True\n end()\n return(response)\n}\naddParam(\"token\", t)\nautorizado = es_valido(t)\naddResult(autorizado)\n\nKey commands: function defines es_valido with a token parameter. response is initialized to False. The if() with \"=\" checks against the expected secret. return() sends the boolean back to the caller. addResult exposes the authorization result."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-016",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that returns two values in the HTTP response: a status code 200 and a message 'Success'.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script returns multiple values in the HTTP response:\n\naddVar(_status, 200)\naddVar(status, \"Success\")\naddResult(status)\n\nOr returning both as JSON fields:\n\naddVar(code, 200)\naddVar(status, \"Success\")\naddResult(code)\naddResult(status)\n\nKey commands: _status is the special variable that sets the HTTP response status code. Multiple addResult calls build a JSON object with multiple fields in the response body."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-017",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that reads a 'saldo' parameter and returns True if it is greater than zero, False otherwise.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script checks if a balance is positive:\n\naddParam(\"saldo\", saldo)\nif(saldo, 0, \">\")\n permitir = True\nelse()\n permitir = False\nend()\naddResult(permitir)\n\nKey commands: addParam reads the saldo parameter. The if() with \">\" comparator checks if saldo is greater than 0. else() handles the zero or negative case. end() closes the block. addResult exposes the boolean result."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-018",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that converts a Unix timestamp parameter to a human-readable date in dd/mm/yyyy format.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script converts a Unix timestamp to a readable date:\n\naddParam(\"timestamp\", ts)\nstampToDatetime(ts, \"%d/%m/%Y\", 0, fecha_human)\naddResult(fecha_human)\n\nKey commands: addParam reads the timestamp from the HTTP request. stampToDatetime converts the Unix epoch integer to a formatted date string using \"%d/%m/%Y\" which produces day/month/year. The third parameter is a timezone offset in seconds. The result is stored in fecha_human and returned via addResult."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-019",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that replaces all spaces in a string parameter with hyphens and returns the result.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script replaces spaces with hyphens:\n\naddParam(\"text\", input_text)\nreplace(input_text, \" \", \"-\", clean_text)\naddResult(clean_text)\n\nKey commands: addParam reads the text parameter. replace() substitutes all occurrences of space with hyphen in input_text and stores the result in clean_text. The original variable is not modified. addResult exposes the transformed string."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-C-020",
|
|
|
|
|
|
|
|
"category": "CODE_GENERATION",
|
|
|
|
|
|
|
|
"question": "Write an AVAP script that uses try/exception to execute a raw SQL query and return status 500 on database errors.",
|
|
|
|
|
|
|
|
"ground_truth": "The following AVAP script executes SQL with error handling:\n\ntry()\n ormDirect(\"UPDATE tabla SET col=1 WHERE id=1\", res)\nexception(e)\n addVar(_status, 500)\n addResult(\"Error de base de datos\")\nend()\naddResult(res)\n\nKey commands: try() wraps the database operation. ormDirect executes raw SQL storing the result in res. exception(e) catches any database error. addVar sets _status to 500 to signal a server error. The final addResult exposes the query result on success."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-V-001",
|
|
|
|
|
|
|
|
"category": "CONVERSATIONAL",
|
|
|
|
|
|
|
|
"question": "Can you summarize what you just explained about AVAP scopes in fewer words?",
|
|
|
|
|
|
|
|
"ground_truth": "AVAP has three scopes: Global (visible everywhere, lives for the whole process), Main Local (visible only in the main script flow, not inside functions), and Function (created per function call, destroyed when the function returns). Functions cannot see main flow variables, and the main flow cannot see function-internal variables."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-V-002",
|
|
|
|
|
|
|
|
"category": "CONVERSATIONAL",
|
|
|
|
|
|
|
|
"question": "You mentioned that addResult builds the JSON response — can you clarify how multiple addResult calls work together?",
|
|
|
|
|
|
|
|
"ground_truth": "Each addResult call adds one field to the JSON response object. The field name is the variable name passed to addResult and the field value is the current value of that variable. So calling addResult(code) and addResult(status) produces a JSON response like {\"code\": 200, \"status\": \"Success\"}. The fields are added in the order the addResult calls are executed during script execution."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-V-003",
|
|
|
|
|
|
|
|
"category": "CONVERSATIONAL",
|
|
|
|
|
|
|
|
"question": "What is the difference between addVar and a plain assignment like x = 10 in AVAP?",
|
|
|
|
|
|
|
|
"ground_truth": "Both addVar and direct assignment declare variables. addVar(varName, value) is the explicit command form — it supports intelligent value resolution checking if the value is an existing variable, a number, or a literal. Direct assignment x = 10 is syntactic sugar that works identically for simple cases. addVar is preferred for declaring new variables with explicit intent, while direct assignment is more natural for updating values or computed expressions."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-V-004",
|
|
|
|
|
|
|
|
"category": "CONVERSATIONAL",
|
|
|
|
|
|
|
|
"question": "Can you explain again the difference between the two modes of the if() command?",
|
|
|
|
|
|
|
|
"ground_truth": "Mode 1 is structured comparison: if(variable, value, comparator) — for example if(saldo, 0, \">\") directly compares the variable saldo against 0 using the > operator. Mode 2 is expression mode: if(None, None, \"expression\") — for example if(None, None, \"user_type == 'VIP' or compras > 100\") evaluates a full Python-style boolean expression passed as a string. Mode 2 is more flexible but requires passing None as the first two arguments."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-V-005",
|
|
|
|
|
|
|
|
"category": "CONVERSATIONAL",
|
|
|
|
|
|
|
|
"question": "What happens if an error occurs in AVAP without a try block?",
|
|
|
|
|
|
|
|
"ground_truth": "Without a try block, any unhandled exception stops script execution immediately and the server returns a 400 Bad Request error with the error message in the response body. The remaining commands in the script are not executed. With a try block, the error is caught by exception(), the script continues running, and you can handle the error gracefully — for example by setting _status to 500 and returning a structured error message."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-V-006",
|
|
|
|
|
|
|
|
"category": "CONVERSATIONAL",
|
|
|
|
|
|
|
|
"question": "Can you explain again how the timeout in RequestGet works?",
|
|
|
|
|
|
|
|
"ground_truth": "The timeout parameter in RequestGet and RequestPost is specified in milliseconds. If the external server does not respond within that time, the request is aborted and the destination variable receives None instead of a response. This prevents the AVAP thread from blocking indefinitely on a slow or unavailable external service. You should always check if the result variable is None after a request to handle timeout cases gracefully."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-V-007",
|
|
|
|
|
|
|
|
"category": "CONVERSATIONAL",
|
|
|
|
|
|
|
|
"question": "Can I iterate over a list of items in AVAP instead of a numeric range?",
|
|
|
|
|
|
|
|
"ground_truth": "Yes, but AVAP loops are always numeric — startLoop uses a start and end integer. To iterate over a list, combine getListLen to get the total count, use that count as the loop boundary, and inside the loop use the index variable to access each element. Example: getListLen(mi_lista, total) then startLoop(i, 0, total) with list access inside. Lists are zero-indexed so the index starts at 0."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-V-008",
|
|
|
|
|
|
|
|
"category": "CONVERSATIONAL",
|
|
|
|
|
|
|
|
"question": "What is the difference between RequestGet and RequestPost in practice?",
|
|
|
|
|
|
|
|
"ground_truth": "RequestGet sends an HTTP GET request — used for retrieving data, with parameters passed as query string. RequestPost sends an HTTP POST request — used for submitting data, with a body payload that can be JSON or form data. Both require a timeout parameter in milliseconds and store the response in a destination variable. Both return None in the destination variable if the request times out. The key structural difference is that RequestPost includes a body parameter while RequestGet does not."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-V-009",
|
|
|
|
|
|
|
|
"category": "CONVERSATIONAL",
|
|
|
|
|
|
|
|
"question": "Goroutines cannot access Main Local Scope — can you give a practical example of why that matters?",
|
|
|
|
|
|
|
|
"ground_truth": "If you declare a variable in the main flow and launch a goroutine, the goroutine cannot read that variable. For example if you do addVar(counter, 0) in the main flow and then call go myFunction(), the function myFunction cannot access counter — it would get a runtime error. To share data with goroutines you must either pass the value as a function parameter, or declare the variable in Global Scope. This isolation prevents race conditions between concurrent goroutines and the main flow."
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"id": "GD-V-010",
|
|
|
|
|
|
|
|
"category": "CONVERSATIONAL",
|
|
|
|
|
|
|
|
"question": "What format does encodeSHA256 return its output in?",
|
|
|
|
|
|
|
|
"ground_truth": "encodeSHA256 always returns a 64-character lowercase hexadecimal string. This is the standard SHA-256 digest representation — 256 bits expressed as 64 hex characters (0-9 and a-f). The output is deterministic — the same input always produces the same hash — which is why SHA-256 is used for integrity verification rather than for generating unique identifiers."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|