Resources

Search the web for resources or add your resources.

HOST: https://ai.compasai.com/api/agt

SSE /get_resource

Query Parameters

input_str

string

Topic + Proficiency + Materials + Hours e.g Python for Beginner. Videos & Slides only. 10 hours of content

required

content

list

Links to custom resources you want AGT to process

optional

strict

boolean

Set to true if user only wants their content to be processed

optional

Response (SSE Events)

Event to listen to when the aggregator has started running
{
    "type": "start", 
    "content": "web_search", 
    "seconds": 0.01
}

Sample

import EventSource from "eventsource";

const url = "https://ai.compasai.com/api/agt/get_resource";

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 "web_search":
        console.log("Performing web search");
        break;

      case "resource_done":
        console.log("Resource fetch complete");
        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