trustgraph-base 1.2.8__tar.gz → 1.2.9__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-1.2.8 → trustgraph_base-1.2.9}/PKG-INFO +1 -1
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/prompt_client.py +7 -0
- trustgraph_base-1.2.9/trustgraph/base_version.py +1 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/__init__.py +1 -1
- trustgraph_base-1.2.9/trustgraph/messaging/translators/primitives.py +140 -0
- trustgraph_base-1.2.9/trustgraph/schema/__init__.py +10 -0
- trustgraph_base-1.2.9/trustgraph/schema/core/__init__.py +3 -0
- {trustgraph_base-1.2.8/trustgraph/schema → trustgraph_base-1.2.9/trustgraph/schema/core}/metadata.py +1 -1
- trustgraph_base-1.2.8/trustgraph/schema/types.py → trustgraph_base-1.2.9/trustgraph/schema/core/primitives.py +5 -1
- trustgraph_base-1.2.9/trustgraph/schema/knowledge/__init__.py +8 -0
- trustgraph_base-1.2.9/trustgraph/schema/knowledge/document.py +29 -0
- trustgraph_base-1.2.8/trustgraph/schema/graph.py → trustgraph_base-1.2.9/trustgraph/schema/knowledge/embeddings.py +26 -41
- trustgraph_base-1.2.9/trustgraph/schema/knowledge/graph.py +28 -0
- {trustgraph_base-1.2.8/trustgraph/schema → trustgraph_base-1.2.9/trustgraph/schema/knowledge}/knowledge.py +6 -6
- trustgraph_base-1.2.9/trustgraph/schema/knowledge/nlp.py +26 -0
- trustgraph_base-1.2.9/trustgraph/schema/knowledge/object.py +17 -0
- trustgraph_base-1.2.9/trustgraph/schema/knowledge/rows.py +16 -0
- trustgraph_base-1.2.9/trustgraph/schema/knowledge/structured.py +17 -0
- trustgraph_base-1.2.9/trustgraph/schema/services/__init__.py +11 -0
- {trustgraph_base-1.2.8/trustgraph/schema → trustgraph_base-1.2.9/trustgraph/schema/services}/agent.py +2 -2
- {trustgraph_base-1.2.8/trustgraph/schema → trustgraph_base-1.2.9/trustgraph/schema/services}/config.py +2 -2
- trustgraph_base-1.2.8/trustgraph/schema/flows.py → trustgraph_base-1.2.9/trustgraph/schema/services/flow.py +2 -2
- {trustgraph_base-1.2.8/trustgraph/schema → trustgraph_base-1.2.9/trustgraph/schema/services}/library.py +4 -5
- trustgraph_base-1.2.8/trustgraph/schema/models.py → trustgraph_base-1.2.9/trustgraph/schema/services/llm.py +2 -2
- {trustgraph_base-1.2.8/trustgraph/schema → trustgraph_base-1.2.9/trustgraph/schema/services}/lookup.py +3 -3
- trustgraph_base-1.2.9/trustgraph/schema/services/nlp_query.py +22 -0
- {trustgraph_base-1.2.8/trustgraph/schema → trustgraph_base-1.2.9/trustgraph/schema/services}/prompt.py +4 -25
- trustgraph_base-1.2.9/trustgraph/schema/services/query.py +48 -0
- {trustgraph_base-1.2.8/trustgraph/schema → trustgraph_base-1.2.9/trustgraph/schema/services}/retrieval.py +2 -2
- trustgraph_base-1.2.9/trustgraph/schema/services/structured_query.py +20 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph_base.egg-info/PKG-INFO +1 -1
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph_base.egg-info/SOURCES.txt +25 -15
- trustgraph_base-1.2.8/trustgraph/base_version.py +0 -1
- trustgraph_base-1.2.8/trustgraph/messaging/translators/primitives.py +0 -47
- trustgraph_base-1.2.8/trustgraph/schema/__init__.py +0 -17
- trustgraph_base-1.2.8/trustgraph/schema/documents.py +0 -56
- trustgraph_base-1.2.8/trustgraph/schema/object.py +0 -31
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/README.md +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/pyproject.toml +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/setup.cfg +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/api/__init__.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/api/api.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/api/config.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/api/exceptions.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/api/flow.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/api/knowledge.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/api/library.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/api/types.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/__init__.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/agent_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/agent_service.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/async_processor.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/consumer.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/consumer_spec.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/document_embeddings_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/document_embeddings_query_service.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/document_embeddings_store_service.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/embeddings_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/embeddings_service.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/flow.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/flow_processor.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/graph_embeddings_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/graph_embeddings_query_service.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/graph_embeddings_store_service.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/graph_rag_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/llm_service.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/metrics.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/producer.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/producer_spec.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/publisher.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/pubsub.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/request_response_spec.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/setting_spec.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/spec.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/subscriber.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/subscriber_spec.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/text_completion_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/tool_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/tool_service.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/triples_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/triples_query_service.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/base/triples_store_service.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/__init__.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/agent_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/base.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/config_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/document_embeddings_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/document_rag_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/embeddings_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/graph_embeddings_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/graph_rag_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/llm_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/prompt_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/clients/triples_query_client.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/exceptions.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/knowledge/__init__.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/knowledge/defs.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/knowledge/document.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/knowledge/identifier.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/knowledge/organization.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/knowledge/publication.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/log_level.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/__init__.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/registry.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/agent.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/base.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/config.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/document_loading.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/embeddings.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/embeddings_query.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/flow.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/knowledge.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/library.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/metadata.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/prompt.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/retrieval.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/text_completion.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/tool.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/triples.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/objects/__init__.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/objects/field.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/objects/object.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/rdf.py +0 -0
- {trustgraph_base-1.2.8/trustgraph/schema → trustgraph_base-1.2.9/trustgraph/schema/core}/topic.py +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph_base.egg-info/dependency_links.txt +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph_base.egg-info/requires.txt +0 -0
- {trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph_base.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: trustgraph-base
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.9
|
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
|
Author-email: "trustgraph.ai" <security@trustgraph.ai>
|
6
6
|
Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
|
@@ -40,6 +40,13 @@ class PromptClient(RequestResponse):
|
|
40
40
|
timeout = timeout,
|
41
41
|
)
|
42
42
|
|
43
|
+
async def extract_objects(self, text, schema, timeout=600):
|
44
|
+
return await self.prompt(
|
45
|
+
id = "extract-rows",
|
46
|
+
variables = { "text": text, "schema": schema, },
|
47
|
+
timeout = timeout,
|
48
|
+
)
|
49
|
+
|
43
50
|
async def kg_prompt(self, query, kg, timeout=600):
|
44
51
|
return await self.prompt(
|
45
52
|
id = "kg-prompt",
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "1.2.9"
|
{trustgraph_base-1.2.8 → trustgraph_base-1.2.9}/trustgraph/messaging/translators/__init__.py
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
from .base import Translator, MessageTranslator
|
2
|
-
from .primitives import ValueTranslator, TripleTranslator, SubgraphTranslator
|
2
|
+
from .primitives import ValueTranslator, TripleTranslator, SubgraphTranslator, RowSchemaTranslator, FieldTranslator, row_schema_translator, field_translator
|
3
3
|
from .metadata import DocumentMetadataTranslator, ProcessingMetadataTranslator
|
4
4
|
from .agent import AgentRequestTranslator, AgentResponseTranslator
|
5
5
|
from .embeddings import EmbeddingsRequestTranslator, EmbeddingsResponseTranslator
|
@@ -0,0 +1,140 @@
|
|
1
|
+
from typing import Dict, Any, List
|
2
|
+
from ...schema import Value, Triple, RowSchema, Field
|
3
|
+
from .base import Translator
|
4
|
+
|
5
|
+
|
6
|
+
class ValueTranslator(Translator):
|
7
|
+
"""Translator for Value schema objects"""
|
8
|
+
|
9
|
+
def to_pulsar(self, data: Dict[str, Any]) -> Value:
|
10
|
+
return Value(value=data["v"], is_uri=data["e"])
|
11
|
+
|
12
|
+
def from_pulsar(self, obj: Value) -> Dict[str, Any]:
|
13
|
+
return {"v": obj.value, "e": obj.is_uri}
|
14
|
+
|
15
|
+
|
16
|
+
class TripleTranslator(Translator):
|
17
|
+
"""Translator for Triple schema objects"""
|
18
|
+
|
19
|
+
def __init__(self):
|
20
|
+
self.value_translator = ValueTranslator()
|
21
|
+
|
22
|
+
def to_pulsar(self, data: Dict[str, Any]) -> Triple:
|
23
|
+
return Triple(
|
24
|
+
s=self.value_translator.to_pulsar(data["s"]),
|
25
|
+
p=self.value_translator.to_pulsar(data["p"]),
|
26
|
+
o=self.value_translator.to_pulsar(data["o"])
|
27
|
+
)
|
28
|
+
|
29
|
+
def from_pulsar(self, obj: Triple) -> Dict[str, Any]:
|
30
|
+
return {
|
31
|
+
"s": self.value_translator.from_pulsar(obj.s),
|
32
|
+
"p": self.value_translator.from_pulsar(obj.p),
|
33
|
+
"o": self.value_translator.from_pulsar(obj.o)
|
34
|
+
}
|
35
|
+
|
36
|
+
|
37
|
+
class SubgraphTranslator(Translator):
|
38
|
+
"""Translator for lists of Triple objects (subgraphs)"""
|
39
|
+
|
40
|
+
def __init__(self):
|
41
|
+
self.triple_translator = TripleTranslator()
|
42
|
+
|
43
|
+
def to_pulsar(self, data: List[Dict[str, Any]]) -> List[Triple]:
|
44
|
+
return [self.triple_translator.to_pulsar(t) for t in data]
|
45
|
+
|
46
|
+
def from_pulsar(self, obj: List[Triple]) -> List[Dict[str, Any]]:
|
47
|
+
return [self.triple_translator.from_pulsar(t) for t in obj]
|
48
|
+
|
49
|
+
|
50
|
+
class RowSchemaTranslator(Translator):
|
51
|
+
"""Translator for RowSchema objects"""
|
52
|
+
|
53
|
+
def to_pulsar(self, data: Dict[str, Any]) -> RowSchema:
|
54
|
+
"""Convert dict to RowSchema Pulsar object"""
|
55
|
+
fields = []
|
56
|
+
for field_data in data.get("fields", []):
|
57
|
+
field = Field(
|
58
|
+
name=field_data.get("name", ""),
|
59
|
+
type=field_data.get("type", "string"),
|
60
|
+
size=field_data.get("size", 0),
|
61
|
+
primary=field_data.get("primary", False),
|
62
|
+
description=field_data.get("description", ""),
|
63
|
+
required=field_data.get("required", False),
|
64
|
+
indexed=field_data.get("indexed", False),
|
65
|
+
enum_values=field_data.get("enum_values", [])
|
66
|
+
)
|
67
|
+
fields.append(field)
|
68
|
+
|
69
|
+
return RowSchema(
|
70
|
+
name=data.get("name", ""),
|
71
|
+
description=data.get("description", ""),
|
72
|
+
fields=fields
|
73
|
+
)
|
74
|
+
|
75
|
+
def from_pulsar(self, obj: RowSchema) -> Dict[str, Any]:
|
76
|
+
"""Convert RowSchema Pulsar object to JSON-serializable dictionary"""
|
77
|
+
result = {
|
78
|
+
"name": obj.name,
|
79
|
+
"description": obj.description,
|
80
|
+
"fields": []
|
81
|
+
}
|
82
|
+
|
83
|
+
for field in obj.fields:
|
84
|
+
field_dict = {
|
85
|
+
"name": field.name,
|
86
|
+
"type": field.type,
|
87
|
+
"size": field.size,
|
88
|
+
"primary": field.primary,
|
89
|
+
"description": field.description,
|
90
|
+
"required": field.required,
|
91
|
+
"indexed": field.indexed
|
92
|
+
}
|
93
|
+
|
94
|
+
# Handle enum_values array
|
95
|
+
if field.enum_values:
|
96
|
+
field_dict["enum_values"] = list(field.enum_values)
|
97
|
+
|
98
|
+
result["fields"].append(field_dict)
|
99
|
+
|
100
|
+
return result
|
101
|
+
|
102
|
+
|
103
|
+
class FieldTranslator(Translator):
|
104
|
+
"""Translator for Field objects"""
|
105
|
+
|
106
|
+
def to_pulsar(self, data: Dict[str, Any]) -> Field:
|
107
|
+
"""Convert dict to Field Pulsar object"""
|
108
|
+
return Field(
|
109
|
+
name=data.get("name", ""),
|
110
|
+
type=data.get("type", "string"),
|
111
|
+
size=data.get("size", 0),
|
112
|
+
primary=data.get("primary", False),
|
113
|
+
description=data.get("description", ""),
|
114
|
+
required=data.get("required", False),
|
115
|
+
indexed=data.get("indexed", False),
|
116
|
+
enum_values=data.get("enum_values", [])
|
117
|
+
)
|
118
|
+
|
119
|
+
def from_pulsar(self, obj: Field) -> Dict[str, Any]:
|
120
|
+
"""Convert Field Pulsar object to JSON-serializable dictionary"""
|
121
|
+
result = {
|
122
|
+
"name": obj.name,
|
123
|
+
"type": obj.type,
|
124
|
+
"size": obj.size,
|
125
|
+
"primary": obj.primary,
|
126
|
+
"description": obj.description,
|
127
|
+
"required": obj.required,
|
128
|
+
"indexed": obj.indexed
|
129
|
+
}
|
130
|
+
|
131
|
+
# Handle enum_values array
|
132
|
+
if obj.enum_values:
|
133
|
+
result["enum_values"] = list(obj.enum_values)
|
134
|
+
|
135
|
+
return result
|
136
|
+
|
137
|
+
|
138
|
+
# Create singleton instances for easy access
|
139
|
+
row_schema_translator = RowSchemaTranslator()
|
140
|
+
field_translator = FieldTranslator()
|
@@ -17,11 +17,15 @@ class Triple(Record):
|
|
17
17
|
|
18
18
|
class Field(Record):
|
19
19
|
name = String()
|
20
|
-
# int, string, long, bool, float, double
|
20
|
+
# int, string, long, bool, float, double, timestamp
|
21
21
|
type = String()
|
22
22
|
size = Integer()
|
23
23
|
primary = Boolean()
|
24
24
|
description = String()
|
25
|
+
# NEW FIELDS for structured data:
|
26
|
+
required = Boolean() # Whether field is required
|
27
|
+
enum_values = Array(String()) # For enum type fields
|
28
|
+
indexed = Boolean() # Whether field should be indexed
|
25
29
|
|
26
30
|
class RowSchema(Record):
|
27
31
|
name = String()
|
@@ -0,0 +1,29 @@
|
|
1
|
+
from pulsar.schema import Record, Bytes
|
2
|
+
|
3
|
+
from ..core.metadata import Metadata
|
4
|
+
from ..core.topic import topic
|
5
|
+
|
6
|
+
############################################################################
|
7
|
+
|
8
|
+
# PDF docs etc.
|
9
|
+
class Document(Record):
|
10
|
+
metadata = Metadata()
|
11
|
+
data = Bytes()
|
12
|
+
|
13
|
+
############################################################################
|
14
|
+
|
15
|
+
# Text documents / text from PDF
|
16
|
+
|
17
|
+
class TextDocument(Record):
|
18
|
+
metadata = Metadata()
|
19
|
+
text = Bytes()
|
20
|
+
|
21
|
+
############################################################################
|
22
|
+
|
23
|
+
# Chunks of text
|
24
|
+
|
25
|
+
class Chunk(Record):
|
26
|
+
metadata = Metadata()
|
27
|
+
chunk = Bytes()
|
28
|
+
|
29
|
+
############################################################################
|
@@ -1,22 +1,8 @@
|
|
1
|
+
from pulsar.schema import Record, Bytes, String, Boolean, Integer, Array, Double, Map
|
1
2
|
|
2
|
-
from
|
3
|
-
|
4
|
-
from .
|
5
|
-
from . topic import topic
|
6
|
-
from . metadata import Metadata
|
7
|
-
|
8
|
-
############################################################################
|
9
|
-
|
10
|
-
# Entity context are an entity associated with textual context
|
11
|
-
|
12
|
-
class EntityContext(Record):
|
13
|
-
entity = Value()
|
14
|
-
context = String()
|
15
|
-
|
16
|
-
# This is a 'batching' mechanism for the above data
|
17
|
-
class EntityContexts(Record):
|
18
|
-
metadata = Metadata()
|
19
|
-
entities = Array(EntityContext())
|
3
|
+
from ..core.metadata import Metadata
|
4
|
+
from ..core.primitives import Value, RowSchema
|
5
|
+
from ..core.topic import topic
|
20
6
|
|
21
7
|
############################################################################
|
22
8
|
|
@@ -33,39 +19,38 @@ class GraphEmbeddings(Record):
|
|
33
19
|
|
34
20
|
############################################################################
|
35
21
|
|
36
|
-
#
|
22
|
+
# Document embeddings are embeddings associated with a chunk
|
37
23
|
|
38
|
-
class
|
24
|
+
class ChunkEmbeddings(Record):
|
25
|
+
chunk = Bytes()
|
39
26
|
vectors = Array(Array(Double()))
|
40
|
-
limit = Integer()
|
41
|
-
user = String()
|
42
|
-
collection = String()
|
43
27
|
|
44
|
-
|
45
|
-
|
46
|
-
|
28
|
+
# This is a 'batching' mechanism for the above data
|
29
|
+
class DocumentEmbeddings(Record):
|
30
|
+
metadata = Metadata()
|
31
|
+
chunks = Array(ChunkEmbeddings())
|
47
32
|
|
48
33
|
############################################################################
|
49
34
|
|
50
|
-
#
|
35
|
+
# Object embeddings are embeddings associated with the primary key of an
|
36
|
+
# object
|
51
37
|
|
52
|
-
class
|
38
|
+
class ObjectEmbeddings(Record):
|
53
39
|
metadata = Metadata()
|
54
|
-
|
40
|
+
vectors = Array(Array(Double()))
|
41
|
+
name = String()
|
42
|
+
key_name = String()
|
43
|
+
id = String()
|
55
44
|
|
56
45
|
############################################################################
|
57
46
|
|
58
|
-
#
|
47
|
+
# Structured object embeddings with enhanced capabilities
|
59
48
|
|
60
|
-
class
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
collection = String()
|
67
|
-
|
68
|
-
class TriplesQueryResponse(Record):
|
69
|
-
error = Error()
|
70
|
-
triples = Array(Triple())
|
49
|
+
class StructuredObjectEmbedding(Record):
|
50
|
+
metadata = Metadata()
|
51
|
+
vectors = Array(Array(Double()))
|
52
|
+
schema_name = String()
|
53
|
+
object_id = String() # Primary key value
|
54
|
+
field_embeddings = Map(Array(Double())) # Per-field embeddings
|
71
55
|
|
56
|
+
############################################################################
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from pulsar.schema import Record, String, Array
|
2
|
+
|
3
|
+
from ..core.primitives import Value, Triple
|
4
|
+
from ..core.metadata import Metadata
|
5
|
+
from ..core.topic import topic
|
6
|
+
|
7
|
+
############################################################################
|
8
|
+
|
9
|
+
# Entity context are an entity associated with textual context
|
10
|
+
|
11
|
+
class EntityContext(Record):
|
12
|
+
entity = Value()
|
13
|
+
context = String()
|
14
|
+
|
15
|
+
# This is a 'batching' mechanism for the above data
|
16
|
+
class EntityContexts(Record):
|
17
|
+
metadata = Metadata()
|
18
|
+
entities = Array(EntityContext())
|
19
|
+
|
20
|
+
############################################################################
|
21
|
+
|
22
|
+
# Graph triples
|
23
|
+
|
24
|
+
class Triples(Record):
|
25
|
+
metadata = Metadata()
|
26
|
+
triples = Array(Triple())
|
27
|
+
|
28
|
+
############################################################################
|
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
2
|
from pulsar.schema import Record, Bytes, String, Array, Long, Boolean
|
3
|
-
from .
|
4
|
-
from .
|
5
|
-
from .
|
6
|
-
from .
|
7
|
-
from .
|
8
|
-
from .
|
3
|
+
from ..core.primitives import Triple, Error
|
4
|
+
from ..core.topic import topic
|
5
|
+
from ..core.metadata import Metadata
|
6
|
+
from .document import Document, TextDocument
|
7
|
+
from .graph import Triples
|
8
|
+
from .embeddings import GraphEmbeddings
|
9
9
|
|
10
10
|
# get-kg-core
|
11
11
|
# -> (???)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from pulsar.schema import Record, String, Boolean
|
2
|
+
|
3
|
+
from ..core.topic import topic
|
4
|
+
|
5
|
+
############################################################################
|
6
|
+
|
7
|
+
# NLP extraction data types
|
8
|
+
|
9
|
+
class Definition(Record):
|
10
|
+
name = String()
|
11
|
+
definition = String()
|
12
|
+
|
13
|
+
class Topic(Record):
|
14
|
+
name = String()
|
15
|
+
definition = String()
|
16
|
+
|
17
|
+
class Relationship(Record):
|
18
|
+
s = String()
|
19
|
+
p = String()
|
20
|
+
o = String()
|
21
|
+
o_entity = Boolean()
|
22
|
+
|
23
|
+
class Fact(Record):
|
24
|
+
s = String()
|
25
|
+
p = String()
|
26
|
+
o = String()
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from pulsar.schema import Record, String, Map, Double
|
2
|
+
|
3
|
+
from ..core.metadata import Metadata
|
4
|
+
from ..core.topic import topic
|
5
|
+
|
6
|
+
############################################################################
|
7
|
+
|
8
|
+
# Extracted object from text processing
|
9
|
+
|
10
|
+
class ExtractedObject(Record):
|
11
|
+
metadata = Metadata()
|
12
|
+
schema_name = String() # Which schema this object belongs to
|
13
|
+
values = Map(String()) # Field name -> value
|
14
|
+
confidence = Double()
|
15
|
+
source_span = String() # Text span where object was found
|
16
|
+
|
17
|
+
############################################################################
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from pulsar.schema import Record, Array, Map, String
|
2
|
+
|
3
|
+
from ..core.metadata import Metadata
|
4
|
+
from ..core.primitives import RowSchema
|
5
|
+
from ..core.topic import topic
|
6
|
+
|
7
|
+
############################################################################
|
8
|
+
|
9
|
+
# Stores rows of information
|
10
|
+
|
11
|
+
class Rows(Record):
|
12
|
+
metadata = Metadata()
|
13
|
+
row_schema = RowSchema()
|
14
|
+
rows = Array(Map(String()))
|
15
|
+
|
16
|
+
############################################################################
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from pulsar.schema import Record, String, Bytes, Map
|
2
|
+
|
3
|
+
from ..core.metadata import Metadata
|
4
|
+
from ..core.topic import topic
|
5
|
+
|
6
|
+
############################################################################
|
7
|
+
|
8
|
+
# Structured data submission for fire-and-forget processing
|
9
|
+
|
10
|
+
class StructuredDataSubmission(Record):
|
11
|
+
metadata = Metadata()
|
12
|
+
format = String() # "json", "csv", "xml"
|
13
|
+
schema_name = String() # Reference to schema in config
|
14
|
+
data = Bytes() # Raw data to ingest
|
15
|
+
options = Map(String()) # Format-specific options
|
16
|
+
|
17
|
+
############################################################################
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from .llm import *
|
2
|
+
from .retrieval import *
|
3
|
+
from .query import *
|
4
|
+
from .agent import *
|
5
|
+
from .flow import *
|
6
|
+
from .prompt import *
|
7
|
+
from .config import *
|
8
|
+
from .library import *
|
9
|
+
from .lookup import *
|
10
|
+
from .nlp_query import *
|
11
|
+
from .structured_query import *
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
from pulsar.schema import Record, String, Array, Map
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .
|
4
|
+
from ..core.topic import topic
|
5
|
+
from ..core.primitives import Error
|
6
6
|
|
7
7
|
############################################################################
|
8
8
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
from pulsar.schema import Record, Bytes, String, Boolean, Array, Map, Integer
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .
|
4
|
+
from ..core.topic import topic
|
5
|
+
from ..core.primitives import Error
|
6
6
|
|
7
7
|
############################################################################
|
8
8
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
from pulsar.schema import Record, Bytes, String, Boolean, Array, Map, Integer
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .
|
4
|
+
from ..core.topic import topic
|
5
|
+
from ..core.primitives import Error
|
6
6
|
|
7
7
|
############################################################################
|
8
8
|
|
@@ -1,10 +1,9 @@
|
|
1
1
|
|
2
2
|
from pulsar.schema import Record, Bytes, String, Array, Long
|
3
|
-
from .
|
4
|
-
from .
|
5
|
-
from .
|
6
|
-
from .
|
7
|
-
from . documents import Document, TextDocument
|
3
|
+
from ..core.primitives import Triple, Error
|
4
|
+
from ..core.topic import topic
|
5
|
+
from ..core.metadata import Metadata
|
6
|
+
from ..knowledge.document import Document, TextDocument
|
8
7
|
|
9
8
|
# add-document
|
10
9
|
# -> (document_id, document_metadata, content)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
from pulsar.schema import Record, String, Array, Double, Integer
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .
|
4
|
+
from ..core.topic import topic
|
5
|
+
from ..core.primitives import Error
|
6
6
|
|
7
7
|
############################################################################
|
8
8
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
|
2
2
|
from pulsar.schema import Record, String
|
3
3
|
|
4
|
-
from .
|
5
|
-
from .
|
6
|
-
from .
|
4
|
+
from ..core.primitives import Error, Value, Triple
|
5
|
+
from ..core.topic import topic
|
6
|
+
from ..core.metadata import Metadata
|
7
7
|
|
8
8
|
############################################################################
|
9
9
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
from pulsar.schema import Record, String, Array, Map, Integer, Double
|
2
|
+
|
3
|
+
from ..core.primitives import Error
|
4
|
+
from ..core.topic import topic
|
5
|
+
|
6
|
+
############################################################################
|
7
|
+
|
8
|
+
# NLP to Structured Query Service - converts natural language to GraphQL
|
9
|
+
|
10
|
+
class NLPToStructuredQueryRequest(Record):
|
11
|
+
natural_language_query = String()
|
12
|
+
max_results = Integer()
|
13
|
+
context_hints = Map(String()) # Optional context for query generation
|
14
|
+
|
15
|
+
class NLPToStructuredQueryResponse(Record):
|
16
|
+
error = Error()
|
17
|
+
graphql_query = String() # Generated GraphQL query
|
18
|
+
variables = Map(String()) # GraphQL variables if any
|
19
|
+
detected_schemas = Array(String()) # Which schemas the query targets
|
20
|
+
confidence = Double()
|
21
|
+
|
22
|
+
############################################################################
|
@@ -1,32 +1,12 @@
|
|
1
|
+
from pulsar.schema import Record, String, Map
|
1
2
|
|
2
|
-
from
|
3
|
-
|
4
|
-
from . topic import topic
|
5
|
-
from . types import Error, RowSchema
|
3
|
+
from ..core.primitives import Error
|
4
|
+
from ..core.topic import topic
|
6
5
|
|
7
6
|
############################################################################
|
8
7
|
|
9
8
|
# Prompt services, abstract the prompt generation
|
10
9
|
|
11
|
-
class Definition(Record):
|
12
|
-
name = String()
|
13
|
-
definition = String()
|
14
|
-
|
15
|
-
class Topic(Record):
|
16
|
-
name = String()
|
17
|
-
definition = String()
|
18
|
-
|
19
|
-
class Relationship(Record):
|
20
|
-
s = String()
|
21
|
-
p = String()
|
22
|
-
o = String()
|
23
|
-
o_entity = Boolean()
|
24
|
-
|
25
|
-
class Fact(Record):
|
26
|
-
s = String()
|
27
|
-
p = String()
|
28
|
-
o = String()
|
29
|
-
|
30
10
|
# extract-definitions:
|
31
11
|
# chunk -> definitions
|
32
12
|
# extract-relationships:
|
@@ -55,5 +35,4 @@ class PromptResponse(Record):
|
|
55
35
|
# JSON encoded
|
56
36
|
object = String()
|
57
37
|
|
58
|
-
############################################################################
|
59
|
-
|
38
|
+
############################################################################
|