mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-24 12:41:02 +02:00
Logging strategy updates
This commit is contained in:
parent
5cd115b3f2
commit
851c0cd9d2
10 changed files with 66 additions and 24 deletions
|
|
@ -4,11 +4,16 @@ Document embeddings query service. Input is vector, output is an array
|
||||||
of chunks
|
of chunks
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from .... direct.milvus_doc_embeddings import DocVectors
|
from .... direct.milvus_doc_embeddings import DocVectors
|
||||||
from .... schema import DocumentEmbeddingsResponse
|
from .... schema import DocumentEmbeddingsResponse
|
||||||
from .... schema import Error, Value
|
from .... schema import Error, Value
|
||||||
from .... base import DocumentEmbeddingsQueryService
|
from .... base import DocumentEmbeddingsQueryService
|
||||||
|
|
||||||
|
# Module logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
default_ident = "de-query"
|
default_ident = "de-query"
|
||||||
default_store_uri = 'http://localhost:19530'
|
default_store_uri = 'http://localhost:19530'
|
||||||
|
|
||||||
|
|
@ -48,7 +53,7 @@ class Processor(DocumentEmbeddingsQueryService):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
logger.error(f"Exception querying document embeddings: {e}", exc_info=True)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,18 @@ Document embeddings query service. Input is vector, output is an array
|
||||||
of chunks. Pinecone implementation.
|
of chunks. Pinecone implementation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pinecone import Pinecone, ServerlessSpec
|
import logging
|
||||||
from pinecone.grpc import PineconeGRPC, GRPCClientConfig
|
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from pinecone import Pinecone, ServerlessSpec
|
||||||
|
from pinecone.grpc import PineconeGRPC, GRPCClientConfig
|
||||||
|
|
||||||
from .... base import DocumentEmbeddingsQueryService
|
from .... base import DocumentEmbeddingsQueryService
|
||||||
|
|
||||||
|
# Module logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
default_ident = "de-query"
|
default_ident = "de-query"
|
||||||
default_api_key = os.getenv("PINECONE_API_KEY", "not-specified")
|
default_api_key = os.getenv("PINECONE_API_KEY", "not-specified")
|
||||||
|
|
||||||
|
|
@ -78,7 +82,7 @@ class Processor(DocumentEmbeddingsQueryService):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
logger.error(f"Exception querying document embeddings: {e}", exc_info=True)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ Document embeddings query service. Input is vector, output is an array
|
||||||
of chunks
|
of chunks
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from qdrant_client import QdrantClient
|
from qdrant_client import QdrantClient
|
||||||
from qdrant_client.models import PointStruct
|
from qdrant_client.models import PointStruct
|
||||||
from qdrant_client.models import Distance, VectorParams
|
from qdrant_client.models import Distance, VectorParams
|
||||||
|
|
@ -12,6 +14,9 @@ from .... schema import DocumentEmbeddingsResponse
|
||||||
from .... schema import Error, Value
|
from .... schema import Error, Value
|
||||||
from .... base import DocumentEmbeddingsQueryService
|
from .... base import DocumentEmbeddingsQueryService
|
||||||
|
|
||||||
|
# Module logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
default_ident = "de-query"
|
default_ident = "de-query"
|
||||||
|
|
||||||
default_store_uri = 'http://localhost:6333'
|
default_store_uri = 'http://localhost:6333'
|
||||||
|
|
@ -63,7 +68,7 @@ class Processor(DocumentEmbeddingsQueryService):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
logger.error(f"Exception querying document embeddings: {e}", exc_info=True)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,16 @@ Graph embeddings query service. Input is vector, output is list of
|
||||||
entities
|
entities
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from .... direct.milvus_graph_embeddings import EntityVectors
|
from .... direct.milvus_graph_embeddings import EntityVectors
|
||||||
from .... schema import GraphEmbeddingsResponse
|
from .... schema import GraphEmbeddingsResponse
|
||||||
from .... schema import Error, Value
|
from .... schema import Error, Value
|
||||||
from .... base import GraphEmbeddingsQueryService
|
from .... base import GraphEmbeddingsQueryService
|
||||||
|
|
||||||
|
# Module logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
default_ident = "ge-query"
|
default_ident = "ge-query"
|
||||||
default_store_uri = 'http://localhost:19530'
|
default_store_uri = 'http://localhost:19530'
|
||||||
|
|
||||||
|
|
@ -68,14 +73,12 @@ class Processor(GraphEmbeddingsQueryService):
|
||||||
|
|
||||||
entities = ents2
|
entities = ents2
|
||||||
|
|
||||||
print("Send response...", flush=True)
|
logger.debug("Send response...")
|
||||||
return entities
|
return entities
|
||||||
|
|
||||||
print("Done.", flush=True)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
logger.error(f"Exception querying graph embeddings: {e}", exc_info=True)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,20 @@ Graph embeddings query service. Input is vector, output is list of
|
||||||
entities. Pinecone implementation.
|
entities. Pinecone implementation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pinecone import Pinecone, ServerlessSpec
|
import logging
|
||||||
from pinecone.grpc import PineconeGRPC, GRPCClientConfig
|
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from pinecone import Pinecone, ServerlessSpec
|
||||||
|
from pinecone.grpc import PineconeGRPC, GRPCClientConfig
|
||||||
|
|
||||||
from .... schema import GraphEmbeddingsResponse
|
from .... schema import GraphEmbeddingsResponse
|
||||||
from .... schema import Error, Value
|
from .... schema import Error, Value
|
||||||
from .... base import GraphEmbeddingsQueryService
|
from .... base import GraphEmbeddingsQueryService
|
||||||
|
|
||||||
|
# Module logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
default_ident = "ge-query"
|
default_ident = "ge-query"
|
||||||
default_api_key = os.getenv("PINECONE_API_KEY", "not-specified")
|
default_api_key = os.getenv("PINECONE_API_KEY", "not-specified")
|
||||||
|
|
||||||
|
|
@ -107,7 +111,7 @@ class Processor(GraphEmbeddingsQueryService):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
logger.error(f"Exception querying graph embeddings: {e}", exc_info=True)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ Graph embeddings query service. Input is vector, output is list of
|
||||||
entities
|
entities
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from qdrant_client import QdrantClient
|
from qdrant_client import QdrantClient
|
||||||
from qdrant_client.models import PointStruct
|
from qdrant_client.models import PointStruct
|
||||||
from qdrant_client.models import Distance, VectorParams
|
from qdrant_client.models import Distance, VectorParams
|
||||||
|
|
@ -12,6 +14,9 @@ from .... schema import GraphEmbeddingsResponse
|
||||||
from .... schema import Error, Value
|
from .... schema import Error, Value
|
||||||
from .... base import GraphEmbeddingsQueryService
|
from .... base import GraphEmbeddingsQueryService
|
||||||
|
|
||||||
|
# Module logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
default_ident = "ge-query"
|
default_ident = "ge-query"
|
||||||
|
|
||||||
default_store_uri = 'http://localhost:6333'
|
default_store_uri = 'http://localhost:6333'
|
||||||
|
|
@ -85,14 +90,12 @@ class Processor(GraphEmbeddingsQueryService):
|
||||||
|
|
||||||
entities = ents2
|
entities = ents2
|
||||||
|
|
||||||
print("Send response...", flush=True)
|
logger.debug("Send response...")
|
||||||
return entities
|
return entities
|
||||||
|
|
||||||
print("Done.", flush=True)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
logger.error(f"Exception querying graph embeddings: {e}", exc_info=True)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,16 @@ Triples query service. Input is a (s, p, o) triple, some values may be
|
||||||
null. Output is a list of triples.
|
null. Output is a list of triples.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from .... direct.cassandra import TrustGraph
|
from .... direct.cassandra import TrustGraph
|
||||||
from .... schema import TriplesQueryRequest, TriplesQueryResponse, Error
|
from .... schema import TriplesQueryRequest, TriplesQueryResponse, Error
|
||||||
from .... schema import Value, Triple
|
from .... schema import Value, Triple
|
||||||
from .... base import TriplesQueryService
|
from .... base import TriplesQueryService
|
||||||
|
|
||||||
|
# Module logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
default_ident = "triples-query"
|
default_ident = "triples-query"
|
||||||
|
|
||||||
default_graph_host='localhost'
|
default_graph_host='localhost'
|
||||||
|
|
@ -135,7 +140,7 @@ class Processor(TriplesQueryService):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
logger.error(f"Exception querying triples: {e}", exc_info=True)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,17 @@ Input is a (s, p, o) triple, some values may be null. Output is a list of
|
||||||
triples.
|
triples.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from falkordb import FalkorDB
|
from falkordb import FalkorDB
|
||||||
|
|
||||||
from .... schema import TriplesQueryRequest, TriplesQueryResponse, Error
|
from .... schema import TriplesQueryRequest, TriplesQueryResponse, Error
|
||||||
from .... schema import Value, Triple
|
from .... schema import Value, Triple
|
||||||
from .... base import TriplesQueryService
|
from .... base import TriplesQueryService
|
||||||
|
|
||||||
|
# Module logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
default_ident = "triples-query"
|
default_ident = "triples-query"
|
||||||
|
|
||||||
default_graph_url = 'falkor://falkordb:6379'
|
default_graph_url = 'falkor://falkordb:6379'
|
||||||
|
|
@ -299,7 +304,7 @@ class Processor(TriplesQueryService):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
logger.error(f"Exception querying triples: {e}", exc_info=True)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,17 @@ Input is a (s, p, o) triple, some values may be null. Output is a list of
|
||||||
triples.
|
triples.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from neo4j import GraphDatabase
|
from neo4j import GraphDatabase
|
||||||
|
|
||||||
from .... schema import TriplesQueryRequest, TriplesQueryResponse, Error
|
from .... schema import TriplesQueryRequest, TriplesQueryResponse, Error
|
||||||
from .... schema import Value, Triple
|
from .... schema import Value, Triple
|
||||||
from .... base import TriplesQueryService
|
from .... base import TriplesQueryService
|
||||||
|
|
||||||
|
# Module logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
default_ident = "triples-query"
|
default_ident = "triples-query"
|
||||||
|
|
||||||
default_graph_host = 'bolt://memgraph:7687'
|
default_graph_host = 'bolt://memgraph:7687'
|
||||||
|
|
@ -296,9 +301,7 @@ class Processor(TriplesQueryService):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
logger.error(f"Exception querying triples: {e}", exc_info=True)
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,17 @@ Input is a (s, p, o) triple, some values may be null. Output is a list of
|
||||||
triples.
|
triples.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from neo4j import GraphDatabase
|
from neo4j import GraphDatabase
|
||||||
|
|
||||||
from .... schema import TriplesQueryRequest, TriplesQueryResponse, Error
|
from .... schema import TriplesQueryRequest, TriplesQueryResponse, Error
|
||||||
from .... schema import Value, Triple
|
from .... schema import Value, Triple
|
||||||
from .... base import TriplesQueryService
|
from .... base import TriplesQueryService
|
||||||
|
|
||||||
|
# Module logger
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
default_ident = "triples-query"
|
default_ident = "triples-query"
|
||||||
|
|
||||||
default_graph_host = 'bolt://neo4j:7687'
|
default_graph_host = 'bolt://neo4j:7687'
|
||||||
|
|
@ -280,7 +285,7 @@ class Processor(TriplesQueryService):
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
print(f"Exception: {e}")
|
logger.error(f"Exception querying triples: {e}", exc_info=True)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue