Generate a course for a role, on approval
const url = 'http://127.0.0.1:8765/api/learning/pathways';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"role_text":"Director of AI enablement"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://127.0.0.1:8765/api/learning/pathways \ --header 'Content-Type: application/json' \ --data '{ "role_text": "Director of AI enablement" }'Generate a course for a role: ask first (the estimate), start the job on approval. Without approve: true the answer is status: "ask" and NOTHING is stored or started: estimate says what one course takes (calls: model calls on the user’s own model target, fetches: pages GigAI fetches from public documentation sites, minutes, tokens or null) and basis says where the numbers come from: none (no course generated here yet has a cost record: about 60 calls, 1300 fetches, 140 minutes) or history (sized from your last course(s): the average of the last up to 3 done courses generated here of their own recorded calls, fetches, minutes and tokens). caps is where one run of the job stops by itself (120 model calls, 1500 page fetches) and warning is the key of the warning to show before the approval (learning_higher_usage: this takes more of the user’s model usage than an assessment). With approve: true the request is stored (status queued), the job starts on a thread of the server and the answer is 202 with the GET /api/learning/pathways/{pathway_id} object; read that route to see how far it is. One course at a time per project: 409 learning_running while one is being generated. The job sends the model the typed role, requirement sentences from job postings stored on this computer and the course text as it is written; the lesson-writing calls (and only those) also get the lines of the master resume, contact lines removed, as the reference for what the user already knows: that is not an option. approve: true is Scout’s own approval: it does not replace the user’s choice. A course is generated by a job of the server (0.1.11.10): status then also reads interrupted (a job no live process runs any more: its process is gone, or it wrote no progress for 15 minutes; it is not stored, the record still says running). progress says how far the GENERATION is (never how far anybody read): step (the step under way, or null), steps in order (corpus, course, paths, render, audit, import; each pending | running | done | skipped | failed, with its times and detail, the last plain progress line), calls and fetches so far, the caps max_calls and max_fetches, and dropped: what was planned and is not in the course, each with what (lesson:<id>, module:<id>, path:<id>) and a reason code. progress is null for an imported course. error_code is the code of error (cancelled, cap_reached, too_little_verified, model_unavailable, model_authentication_required, audit_failed, …), else null. Ids, counts, codes and plain lines: never posting text, never resume text.
Request Bodyrequired
Section titled “Request Bodyrequired”object
True: store the request and start generating (202). Left out or false: only the estimate; nothing starts.
The role, as the user types it (one line, at most 200 characters; a job title, never a name or contact details).
Example
{ "role_text": "Director of AI enablement"}Responses
Section titled “Responses”Success.
object
Example
{ "caps": { "calls": 120, "fetches": 1500 }, "estimate": { "basis": "none", "calls": 60, "fetches": 1300, "minutes": 140, "tokens": null }, "role_text": "Director of AI enablement", "schema_version": "scout-learning-generate:1", "status": "ask", "warning": "learning_higher_usage"}Forbidden / forbidden_origin: loopback peer and Host 127.0.0.1:<port> or localhost:<port> only (Origin too on writes).
object
object
Examplegenerated
{ "error": { "allowed_keys": [ "example" ], "code": "example", "message": "example" }}Target_unavailable
object
object
Example
{ "error": { "code": "target_unavailable", "message": "..." }}Learning_running
object
object
Example
{ "error": { "code": "learning_running", "message": "..." }}Unsupported_media_type: writes need Content-Type: application/json.
object
object
Examplegenerated
{ "error": { "allowed_keys": [ "example" ], "code": "example", "message": "example" }}Invalid_value, wrong_type, unknown_key, personal_info_refused
object
object
Example
{ "error": { "code": "invalid_value", "message": "..." }}