Outline
Create a personalized outline of resources for a user.
HOST: https://ai.compasai.com/api/agtSSE /create_outline
Query Parameters
input_str
string
Topic + Proficiency + Materials + Hours e.g Python for Beginner. Videos & Slides only. 10 hours of content
required
library_id
int
ID of the library to create the outline from
required
key_topics
list
Hand picked key topics the learner wants to be in their outline.
optional
strict
boolean
Set to true if user only wants the key topics given above
optional
Response (SSE Events)
{
"type": "start",
"content": "outline",
"seconds": 0.01
}//Action: create_section
{
"type": "outline",
"content": {
"action": "create_section", //Add a new section in the outline
"label": "Generating Fundamentals of Cloud Computing Section Content…",
"section": 1,
"section_title": "Fundamentals of Cloud Computing",
"status": "loading",
"active": true
}
}
//Action: create_module
{
"type": "outline",
"content": {
"action": "create_module", // Add a new module in the section
"label": "Generating Introduction to Cloud Computing Benefits and Risks Module Content…",
"section": 1,
"module": 1,
"section_title": "Fundamentals of Cloud Computing",
"module_title": "Introduction to Cloud Computing Benefits and Risks",
"status": "loading"
},
"seconds": 0.47
}
//Action: create_lesson
{
"type": "outline",
"content": {
"action": "create_lesson", // Add a new lesson in the module
"content": {
"topic": "Cloud Computing Benefits Risks And Recommendations For",
"topic_id": "7a07",
"resource_id": 3,
"resource_type": "article",
"duration": "15:00",
"content": [
"abc"
]
}
},
"seconds": 0.44
}Sample
import EventSource from "eventsource";
const url = "https://ai.compasai.com/api/agt/create_outline";
const eventSource = new EventSource(url, {
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
});
eventSource.onmessage = (event) => {
console.log("Received raw:", event.data);
try {
const data = JSON.parse(event.data);
switch (data.type) {
case "start":
console.log("Stream started");
break;
case "outline":
console.log("Performing outline creation");
break;
case "complete":
console.log("All done!");
break;
default:
console.log("Unknown event type:", data.type);
}
} catch (err) {
console.log("Non-JSON event:", event.data);
}
};
eventSource.onerror = (error) => {
console.error("SSE error:", error);
eventSource.close();
};Last updated

