New schemas

This commit is contained in:
Cyber MacGeddon 2025-08-04 23:22:31 +01:00
parent edf9b8b1db
commit e606ed6e40
8 changed files with 101 additions and 4 deletions

View file

@ -17,11 +17,15 @@ class Triple(Record):
class Field(Record):
name = String()
# int, string, long, bool, float, double
# int, string, long, bool, float, double, timestamp
type = String()
size = Integer()
primary = Boolean()
description = String()
# NEW FIELDS for structured data:
required = Boolean() # Whether field is required
enum_values = Array(String()) # For enum type fields
indexed = Boolean() # Whether field should be indexed
class RowSchema(Record):
name = String()

View file

@ -3,4 +3,6 @@ from .document import *
from .embeddings import *
from .knowledge import *
from .nlp import *
from .rows import *
from .rows import *
from .structured import *
from .extraction import *

View file

@ -40,4 +40,17 @@ class ObjectEmbeddings(Record):
vectors = Array(Array(Double()))
name = String()
key_name = String()
id = String()
id = String()
############################################################################
# Structured object embeddings with enhanced capabilities
class StructuredObjectEmbedding(Record):
metadata = Metadata()
vectors = Array(Array(Double()))
schema_name = String()
object_id = String() # Primary key value
field_embeddings = Map(Array(Double())) # Per-field embeddings
############################################################################

View file

@ -0,0 +1,17 @@
from pulsar.schema import Record, String, Map, Double
from ..core.metadata import Metadata
from ..core.topic import topic
############################################################################
# Extracted object from text processing
class ExtractedObject(Record):
metadata = Metadata()
schema_name = String() # Which schema this object belongs to
values = Map(String()) # Field name -> value
confidence = Double()
source_span = String() # Text span where object was found
############################################################################

View file

@ -0,0 +1,17 @@
from pulsar.schema import Record, String, Bytes, Map
from ..core.metadata import Metadata
from ..core.topic import topic
############################################################################
# Structured data submission for fire-and-forget processing
class StructuredDataSubmission(Record):
metadata = Metadata()
format = String() # "json", "csv", "xml"
schema_name = String() # Reference to schema in config
data = Bytes() # Raw data to ingest
options = Map(String()) # Format-specific options
############################################################################

View file

@ -6,4 +6,6 @@ from .flow import *
from .prompt import *
from .config import *
from .library import *
from .lookup import *
from .lookup import *
from .nlp_query import *
from .structured_query import *

View file

@ -0,0 +1,22 @@
from pulsar.schema import Record, String, Array, Map, Integer, Double
from ..core.primitives import Error
from ..core.topic import topic
############################################################################
# NLP to Structured Query Service - converts natural language to GraphQL
class NLPToStructuredQueryRequest(Record):
natural_language_query = String()
max_results = Integer()
context_hints = Map(String()) # Optional context for query generation
class NLPToStructuredQueryResponse(Record):
error = Error()
graphql_query = String() # Generated GraphQL query
variables = Map(String()) # GraphQL variables if any
detected_schemas = Array(String()) # Which schemas the query targets
confidence = Double()
############################################################################

View file

@ -0,0 +1,20 @@
from pulsar.schema import Record, String, Map, Array
from ..core.primitives import Error
from ..core.topic import topic
############################################################################
# Structured Query Service - executes GraphQL queries
class StructuredQueryRequest(Record):
query = String() # GraphQL query
variables = Map(String()) # GraphQL variables
operation_name = String() # Optional operation name for multi-operation documents
class StructuredQueryResponse(Record):
error = Error()
data = String() # JSON-encoded GraphQL response data
errors = Array(String()) # GraphQL errors if any
############################################################################