mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
Flow API - update gateway (#357)
* Altered API to incorporate Flow IDs, refactored for dynamic start/stop of flows * Gateway: Split endpoint / dispatcher for maintainability
This commit is contained in:
parent
450f664b1b
commit
a70ae9793a
52 changed files with 1206 additions and 907 deletions
33
test-api/test-llm2-api
Executable file
33
test-api/test-llm2-api
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
|
||||
url = "http://localhost:8088/api/v1/"
|
||||
|
||||
############################################################################
|
||||
|
||||
input = {
|
||||
"system": "",
|
||||
"prompt": "Add 2 and 3"
|
||||
}
|
||||
|
||||
resp = requests.post(
|
||||
f"{url}text-completion",
|
||||
json=input,
|
||||
)
|
||||
|
||||
if resp.status_code != 200:
|
||||
raise RuntimeError(f"Status code: {resp.status_code}")
|
||||
|
||||
resp = resp.json()
|
||||
|
||||
if "error" in resp:
|
||||
print(f"Error: {resp['error']}")
|
||||
sys.exit(1)
|
||||
|
||||
print(resp["response"])
|
||||
|
||||
############################################################################
|
||||
|
||||
|
|
@ -5,7 +5,7 @@ import json
|
|||
import sys
|
||||
import base64
|
||||
|
||||
url = "http://localhost:8088/api/v1/"
|
||||
url = "http://localhost:8088/api/v1/flow/0000/document-load"
|
||||
|
||||
############################################################################
|
||||
|
||||
|
|
@ -88,10 +88,7 @@ input = {
|
|||
|
||||
}
|
||||
|
||||
resp = requests.post(
|
||||
f"{url}load/document",
|
||||
json=input,
|
||||
)
|
||||
resp = requests.post(url, json=input)
|
||||
|
||||
resp = resp.json()
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import json
|
|||
import sys
|
||||
import base64
|
||||
|
||||
url = "http://localhost:8088/api/v1/"
|
||||
url = "http://localhost:8088/api/v1/flow/0000/service/text-load"
|
||||
|
||||
############################################################################
|
||||
|
||||
|
|
@ -85,10 +85,7 @@ input = {
|
|||
|
||||
}
|
||||
|
||||
resp = requests.post(
|
||||
f"{url}load/text",
|
||||
json=input,
|
||||
)
|
||||
resp = requests.post(url, json=input)
|
||||
|
||||
resp = resp.json()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue