Class: TableGeneratorService

TableGeneratorService()

The table generator module enables applications to extract numerical and statistical data from raw text in a tabular format. For use-cases where data has to be manually reviewed and cross-referenced, this module can bring enormous value.

Constructor

new TableGeneratorService()

Source:

Methods

call(user, text, table_formatopt, engineopt) → {Promise.<Object>}

Parameters:
Name Type Attributes Default Description
user string The ID of the user accessing the Soffos API. Soffos assumes that the owner of the api is an application (app) and that app has users. Soffos API will accept any string.
text string Text to extract tables from.
table_format string <optional>
"markdown" A string indicating the table output format. Formats supported: "markdown", "csv"
engine string <optional>
null The LLM engine to be used.
Source:
Returns:
tables - dictionary list
A list of dictionaries representing tables. Each dictionary contains the following fields:
title: A descriptive title for the table.
table: The table in a raw markdown or CSV formatted string.
note: Useful notes for table interpretation.
Type
Promise.<Object>
Example
import { SoffosServices } from "soffosai";

const my_apiKey = "Token <put your api key here>";
const service = new SoffosServices.TableGeneratorService({apiKey:my_apiKey});
let response = await service.call(
    "client 2345678",
    "Demographic and socioeconomic factors can contribute to community spread of COVID-19. \
    The aim of this study is to describe the demographics and socioeconomic factors in \
    relation to geolocation of COVID-19 patients who were discharged from the emergency \
    department (ED) back into the community...",
    "CSV"
);
console.log(JSON.stringify(response, null, 2));
    
// returns
// {
//     "tables": [
//       {
//         "title": "Demographics and Socioeconomic Factors of COVID-19 Patients Discharged from the Emergency Department",
//         "table": "Demographic Factor,Socioeconomic Factor,Geolocation\nAge,Income,Latitude\nGender,Education,Longitude\nRace/Ethnicity,Occupation,\nHousing,,\nTransportation,,\n",
//         "note": "The table captures the demographic factors (age, gender, race/ethnicity) and socioeconomic factors (income, education, occupation, housing, transportation, health insurance) related to the geolocation (latitude and longitude) of COVID-19 patients discharged from the 
//   emergency department."
//       }
//     ],
//     "cost": {
//       "api_call_cost": 0.005,
//       "character_volume_cost": 0.01535,
//       "total_cost": 0.02035
//     },
//     "charged_character_count": 307,
//     "unit_price": "0.000050"
// }

setInputConfigs(name, text, table_formatopt, engineopt)

Parameters:
Name Type Attributes Default Description
name string Reference name of this Service. It will be used by the Pipeline to reference this Service.
text string | InputConfig Text to extract tables from.
table_format string | InputConfig <optional>
'markdown' A string indicating the table output format. Formats supported: "CSV", 'markdown'
engine string <optional>
null The LLM engine to be used.
Source: