RAG query works

This commit is contained in:
Cyber MacGeddon 2024-11-20 17:55:01 +00:00
parent 04a6059f33
commit a8b621f32e
5 changed files with 202 additions and 1 deletions

38
test-prompt-api Executable file
View file

@ -0,0 +1,38 @@
#!/usr/bin/env python3
import requests
import json
import sys
url = "http://localhost:8088/api/v1/"
############################################################################
input = {
"id": "question",
"variables": {
"question": "Write a joke about llamas."
}
}
resp = requests.post(
f"{url}prompt",
json=input,
)
resp = resp.json()
print(resp)
if "error" in resp:
print(f"Error: {resp['error']}")
sys.exit(1)
if "object" in resp:
print(f"Object: {resp['object']}")
sys.exit(1)
print(resp["text"])
sys.exit(0)
############################################################################