From 4a5ca3197acb00aff848ef8a7ea89e5f1a0bf7b6 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Mon, 30 Dec 2024 12:35:22 +0000 Subject: [PATCH] Fix running issues --- trustgraph-flow/trustgraph/embeddings/vectorize/vectorize.py | 2 +- trustgraph-flow/trustgraph/extract/kg/definitions/extract.py | 4 ++-- .../trustgraph/extract/kg/relationships/extract.py | 2 -- .../trustgraph/storage/graph_embeddings/milvus/write.py | 4 ++-- .../trustgraph/storage/graph_embeddings/pinecone/write.py | 5 +++-- .../trustgraph/storage/graph_embeddings/qdrant/write.py | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/trustgraph-flow/trustgraph/embeddings/vectorize/vectorize.py b/trustgraph-flow/trustgraph/embeddings/vectorize/vectorize.py index 263ec329..5630a7b5 100755 --- a/trustgraph-flow/trustgraph/embeddings/vectorize/vectorize.py +++ b/trustgraph-flow/trustgraph/embeddings/vectorize/vectorize.py @@ -78,7 +78,7 @@ class Processor(ConsumerProducer): r = GraphEmbeddings( metadata=v.metadata, - entities=entiities, + entities=entities, ) self.producer.send(r) diff --git a/trustgraph-flow/trustgraph/extract/kg/definitions/extract.py b/trustgraph-flow/trustgraph/extract/kg/definitions/extract.py index b183969d..dcb1123e 100755 --- a/trustgraph-flow/trustgraph/extract/kg/definitions/extract.py +++ b/trustgraph-flow/trustgraph/extract/kg/definitions/extract.py @@ -6,7 +6,7 @@ entity/context definitions for embedding. """ import urllib.parse -import json +from pulsar.schema import JsonSchema from .... schema import Chunk, Triple, Triples, Metadata, Value from .... schema import EntityContext, EntityContexts @@ -68,7 +68,7 @@ class Processor(ConsumerProducer): __class__.pubsub_metric.info({ "input_queue": input_queue, "output_queue": output_queue, - "vector_queue": vector_queue, + "entity_context_queue": ec_queue, "prompt_request_queue": pr_request_queue, "prompt_response_queue": pr_response_queue, "subscriber": subscriber, diff --git a/trustgraph-flow/trustgraph/extract/kg/relationships/extract.py b/trustgraph-flow/trustgraph/extract/kg/relationships/extract.py index 0ed0d1ae..0fd7b9a8 100755 --- a/trustgraph-flow/trustgraph/extract/kg/relationships/extract.py +++ b/trustgraph-flow/trustgraph/extract/kg/relationships/extract.py @@ -6,8 +6,6 @@ graph edges. """ import urllib.parse -import os -from pulsar.schema import JsonSchema from .... schema import Chunk, Triple, Triples from .... schema import Metadata, Value diff --git a/trustgraph-flow/trustgraph/storage/graph_embeddings/milvus/write.py b/trustgraph-flow/trustgraph/storage/graph_embeddings/milvus/write.py index fa933ef3..e1379577 100755 --- a/trustgraph-flow/trustgraph/storage/graph_embeddings/milvus/write.py +++ b/trustgraph-flow/trustgraph/storage/graph_embeddings/milvus/write.py @@ -40,9 +40,9 @@ class Processor(Consumer): for entity in v.entities: - if entity.value != "" and entity.value is not None: + if entity.entity.value != "" and entity.entity.value is not None: for vec in entity.vectors: - self.vecstore.insert(vec, entity.value) + self.vecstore.insert(vec, entity.entity.value) @staticmethod def add_args(parser): diff --git a/trustgraph-flow/trustgraph/storage/graph_embeddings/pinecone/write.py b/trustgraph-flow/trustgraph/storage/graph_embeddings/pinecone/write.py index 868e866a..a32ff627 100755 --- a/trustgraph-flow/trustgraph/storage/graph_embeddings/pinecone/write.py +++ b/trustgraph-flow/trustgraph/storage/graph_embeddings/pinecone/write.py @@ -96,7 +96,8 @@ class Processor(Consumer): for entity in v.entities: - if v.entity.value == "" or v.entity.value is None: continue + if entity.entity.value == "" or entity.entity.value is None: + continue for vec in entity.vectors: @@ -128,7 +129,7 @@ class Processor(Consumer): { "id": id, "values": vec, - "metadata": { "entity": entity.value }, + "metadata": { "entity": entity.entity.value }, } ] diff --git a/trustgraph-flow/trustgraph/storage/graph_embeddings/qdrant/write.py b/trustgraph-flow/trustgraph/storage/graph_embeddings/qdrant/write.py index c7c6b444..7bc5778c 100755 --- a/trustgraph-flow/trustgraph/storage/graph_embeddings/qdrant/write.py +++ b/trustgraph-flow/trustgraph/storage/graph_embeddings/qdrant/write.py @@ -71,7 +71,7 @@ class Processor(Consumer): for entity in v.entities: - if entity.value == "" or entity.value is None: return + if entity.entity.value == "" or entity.entity.value is None: return for vec in entity.vectors: @@ -88,7 +88,7 @@ class Processor(Consumer): id=str(uuid.uuid4()), vector=vec, payload={ - "entity": entity.value, + "entity": entity.entity.value, } ) ]