mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-30 00:49:38 +02:00
Feature/configure flows (#345)
- Keeps processing in different flows separate so that data can go to different stores / collections etc. - Potentially supports different processing flows - Tidies the processing API with common base-classes for e.g. LLMs, and automatic configuration of 'clients' to use the right queue names in a flow
This commit is contained in:
parent
dc0ce1041b
commit
31328317fd
125 changed files with 3751 additions and 2628 deletions
|
|
@ -3,7 +3,12 @@
|
|||
import json
|
||||
from trustgraph.clients.prompt_client import PromptClient
|
||||
|
||||
p = PromptClient(pulsar_host="pulsar://localhost:6650")
|
||||
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",
|
||||
)
|
||||
|
||||
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:
|
||||
|
|
@ -31,8 +36,8 @@ The Space Shuttle's last mission was in 2011.
|
|||
q = "Tell me some facts in the knowledge graph"
|
||||
|
||||
resp = p.request(
|
||||
id="extract-definition",
|
||||
terms = {
|
||||
id="extract-definitions",
|
||||
variables = {
|
||||
"text": chunk,
|
||||
}
|
||||
)
|
||||
|
|
@ -40,7 +45,7 @@ resp = p.request(
|
|||
print(resp)
|
||||
|
||||
for fact in resp:
|
||||
print(fact["term"], "::")
|
||||
print(fact["entity"], "::")
|
||||
print(fact["definition"])
|
||||
print()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue