Skip to content

Instantly share code, notes, and snippets.

@revolunet
Last active March 17, 2025 01:11
Show Gist options
  • Save revolunet/a72db249efd68a416d1f99104f3ca451 to your computer and use it in GitHub Desktop.
Save revolunet/a72db249efd68a416d1f99104f3ca451 to your computer and use it in GitHub Desktop.
publicodes loop pseudo-code
// pseudo-code
const engine = new Publicode(rules);
const inputs = {}
while(engine.missingVariables.length) {
// get next question from publi.codes decision tree
// has question, schema...
const missing = engine.missingVariables[0];
// send question to the user in the chat UI
// process answer with LLM if needed
// cast answer to required missing.schema
const answer = await askUser(missing);
// store answer in inputs
inputs[answer.id] = answer
// update publi.codes model
engine.setSituation(inputs);
}
// display final result
display(engine.result)
{
"name": "Orange",
"siret": "38012986648625"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment