1.0.16 • Published 1 month ago
solver-aissistance-lib v1.0.16
SOLVER AISSISTANCE LIBRARY
Configuration file
Structure
The configuration file should have the structure shown below:
{
"saApikey": "XXXXXXXXXXXXXXXXXXXXXXXXX",
"logging": {
"level": "info"
}
}
Key | Description |
---|---|
saApikey | Solver AIssistance API key. This key is provided when purchasing the subscription. |
logging.level | Level for logging messages. It could be one of the following values: debug , info , warn , error , fatal . If not value is specified, the default value is info . |
Location
The default configuration file path and name is ./sa-config.json
. To change this location, use the SA_CONFIG_FILE
environment variable, like this:
export SA_CONFIG_FILE="/path/to/file/sa-config.json"
Question answering
import SolverAIssistanceConfigurationManager from "solver-aissistance-lib/configuration/solver-aissistance-configuration";
import SolverAI, { SolverAIResponse } from 'solver-aissistance-lib/solverai/solver-ai';
(async () => {
// Get API Key from configuration file
const apiKey = SolverAIssistanceConfigurationManager.getInstance().getConfiguration()?.saApikey;
const question:string = "What's the Percy's problem?";
const contextId:string = "AAAAA-AAAA-AAAA-AAAA-AAAAAAAA";
const solverAI:SolverAI = new SolverAI(apiKey as string);
const response:SolverAIResponse = await solverAI.answer(question, contextId);
console.log("Answer:", response.answer);
})();
Command line simple client
To use commnad line simple client:
npx solver-aissistance-lib