Skip to main content

Vault Q&A

Exposing your knowledge as a question and answer autonomous worker is as easy as providing the vault ID and passing in the right prompt configuration.

const API_KEY = "API_KEY";
const TENANT_ID = "TENANT_ID";
const VAULT_ID = "VAULT";

const callPromptPrivacy = async (prompt, model) => {
const call = await fetch("https://apigateway.promptprivacy.com", {
method: "POST",
headers: {
"Content-Type": "application/json",
"api-key": API_KEY,
},
body: JSON.stringify({
tenant_id: TENANT_ID,
vault: VAULT_ID,
model: model || "chatgpt_3_5",
prompts: [
{
role: "system",
content:
"Your are a Question and Answer Bot. You take a users question and answer it to the best of your ability. If you do not have enough data to answer, simply say so.",
},
{
role: "user",
content: prompt,
},
],
}),
});
const res = await call.json();
if (res.success === false) {
throw new Error(res.message);
}
const answer = res.response.choices[0].message;
return answer;
};

callPromptPrivacy("Who are our ideal customers?").then((res) => {
console.log(res);
});