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.
- Node
- Python
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);
});
import requests
import json
API_KEY = "API_KEY"
TENANT_ID = "TENANT_ID"
VAULT_ID = "VAULT"
def call_prompt_privacy(prompt, model="chatgpt_3_5"):
headers = {
"Content-Type": "application/json",
"api-key": API_KEY
}
data = {
"tenant_id": TENANT_ID,
"vault": VAULT_ID,
"model": model,
"prompts": [
{
"role": "system",
"content": "You 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
}
]
}
response = requests.post("https://apigateway.promptprivacy.com", headers=headers, json=data)
res = response.json()
if not res.get('success', False):
raise Exception(res.get('message', 'Unknown error'))
answer = res['response']['choices'][0]['message']
return answer
def main():
try:
response = call_prompt_privacy("Who are our ideal customers?")
print(response)
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
main()