trustgraph/test-api/test-prompt2-api
Cyber MacGeddon 41d107c9e5 Remove cruft
2024-11-30 20:13:42 +00:00

38 lines
679 B
Python
Executable file

#!/usr/bin/env python3
import requests
import json
import sys
url = "http://localhost:8088/api/v1/"
############################################################################
input = {
"id": "extract-definitions",
"variables": {
"text": "A cat is a large mammal."
}
}
resp = requests.post(
f"{url}prompt",
json=input,
)
resp = resp.json()
if "error" in resp:
print(f"Error: {resp['error']}")
sys.exit(1)
if "object" in resp:
object = json.loads(resp["object"])
print(json.dumps(object, indent=4))
sys.exit(1)
print(resp["text"])
sys.exit(0)
############################################################################