trustgraph-base 0.14.17__tar.gz → 0.15.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/PKG-INFO +2 -2
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/base/base_processor.py +3 -2
- trustgraph-base-0.15.1/trustgraph/base_version.py +1 -0
- trustgraph-base-0.15.1/trustgraph/clients/agent_client.py +64 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/base.py +8 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/schema/__init__.py +1 -0
- trustgraph-base-0.15.1/trustgraph/schema/agent.py +37 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph_base.egg-info/PKG-INFO +2 -2
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph_base.egg-info/SOURCES.txt +2 -0
- trustgraph-base-0.14.17/trustgraph/base_version.py +0 -1
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/README.md +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/setup.cfg +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/setup.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/base/__init__.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/base/consumer.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/base/consumer_producer.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/base/producer.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/__init__.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/document_embeddings_client.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/document_rag_client.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/embeddings_client.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/graph_embeddings_client.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/graph_rag_client.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/llm_client.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/prompt_client.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/triples_query_client.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/exceptions.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/knowledge/__init__.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/knowledge/defs.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/knowledge/document.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/knowledge/identifier.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/knowledge/organization.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/knowledge/publication.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/log_level.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/objects/__init__.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/objects/field.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/objects/object.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/rdf.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/schema/documents.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/schema/graph.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/schema/metadata.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/schema/models.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/schema/object.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/schema/prompt.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/schema/retrieval.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/schema/topic.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/schema/types.py +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph_base.egg-info/dependency_links.txt +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph_base.egg-info/requires.txt +0 -0
- {trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph_base.egg-info/top_level.txt +0 -0
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: trustgraph-base
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.15.1
|
4
4
|
Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
|
5
5
|
Home-page: https://github.com/trustgraph-ai/trustgraph
|
6
6
|
Author: trustgraph.ai
|
7
7
|
Author-email: security@trustgraph.ai
|
8
8
|
License: UNKNOWN
|
9
|
-
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.
|
9
|
+
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.15.1.tar.gz
|
10
10
|
Platform: UNKNOWN
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
12
12
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.15.1"
|
@@ -0,0 +1,64 @@
|
|
1
|
+
|
2
|
+
import _pulsar
|
3
|
+
|
4
|
+
from .. schema import AgentRequest, AgentResponse
|
5
|
+
from .. schema import agent_request_queue
|
6
|
+
from .. schema import agent_response_queue
|
7
|
+
from . base import BaseClient
|
8
|
+
|
9
|
+
# Ugly
|
10
|
+
ERROR=_pulsar.LoggerLevel.Error
|
11
|
+
WARN=_pulsar.LoggerLevel.Warn
|
12
|
+
INFO=_pulsar.LoggerLevel.Info
|
13
|
+
DEBUG=_pulsar.LoggerLevel.Debug
|
14
|
+
|
15
|
+
class AgentClient(BaseClient):
|
16
|
+
|
17
|
+
def __init__(
|
18
|
+
self, log_level=ERROR,
|
19
|
+
subscriber=None,
|
20
|
+
input_queue=None,
|
21
|
+
output_queue=None,
|
22
|
+
pulsar_host="pulsar://pulsar:6650",
|
23
|
+
):
|
24
|
+
|
25
|
+
if input_queue is None: input_queue = agent_request_queue
|
26
|
+
if output_queue is None: output_queue = agent_response_queue
|
27
|
+
|
28
|
+
super(AgentClient, self).__init__(
|
29
|
+
log_level=log_level,
|
30
|
+
subscriber=subscriber,
|
31
|
+
input_queue=input_queue,
|
32
|
+
output_queue=output_queue,
|
33
|
+
pulsar_host=pulsar_host,
|
34
|
+
input_schema=AgentRequest,
|
35
|
+
output_schema=AgentResponse,
|
36
|
+
)
|
37
|
+
|
38
|
+
def request(
|
39
|
+
self,
|
40
|
+
question,
|
41
|
+
think=None,
|
42
|
+
observe=None,
|
43
|
+
timeout=300
|
44
|
+
):
|
45
|
+
|
46
|
+
def inspect(x):
|
47
|
+
|
48
|
+
if x.thought and think:
|
49
|
+
think(x.thought)
|
50
|
+
return
|
51
|
+
|
52
|
+
if x.observation and observe:
|
53
|
+
observe(x.observation)
|
54
|
+
return
|
55
|
+
|
56
|
+
if x.answer:
|
57
|
+
return True
|
58
|
+
|
59
|
+
return False
|
60
|
+
|
61
|
+
return self.call(
|
62
|
+
question=question, inspect=inspect, timeout=timeout
|
63
|
+
).answer
|
64
|
+
|
@@ -59,10 +59,14 @@ class BaseClient:
|
|
59
59
|
def call(self, **args):
|
60
60
|
|
61
61
|
timeout = args.get("timeout", DEFAULT_TIMEOUT)
|
62
|
+
inspect = args.get("inspect", lambda x: True)
|
62
63
|
|
63
64
|
if "timeout" in args:
|
64
65
|
del args["timeout"]
|
65
66
|
|
67
|
+
if "inspect" in args:
|
68
|
+
del args["inspect"]
|
69
|
+
|
66
70
|
id = str(uuid.uuid4())
|
67
71
|
|
68
72
|
r = self.input_schema(**args)
|
@@ -103,6 +107,10 @@ class BaseClient:
|
|
103
107
|
f"{value.error.type}: {value.error.message}"
|
104
108
|
)
|
105
109
|
|
110
|
+
complete = inspect(value)
|
111
|
+
|
112
|
+
if not complete: continue
|
113
|
+
|
106
114
|
resp = msg.value()
|
107
115
|
self.consumer.acknowledge(msg)
|
108
116
|
return resp
|
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
from pulsar.schema import Record, String, Array, Map
|
3
|
+
|
4
|
+
from . topic import topic
|
5
|
+
from . types import Error
|
6
|
+
|
7
|
+
############################################################################
|
8
|
+
|
9
|
+
# Prompt services, abstract the prompt generation
|
10
|
+
|
11
|
+
class AgentStep(Record):
|
12
|
+
thought = String()
|
13
|
+
action = String()
|
14
|
+
arguments = Map(String())
|
15
|
+
observation = String()
|
16
|
+
|
17
|
+
class AgentRequest(Record):
|
18
|
+
question = String()
|
19
|
+
plan = String()
|
20
|
+
state = String()
|
21
|
+
history = Array(AgentStep())
|
22
|
+
|
23
|
+
class AgentResponse(Record):
|
24
|
+
answer = String()
|
25
|
+
error = Error()
|
26
|
+
thought = String()
|
27
|
+
observation = String()
|
28
|
+
|
29
|
+
agent_request_queue = topic(
|
30
|
+
'agent', kind='non-persistent', namespace='request'
|
31
|
+
)
|
32
|
+
agent_response_queue = topic(
|
33
|
+
'agent', kind='non-persistent', namespace='response'
|
34
|
+
)
|
35
|
+
|
36
|
+
############################################################################
|
37
|
+
|
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: trustgraph-base
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.15.1
|
4
4
|
Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
|
5
5
|
Home-page: https://github.com/trustgraph-ai/trustgraph
|
6
6
|
Author: trustgraph.ai
|
7
7
|
Author-email: security@trustgraph.ai
|
8
8
|
License: UNKNOWN
|
9
|
-
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.
|
9
|
+
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.15.1.tar.gz
|
10
10
|
Platform: UNKNOWN
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
12
12
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
@@ -10,6 +10,7 @@ trustgraph/base/consumer.py
|
|
10
10
|
trustgraph/base/consumer_producer.py
|
11
11
|
trustgraph/base/producer.py
|
12
12
|
trustgraph/clients/__init__.py
|
13
|
+
trustgraph/clients/agent_client.py
|
13
14
|
trustgraph/clients/base.py
|
14
15
|
trustgraph/clients/document_embeddings_client.py
|
15
16
|
trustgraph/clients/document_rag_client.py
|
@@ -29,6 +30,7 @@ trustgraph/objects/__init__.py
|
|
29
30
|
trustgraph/objects/field.py
|
30
31
|
trustgraph/objects/object.py
|
31
32
|
trustgraph/schema/__init__.py
|
33
|
+
trustgraph/schema/agent.py
|
32
34
|
trustgraph/schema/documents.py
|
33
35
|
trustgraph/schema/graph.py
|
34
36
|
trustgraph/schema/metadata.py
|
@@ -1 +0,0 @@
|
|
1
|
-
__version__ = "0.14.17"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/document_embeddings_client.py
RENAMED
File without changes
|
{trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/document_rag_client.py
RENAMED
File without changes
|
File without changes
|
{trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/graph_embeddings_client.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph/clients/triples_query_client.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{trustgraph-base-0.14.17 → trustgraph-base-0.15.1}/trustgraph_base.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|