You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
valuesText.textContent+="Number of values in ".concat(bin.bin_name," bin: ").concat(values.length,". \n");
168
+
// Clear previous rows
169
+
while(table.rows.length>1){
170
+
table.deleteRow(1);
171
+
}
172
+
// Create data rows
173
+
values.forEach(function(item){
174
+
varrow=document.createElement('tr');
175
+
uniqueFields.forEach(function(col){
176
+
varcell=document.createElement('td');
177
+
cell.textContent=item[col]||'';// Handle missing data
178
+
row.appendChild(cell);
179
+
});
180
+
table.appendChild(row);
181
+
});
155
182
}
156
183
else{
157
184
valuesButton.textContent="Show Values for ".concat(bin.bin_name);
158
185
valuesText.style.display='none';
186
+
table.style.display='none';
159
187
valuesText.textContent='';
160
188
}
161
189
});
162
190
binButtonContainer.appendChild(valuesButton);
163
191
binButtonContainer.appendChild(valuesText);
192
+
binButtonContainer.appendChild(table);
164
193
binsContainer_1.appendChild(binButtonContainer);
165
194
});
166
195
// Display response - Modify according to your actual response format
@@ -251,7 +280,7 @@ function fetchOpenAI(apiKey, fieldValues, field) {
251
280
'OpenAI-Beta': 'assistants=v1'
252
281
},
253
282
body: JSON.stringify({
254
-
instructions: "Please analyze the uploaded dataset. For a field in the dataset, you will format all of it's binnings \n using the Vega-Lite predicate formatting. For a bin, a field must be provided along with one of \n the predicate properties: equal, lt (less than), lte (less than or equal), gt (greater than), \n gte (greater than or equal), range, or oneOf.\n \n For example, if we have:\n\n {\n \"field\": \"Displacement\",\n \"field_bins\": [\"Compact\", \"Mid-Size\", \"Full-Size\"]\n },\n \n You should output:\n \n { bins: [\n {\n \"bin_name\": \"Compact\",\n \"pred\": {\n \"field\": \"Displacement\",\n \"lte\": 100,\n \"reasoning\": [insert detailed reasoning for bin and its boundaries]\n }\n },\n {\n \"bin_name\": \"Mid-Size\",\n \"pred\": {\n \"field\": \"Displacement\",\n \"range\": [101, 150],\n \"reasoning\": [insert detailed reasoning for bin]\n }\n },\n {\n \"bin_name\": \"Full-Size\",\n \"pred\": {\n \"field\": \"Displacement\",\n \"gt\": 150,\n \"reasoning\": [insert detailed reasoning for bin]\n }\n }\n ]\n }\n\n Another example, if we have:\n\n {\n \"field\": \"car_origin\",\n \"field_bins\": [\"Japan\", \"USA\", \"France\"]\n },\n \n You should output:\n \n { bins: [\n {\n \"bin_name\": \"Japan\",\n \"pred\": {\n \"field\": \"car_origin\",\n \"oneOf\": [\"nissan\", \"lexus\"],\n \"reasoning\": [insert detailed reasoning for bin and its boundaries]\n }\n },\n {\n \"bin_name\": \"USA\",\n \"pred\": {\n \"field\": \"car_origin\",\n \"oneOf\": [\"ford\", \"ram\"],\n \"reasoning\": [insert detailed reasoning for bin]\n }\n },\n {\n \"bin_name\": \"France\",\n \"pred\": {\n \"field\": \"car_origin\",\n \"oneOf\": [\"renault\", \"citroen\"],\n \"reasoning\": [insert detailed reasoning for bin]\n }\n }\n ]\n }",
283
+
instructions: "Please analyze the uploaded dataset. For a field in the dataset, you will format all of it's binnings \n using the Vega-Lite predicate formatting. For a bin, a field must be provided along with one of \n the predicate properties: equal, lt (less than), lte (less than or equal), gt (greater than), \n gte (greater than or equal), range, or oneOf to describe what data for that field belong in that bin.\n \n For example, if we have:\n\n {\n \"field\": \"Displacement\",\n \"field_bins\": [\"Compact\", \"Mid-Size\", \"Full-Size\"]\n },\n \n You should output:\n \n { bins: [\n {\n \"bin_name\": \"Compact\",\n \"pred\": {\n \"field\": \"Displacement\",\n \"lte\": 100,\n \"reasoning\": [insert detailed reasoning for bin and its boundaries]\n }\n },\n {\n \"bin_name\": \"Mid-Size\",\n \"pred\": {\n \"field\": \"Displacement\",\n \"range\": [101, 150],\n \"reasoning\": [insert detailed reasoning for bin]\n }\n },\n {\n \"bin_name\": \"Full-Size\",\n \"pred\": {\n \"field\": \"Displacement\",\n \"gt\": 150,\n \"reasoning\": [insert detailed reasoning for bin]\n }\n }\n ]\n }\n\n Another example, if we have:\n\n {\n \"field\": \"car_origin\",\n \"field_bins\": [\"Japan\", \"USA\", \"France\"]\n },\n \n You should output:\n \n { bins: [\n {\n \"bin_name\": \"Japan\",\n \"pred\": {\n \"field\": \"car_origin\",\n \"oneOf\": [\"nissan\", \"lexus\"],\n \"reasoning\": [insert detailed reasoning for bin and its boundaries]\n }\n },\n {\n \"bin_name\": \"USA\",\n \"pred\": {\n \"field\": \"car_origin\",\n \"oneOf\": [\"ford\", \"ram\"],\n \"reasoning\": [insert detailed reasoning for bin]\n }\n },\n {\n \"bin_name\": \"France\",\n \"pred\": {\n \"field\": \"car_origin\",\n \"oneOf\": [\"renault\", \"citroen\"],\n \"reasoning\": [insert detailed reasoning for bin]\n }\n }\n ]\n }",
255
284
model: "gpt-4-1106-preview",
256
285
tools: [{"type": "retrieval"}],
257
286
// file_ids: [fileId]
@@ -284,7 +313,7 @@ function fetchOpenAI(apiKey, fieldValues, field) {
284
313
},
285
314
{
286
315
"role": "user",
287
-
"content": "Create a way of breaking down this data in a non-obvious way that includes the semantic meaning of the data with the following JSON format.\n {\n bins : [\n {\n bin_name: [insert bin name]\n \"pred\" : {insert predicate information}\n }\n ]\n }\n "
316
+
"content": "Create a way of breaking down this data in a non-obvious way that includes the semantic meaning of the data with the following JSON format.\n Make sure the predicate can map directly to the earlier values and that the JSON you output is a valid JSON.\n {\n bins : [\n {\n bin_name: [insert bin name]\n \"pred\" : {insert predicate information}\n }\n ]\n }\n "
288
317
}
289
318
]
290
319
}
@@ -384,8 +413,8 @@ function getDataValues(fileContent, pred) {
0 commit comments