File size: 462 Bytes
e8f281a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module.exports = class CustomAPIProvider {
  id() {
    return "custom-api"; // Ensure this method correctly returns the provider ID.
  }

  async callApi(prompt) {
    const response = await fetch("http://127.0.0.1:8000/ask", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ question: prompt }),
    });

    const data = await response.json();
    return { output: data.answer };
  }
};