trustgraph/test-api/test-prompt-api
cybermaggedon 92b84441eb
Feature/api gateway (#164)
* Bare bones API gateway
* Working for LLM + prompt
* RAG query works
* Triples query
* Added agent API
* Embeddings API
* Put API tests in a subdir
2024-11-20 19:55:40 +00:00

38 lines
645 B
Python
Executable file

#!/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)
############################################################################