Hi,
I get the following error message when I try to use tuple validation in my JSON schema
Invalid schema for function 'save_address': In context=('properties', 'addresses'), array schema missing items
functions: [
{
name: "save_address",
parameters: {
type: "object",
properties: {
addresses: {
type: "array",
prefixItems: [
{ type: "number" },
{ type: "string" },
{ enum: ["Street", "Avenue", "Boulevard"] },
{ enum: ["NW", "NE", "SW", "SE"] },
],
},
},
},
},
],
Apparently items
is expected. Is prefixItems
not supported?
Best regards
dude ur trying are u trying to use an exsisting list or exstract the info from somewhere like heres an whitepages exsample
const axios = require(‘axios’);
const cheerio = require(‘cheerio’);
// Function to extract addresses from the HTML
function extractAddresses(html) {
const addresses = ;
const $ = cheerio.load(html);
// Find elements that contain addresses
$(‘address’).each((index, element) => {
const address = $(element).text().trim();
addresses.push(address);
});
return addresses;
}
// Make a GET request to the web page
const url = ‘https://www.whitepages.com’;
axios.get(url)
.then(response => {
const html = response.data;
// Extract addresses from the HTML
const addresses = extractAddresses(html);
// Print the extracted addresses
addresses.forEach(address => {
console.log(address);
});
})
.catch(error => {
console.log(‘Error retrieving page:’, error);
});
Sorry, no I’m not specifically interested in addresses. I just chose this because it’s what the JSON Schema docs have as an example for tuple validation.
u can ask the ai smartest thing around but gets confused idk what ur trying to do other than find the data on lol can be used for alot lmfao
Thank you, but this seems to only move the error into items
. I still get the error
array schema missing items
It seems like an “items” property is always expected for an “array” schema, even though the JSON Schema docs outlines the use of “prefixItems” for tuples.