Error Codes
API Errors
Error Code
Overview
Handling Errors
import fetch from 'node-fetch';
const payload = {
"search_query": "what are f-strings?",
"documents": [
"https://static.realpython.com/python-basics-sample-chapters.pdf",
"https://edu.anarcho-copy.org/Programming%20Languages/Python/Automate%20the%20Boring%20Stuff%20with%20Python.pdf"
]
};
async function gooeyAPI() {
const response = await fetch("https://api.gooey.ai/v2/doc-search", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env["GOOEY_API_KEY"],
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
if (!response.ok) {
throw new Error(response.status);
}
const result = await response.json();
console.log(response.status, result);
}
gooeyAPI();Last updated
Was this helpful?
