mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-06 21:35:13 +02:00
Revert "Feature/configure flows (#345)"
This reverts commit a9197d11ee.
This commit is contained in:
parent
3adb3cf59c
commit
1822ca395f
125 changed files with 2628 additions and 3751 deletions
|
|
@ -20,11 +20,7 @@ def output(text, prefix="> ", width=78):
|
|||
)
|
||||
print(out)
|
||||
|
||||
p = AgentClient(
|
||||
pulsar_host="pulsar://pulsar:6650",
|
||||
input_queue = "non-persistent://tg/request/agent:0000",
|
||||
output_queue = "non-persistent://tg/response/agent:0000",
|
||||
)
|
||||
p = AgentClient(pulsar_host="pulsar://localhost:6650")
|
||||
|
||||
q = "How many cats does Mark have? Calculate that number raised to 0.4 power. Is that number lower than the numeric part of the mission identifier of the Space Shuttle Challenger on its last mission? If so, give me an apple pie recipe, otherwise return a poem about cheese."
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,7 @@
|
|||
import pulsar
|
||||
from trustgraph.clients.document_rag_client import DocumentRagClient
|
||||
|
||||
rag = DocumentRagClient(
|
||||
pulsar_host="pulsar://localhost:6650",
|
||||
subscriber="test1",
|
||||
input_queue = "non-persistent://tg/request/document-rag:default",
|
||||
output_queue = "non-persistent://tg/response/document-rag:default",
|
||||
)
|
||||
rag = DocumentRagClient(pulsar_host="pulsar://localhost:6650")
|
||||
|
||||
query="""
|
||||
What was the cause of the space shuttle disaster?"""
|
||||
|
|
|
|||
|
|
@ -3,12 +3,7 @@
|
|||
import pulsar
|
||||
from trustgraph.clients.embeddings_client import EmbeddingsClient
|
||||
|
||||
embed = EmbeddingsClient(
|
||||
pulsar_host="pulsar://pulsar:6650",
|
||||
input_queue="non-persistent://tg/request/embeddings:default",
|
||||
output_queue="non-persistent://tg/response/embeddings:default",
|
||||
subscriber="test1",
|
||||
)
|
||||
embed = EmbeddingsClient(pulsar_host="pulsar://localhost:6650")
|
||||
|
||||
prompt="Write a funny limerick about a llama"
|
||||
|
||||
|
|
@ -16,3 +11,5 @@ resp = embed.request(prompt)
|
|||
|
||||
print(resp)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,18 +3,11 @@
|
|||
import pulsar
|
||||
from trustgraph.clients.graph_rag_client import GraphRagClient
|
||||
|
||||
rag = GraphRagClient(
|
||||
pulsar_host="pulsar://localhost:6650",
|
||||
subscriber="test1",
|
||||
input_queue = "non-persistent://tg/request/graph-rag:default",
|
||||
output_queue = "non-persistent://tg/response/graph-rag:default",
|
||||
)
|
||||
rag = GraphRagClient(pulsar_host="pulsar://localhost:6650")
|
||||
|
||||
#query="""
|
||||
#This knowledge graph describes the Space Shuttle disaster.
|
||||
#Present 20 facts which are present in the knowledge graph."""
|
||||
|
||||
query = "How many cats does Mark have?"
|
||||
query="""
|
||||
This knowledge graph describes the Space Shuttle disaster.
|
||||
Present 20 facts which are present in the knowledge graph."""
|
||||
|
||||
resp = rag.request(query)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,17 +3,14 @@
|
|||
import pulsar
|
||||
from trustgraph.clients.llm_client import LlmClient
|
||||
|
||||
llm = LlmClient(
|
||||
pulsar_host="pulsar://pulsar:6650",
|
||||
input_queue="non-persistent://tg/request/text-completion:default",
|
||||
output_queue="non-persistent://tg/response/text-completion:default",
|
||||
subscriber="test1",
|
||||
)
|
||||
llm = LlmClient(pulsar_host="pulsar://localhost:6650")
|
||||
|
||||
system = "You are a lovely assistant."
|
||||
prompt="what is 2 + 2 == 5"
|
||||
prompt="Write a funny limerick about a llama"
|
||||
|
||||
resp = llm.request(system, prompt)
|
||||
|
||||
print(resp)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,12 +3,7 @@
|
|||
import json
|
||||
from trustgraph.clients.prompt_client import PromptClient
|
||||
|
||||
p = PromptClient(
|
||||
pulsar_host="pulsar://localhost:6650",
|
||||
input_queue="non-persistent://tg/request/prompt:default",
|
||||
output_queue="non-persistent://tg/response/prompt:default",
|
||||
subscriber="test1",
|
||||
)
|
||||
p = PromptClient(pulsar_host="pulsar://localhost:6650")
|
||||
|
||||
chunk="""
|
||||
The Space Shuttle was a reusable spacecraft that transported astronauts and cargo to and from Earth's orbit. It was designed to launch like a rocket, maneuver in orbit like a spacecraft, and land like an airplane. The Space Shuttle was NASA's space transportation system and was used for many purposes, including:
|
||||
|
|
@ -36,8 +31,8 @@ The Space Shuttle's last mission was in 2011.
|
|||
q = "Tell me some facts in the knowledge graph"
|
||||
|
||||
resp = p.request(
|
||||
id="extract-definitions",
|
||||
variables = {
|
||||
id="extract-definition",
|
||||
terms = {
|
||||
"text": chunk,
|
||||
}
|
||||
)
|
||||
|
|
@ -45,7 +40,7 @@ resp = p.request(
|
|||
print(resp)
|
||||
|
||||
for fact in resp:
|
||||
print(fact["entity"], "::")
|
||||
print(fact["term"], "::")
|
||||
print(fact["definition"])
|
||||
print()
|
||||
|
||||
|
|
|
|||
|
|
@ -3,18 +3,13 @@
|
|||
import pulsar
|
||||
from trustgraph.clients.prompt_client import PromptClient
|
||||
|
||||
p = PromptClient(
|
||||
pulsar_host="pulsar://localhost:6650",
|
||||
input_queue="non-persistent://tg/request/prompt:default",
|
||||
output_queue="non-persistent://tg/response/prompt:default",
|
||||
subscriber="test1",
|
||||
)
|
||||
p = PromptClient(pulsar_host="pulsar://localhost:6650")
|
||||
|
||||
question = """What is the square root of 16?"""
|
||||
|
||||
resp = p.request(
|
||||
id="question",
|
||||
variables = {
|
||||
terms = {
|
||||
"question": question
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@
|
|||
import pulsar
|
||||
from trustgraph.clients.triples_query_client import TriplesQueryClient
|
||||
|
||||
tq = TriplesQueryClient(
|
||||
pulsar_host="pulsar://localhost:6650",
|
||||
)
|
||||
tq = TriplesQueryClient(pulsar_host="pulsar://localhost:6650")
|
||||
|
||||
e = "http://trustgraph.ai/e/shuttle"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue