Exposing more APIs

This commit is contained in:
Cyber MacGeddon 2025-04-29 23:28:48 +01:00
parent c03ba1e5e0
commit d059139da7
8 changed files with 19 additions and 20 deletions

View file

@ -4,7 +4,7 @@ import requests
import json import json
import sys import sys
url = "http://localhost:8088/api/v1/" url = "http://localhost:8088/api/v1/flow/0000/agent"
############################################################################ ############################################################################
@ -13,10 +13,11 @@ input = {
} }
resp = requests.post( resp = requests.post(
f"{url}agent", url,
json=input, json=input,
) )
print(resp.text)
resp = resp.json() resp = resp.json()
if "error" in resp: if "error" in resp:
@ -25,4 +26,3 @@ if "error" in resp:
print(resp["answer"]) print(resp["answer"])

View file

@ -4,7 +4,7 @@ import requests
import json import json
import sys import sys
url = "http://localhost:8088/api/v1/" url = "http://localhost:8088/api/v1/flow/0000/embeddings"
############################################################################ ############################################################################
@ -13,7 +13,7 @@ input = {
} }
resp = requests.post( resp = requests.post(
f"{url}embeddings", url,
json=input, json=input,
) )
@ -25,4 +25,3 @@ if "error" in resp:
print(resp["vectors"]) print(resp["vectors"])

View file

@ -4,7 +4,7 @@ import requests
import json import json
import sys import sys
url = "http://localhost:8088/api/v1/" url = "http://localhost:8088/api/v1/flow/0000/graph-rag"
############################################################################ ############################################################################
@ -13,7 +13,7 @@ input = {
} }
resp = requests.post( resp = requests.post(
f"{url}graph-rag", url,
json=input, json=input,
) )

View file

@ -4,7 +4,7 @@ import requests
import json import json
import sys import sys
url = "http://localhost:8088/api/v1/" url = "http://localhost:8088/api/v1/flow/0000/text-completion"
############################################################################ ############################################################################
@ -15,7 +15,7 @@ input = {
} }
resp = requests.post( resp = requests.post(
f"{url}text-completion", url,
json=input, json=input,
) )

View file

@ -4,7 +4,7 @@ import requests
import json import json
import sys import sys
url = "http://localhost:8088/api/v1/" url = "http://localhost:8088/api/v1/flow/0000/prompt"
############################################################################ ############################################################################
@ -16,7 +16,7 @@ input = {
} }
resp = requests.post( resp = requests.post(
f"{url}prompt", url,
json=input, json=input,
) )

View file

@ -4,7 +4,7 @@ import requests
import json import json
import sys import sys
url = "http://localhost:8088/api/v1/" url = "http://localhost:8088/api/v1/flow/0000/prompt"
############################################################################ ############################################################################
@ -16,7 +16,7 @@ input = {
} }
resp = requests.post( resp = requests.post(
f"{url}prompt", url,
json=input, json=input,
) )

View file

@ -9,7 +9,7 @@ from trustgraph.schema import Document, Metadata
client = pulsar.Client("pulsar://localhost:6650", listener_name="localhost") client = pulsar.Client("pulsar://localhost:6650", listener_name="localhost")
prod = client.create_producer( prod = client.create_producer(
topic="persistent://tg/flow/document-load:0000", topic="persistent://tg/flow/document-load:0002",
schema=JsonSchema(Document), schema=JsonSchema(Document),
chunking_enabled=True, chunking_enabled=True,
) )

View file

@ -34,11 +34,11 @@ from . text_completion import TextCompletionRequestor
from . prompt import PromptRequestor from . prompt import PromptRequestor
from . graph_rag import GraphRagRequestor from . graph_rag import GraphRagRequestor
#from . document_rag import DocumentRagRequestor #from . document_rag import DocumentRagRequestor
#from . triples_query import TriplesQueryRequestor from . triples_query import TriplesQueryRequestor
#from . graph_embeddings_query import GraphEmbeddingsQueryRequestor from . graph_embeddings_query import GraphEmbeddingsQueryRequestor
#from . embeddings import EmbeddingsRequestor from . embeddings import EmbeddingsRequestor
#from . encyclopedia import EncyclopediaRequestor #from . encyclopedia import EncyclopediaRequestor
#from . agent import AgentRequestor from . agent import AgentRequestor
#from . dbpedia import DbpediaRequestor #from . dbpedia import DbpediaRequestor
#from . internet_search import InternetSearchRequestor #from . internet_search import InternetSearchRequestor
#from . librarian import LibrarianRequestor #from . librarian import LibrarianRequestor
@ -321,7 +321,7 @@ class Api:
"prompt": PromptRequestor, "prompt": PromptRequestor,
"graph-rag": GraphRagRequestor, "graph-rag": GraphRagRequestor,
"embeddings": EmbeddingsRequestor, "embeddings": EmbeddingsRequestor,
"graph-embeddings": GraphEmbeddingsRequestor, "graph-embeddings": GraphEmbeddingsQueryRequestor,
"triples-query": TriplesQueryRequestor, "triples-query": TriplesQueryRequestor,
} }