trustgraph-flow 0.16.11__tar.gz → 0.17.0__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-flow-0.16.11 → trustgraph-flow-0.17.0}/PKG-INFO +2 -2
- trustgraph-flow-0.17.0/scripts/wikipedia-lookup +6 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/setup.py +2 -1
- trustgraph-flow-0.17.0/trustgraph/api/gateway/agent.py +30 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/dbpedia.py +29 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/embeddings.py +27 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/encyclopedia.py +29 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/endpoint.py +153 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/graph_embeddings_load.py +60 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/graph_embeddings_stream.py +56 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/graph_rag.py +30 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/internet_search.py +29 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/prompt.py +41 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/publisher.py +41 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/running.py +5 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/serialize.py +57 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/service.py +287 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/socket.py +68 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/subscriber.py +68 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/text_completion.py +28 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/triples_load.py +59 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/triples_query.py +53 -0
- trustgraph-flow-0.17.0/trustgraph/api/gateway/triples_stream.py +56 -0
- {trustgraph-flow-0.16.11/trustgraph/model/prompt/generic → trustgraph-flow-0.17.0/trustgraph/external/wikipedia}/__main__.py +0 -0
- trustgraph-flow-0.17.0/trustgraph/external/wikipedia/service.py +102 -0
- trustgraph-flow-0.17.0/trustgraph/flow_version.py +1 -0
- trustgraph-flow-0.17.0/trustgraph/model/prompt/template/__main__.py +7 -0
- trustgraph-flow-0.17.0/trustgraph/query/triples/neo4j/__init__.py +3 -0
- trustgraph-flow-0.17.0/trustgraph/storage/triples/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph_flow.egg-info/PKG-INFO +2 -2
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph_flow.egg-info/SOURCES.txt +24 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph_flow.egg-info/requires.txt +1 -1
- trustgraph-flow-0.16.11/trustgraph/api/gateway/service.py +0 -1026
- trustgraph-flow-0.16.11/trustgraph/flow_version.py +0 -1
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/README.md +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/agent-manager-react +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/api-gateway +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/chunker-recursive +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/chunker-token +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/de-query-milvus +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/de-query-pinecone +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/de-query-qdrant +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/de-write-milvus +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/de-write-pinecone +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/de-write-qdrant +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/document-rag +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/embeddings-ollama +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/embeddings-vectorize +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/ge-query-milvus +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/ge-query-pinecone +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/ge-query-qdrant +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/ge-write-milvus +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/ge-write-pinecone +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/ge-write-qdrant +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/graph-rag +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/kg-extract-definitions +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/kg-extract-relationships +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/kg-extract-topics +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/metering +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/object-extract-row +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/oe-write-milvus +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/pdf-decoder +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/prompt-generic +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/prompt-template +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/rows-write-cassandra +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/run-processing +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/text-completion-azure +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/text-completion-azure-openai +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/text-completion-claude +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/text-completion-cohere +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/text-completion-googleaistudio +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/text-completion-llamafile +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/text-completion-ollama +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/text-completion-openai +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/triples-query-cassandra +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/triples-query-neo4j +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/triples-write-cassandra +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/scripts/triples-write-neo4j +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/setup.cfg +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/agent/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/agent/react/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/agent/react/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/agent/react/agent_manager.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/agent/react/service.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/agent/react/tools.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/agent/react/types.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/api/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/api/gateway/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/api/gateway/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/chunking/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/chunking/recursive/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/chunking/recursive/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/chunking/recursive/chunker.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/chunking/token/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/chunking/token/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/chunking/token/chunker.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/decoding/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/decoding/pdf/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/decoding/pdf/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/decoding/pdf/pdf_decoder.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/direct/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/direct/cassandra.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/direct/milvus_doc_embeddings.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/direct/milvus_graph_embeddings.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/direct/milvus_object_embeddings.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/document_rag.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/embeddings/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/embeddings/ollama/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/embeddings/ollama/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/embeddings/ollama/processor.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/embeddings/vectorize/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/embeddings/vectorize/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/embeddings/vectorize/vectorize.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/extract → trustgraph-flow-0.17.0/trustgraph/external}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/model/prompt/generic → trustgraph-flow-0.17.0/trustgraph/external/wikipedia}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/extract/kg → trustgraph-flow-0.17.0/trustgraph/extract}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/extract/object → trustgraph-flow-0.17.0/trustgraph/extract/kg}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/kg/definitions/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/kg/definitions/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/kg/definitions/extract.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/kg/relationships/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/kg/relationships/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/kg/relationships/extract.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/kg/topics/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/kg/topics/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/kg/topics/extract.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/model → trustgraph-flow-0.17.0/trustgraph/extract/object}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/object/row/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/object/row/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/extract/object/row/extract.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/graph_rag.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/metering/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/metering/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/metering/counter.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/metering/pricelist.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/model/prompt → trustgraph-flow-0.17.0/trustgraph/model}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/model/text_completion → trustgraph-flow-0.17.0/trustgraph/model/prompt}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/model/prompt/template → trustgraph-flow-0.17.0/trustgraph/model/prompt/generic}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/model/prompt/template → trustgraph-flow-0.17.0/trustgraph/model/prompt/generic}/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/prompt/generic/prompts.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/prompt/generic/service.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/doc_embeddings/milvus → trustgraph-flow-0.17.0/trustgraph/model/prompt/template}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/prompt/template/prompt_manager.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/prompt/template/service.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query → trustgraph-flow-0.17.0/trustgraph/model/text_completion}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/azure/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/azure/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/azure/llm.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/azure_openai/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/azure_openai/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/azure_openai/llm.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/claude/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/claude/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/claude/llm.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/cohere/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/cohere/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/cohere/llm.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/googleaistudio/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/googleaistudio/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/googleaistudio/llm.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/llamafile/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/llamafile/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/llamafile/llm.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/ollama/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/ollama/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/ollama/llm.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/openai/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/openai/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/model/text_completion/openai/llm.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/processing/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/processing/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/processing/processing.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/doc_embeddings → trustgraph-flow-0.17.0/trustgraph/query}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/graph_embeddings → trustgraph-flow-0.17.0/trustgraph/query/doc_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/doc_embeddings/pinecone → trustgraph-flow-0.17.0/trustgraph/query/doc_embeddings/milvus}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/doc_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/doc_embeddings/qdrant → trustgraph-flow-0.17.0/trustgraph/query/doc_embeddings/pinecone}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/doc_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/doc_embeddings/pinecone/service.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/graph_embeddings/milvus → trustgraph-flow-0.17.0/trustgraph/query/doc_embeddings/qdrant}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/doc_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/triples → trustgraph-flow-0.17.0/trustgraph/query/graph_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/graph_embeddings/pinecone → trustgraph-flow-0.17.0/trustgraph/query/graph_embeddings/milvus}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/graph_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/graph_embeddings/qdrant → trustgraph-flow-0.17.0/trustgraph/query/graph_embeddings/pinecone}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/graph_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/graph_embeddings/pinecone/service.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/triples/cassandra → trustgraph-flow-0.17.0/trustgraph/query/graph_embeddings/qdrant}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/graph_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/retrieval → trustgraph-flow-0.17.0/trustgraph/query/triples}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/query/triples/neo4j → trustgraph-flow-0.17.0/trustgraph/query/triples/cassandra}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/triples/cassandra/service.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/query/triples/neo4j/service.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/storage → trustgraph-flow-0.17.0/trustgraph/retrieval}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/retrieval/document_rag/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/retrieval/document_rag/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/retrieval/document_rag/rag.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/retrieval/graph_rag/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/retrieval/graph_rag/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/retrieval/graph_rag/rag.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/storage/doc_embeddings → trustgraph-flow-0.17.0/trustgraph/storage}/__init__.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/storage/graph_embeddings → trustgraph-flow-0.17.0/trustgraph/storage/doc_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/doc_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/doc_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/doc_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/doc_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/doc_embeddings/pinecone/write.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/doc_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/doc_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/storage/object_embeddings → trustgraph-flow-0.17.0/trustgraph/storage/graph_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/graph_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/graph_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/graph_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/graph_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/graph_embeddings/pinecone/write.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/graph_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/graph_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/storage/rows → trustgraph-flow-0.17.0/trustgraph/storage/object_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/object_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/object_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/object_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.16.11/trustgraph/storage/triples → trustgraph-flow-0.17.0/trustgraph/storage/rows}/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/rows/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/rows/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/rows/cassandra/write.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/triples/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/triples/cassandra/write.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/triples/neo4j/__init__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph/storage/triples/neo4j/write.py +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph_flow.egg-info/dependency_links.txt +0 -0
- {trustgraph-flow-0.16.11 → trustgraph-flow-0.17.0}/trustgraph_flow.egg-info/top_level.txt +0 -0
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: trustgraph-flow
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.17.0
|
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.17.0.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+)
|
@@ -34,7 +34,7 @@ setuptools.setup(
|
|
34
34
|
python_requires='>=3.8',
|
35
35
|
download_url = "https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v" + version + ".tar.gz",
|
36
36
|
install_requires=[
|
37
|
-
"trustgraph-base>=0.
|
37
|
+
"trustgraph-base>=0.17,<0.18",
|
38
38
|
"urllib3",
|
39
39
|
"rdflib",
|
40
40
|
"pymilvus",
|
@@ -106,5 +106,6 @@ setuptools.setup(
|
|
106
106
|
"scripts/triples-query-neo4j",
|
107
107
|
"scripts/triples-write-cassandra",
|
108
108
|
"scripts/triples-write-neo4j",
|
109
|
+
"scripts/wikipedia-lookup",
|
109
110
|
]
|
110
111
|
)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
from ... schema import AgentRequest, AgentResponse
|
3
|
+
from ... schema import agent_request_queue
|
4
|
+
from ... schema import agent_response_queue
|
5
|
+
|
6
|
+
from . endpoint import MultiResponseServiceEndpoint
|
7
|
+
|
8
|
+
class AgentEndpoint(MultiResponseServiceEndpoint):
|
9
|
+
def __init__(self, pulsar_host, timeout):
|
10
|
+
|
11
|
+
super(AgentEndpoint, self).__init__(
|
12
|
+
pulsar_host=pulsar_host,
|
13
|
+
request_queue=agent_request_queue,
|
14
|
+
response_queue=agent_response_queue,
|
15
|
+
request_schema=AgentRequest,
|
16
|
+
response_schema=AgentResponse,
|
17
|
+
endpoint_path="/api/v1/agent",
|
18
|
+
timeout=timeout,
|
19
|
+
)
|
20
|
+
|
21
|
+
def to_request(self, body):
|
22
|
+
return AgentRequest(
|
23
|
+
question=body["question"]
|
24
|
+
)
|
25
|
+
|
26
|
+
def from_response(self, message):
|
27
|
+
if message.answer:
|
28
|
+
return { "answer": message.answer }, True
|
29
|
+
else:
|
30
|
+
return {}, False
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
from ... schema import LookupRequest, LookupResponse
|
3
|
+
from ... schema import dbpedia_lookup_request_queue
|
4
|
+
from ... schema import dbpedia_lookup_response_queue
|
5
|
+
|
6
|
+
from . endpoint import ServiceEndpoint
|
7
|
+
|
8
|
+
class DbpediaEndpoint(ServiceEndpoint):
|
9
|
+
def __init__(self, pulsar_host, timeout):
|
10
|
+
|
11
|
+
super(DbpediaEndpoint, self).__init__(
|
12
|
+
pulsar_host=pulsar_host,
|
13
|
+
request_queue=dbpedia_lookup_request_queue,
|
14
|
+
response_queue=dbpedia_lookup_response_queue,
|
15
|
+
request_schema=LookupRequest,
|
16
|
+
response_schema=LookupResponse,
|
17
|
+
endpoint_path="/api/v1/dbpedia",
|
18
|
+
timeout=timeout,
|
19
|
+
)
|
20
|
+
|
21
|
+
def to_request(self, body):
|
22
|
+
return LookupRequest(
|
23
|
+
term=body["term"],
|
24
|
+
kind=body.get("kind", None),
|
25
|
+
)
|
26
|
+
|
27
|
+
def from_response(self, message):
|
28
|
+
return { "text": message.text }
|
29
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
from ... schema import EmbeddingsRequest, EmbeddingsResponse
|
3
|
+
from ... schema import embeddings_request_queue
|
4
|
+
from ... schema import embeddings_response_queue
|
5
|
+
|
6
|
+
from . endpoint import ServiceEndpoint
|
7
|
+
|
8
|
+
class EmbeddingsEndpoint(ServiceEndpoint):
|
9
|
+
def __init__(self, pulsar_host, timeout):
|
10
|
+
|
11
|
+
super(EmbeddingsEndpoint, self).__init__(
|
12
|
+
pulsar_host=pulsar_host,
|
13
|
+
request_queue=embeddings_request_queue,
|
14
|
+
response_queue=embeddings_response_queue,
|
15
|
+
request_schema=EmbeddingsRequest,
|
16
|
+
response_schema=EmbeddingsResponse,
|
17
|
+
endpoint_path="/api/v1/embeddings",
|
18
|
+
timeout=timeout,
|
19
|
+
)
|
20
|
+
|
21
|
+
def to_request(self, body):
|
22
|
+
return EmbeddingsRequest(
|
23
|
+
text=body["text"]
|
24
|
+
)
|
25
|
+
|
26
|
+
def from_response(self, message):
|
27
|
+
return { "vectors": message.vectors }
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
from ... schema import LookupRequest, LookupResponse
|
3
|
+
from ... schema import encyclopedia_lookup_request_queue
|
4
|
+
from ... schema import encyclopedia_lookup_response_queue
|
5
|
+
|
6
|
+
from . endpoint import ServiceEndpoint
|
7
|
+
|
8
|
+
class EncyclopediaEndpoint(ServiceEndpoint):
|
9
|
+
def __init__(self, pulsar_host, timeout):
|
10
|
+
|
11
|
+
super(EncyclopediaEndpoint, self).__init__(
|
12
|
+
pulsar_host=pulsar_host,
|
13
|
+
request_queue=encyclopedia_lookup_request_queue,
|
14
|
+
response_queue=encyclopedia_lookup_response_queue,
|
15
|
+
request_schema=LookupRequest,
|
16
|
+
response_schema=LookupResponse,
|
17
|
+
endpoint_path="/api/v1/encyclopedia",
|
18
|
+
timeout=timeout,
|
19
|
+
)
|
20
|
+
|
21
|
+
def to_request(self, body):
|
22
|
+
return LookupRequest(
|
23
|
+
term=body["term"],
|
24
|
+
kind=body.get("kind", None),
|
25
|
+
)
|
26
|
+
|
27
|
+
def from_response(self, message):
|
28
|
+
return { "text": message.text }
|
29
|
+
|
@@ -0,0 +1,153 @@
|
|
1
|
+
|
2
|
+
import asyncio
|
3
|
+
from pulsar.schema import JsonSchema
|
4
|
+
from aiohttp import web
|
5
|
+
import uuid
|
6
|
+
import logging
|
7
|
+
|
8
|
+
from . publisher import Publisher
|
9
|
+
from . subscriber import Subscriber
|
10
|
+
|
11
|
+
logger = logging.getLogger("endpoint")
|
12
|
+
logger.setLevel(logging.INFO)
|
13
|
+
|
14
|
+
class ServiceEndpoint:
|
15
|
+
|
16
|
+
def __init__(
|
17
|
+
self,
|
18
|
+
pulsar_host,
|
19
|
+
request_queue, request_schema,
|
20
|
+
response_queue, response_schema,
|
21
|
+
endpoint_path,
|
22
|
+
subscription="api-gateway", consumer_name="api-gateway",
|
23
|
+
timeout=600,
|
24
|
+
):
|
25
|
+
|
26
|
+
self.pub = Publisher(
|
27
|
+
pulsar_host, request_queue,
|
28
|
+
schema=JsonSchema(request_schema)
|
29
|
+
)
|
30
|
+
|
31
|
+
self.sub = Subscriber(
|
32
|
+
pulsar_host, response_queue,
|
33
|
+
subscription, consumer_name,
|
34
|
+
JsonSchema(response_schema)
|
35
|
+
)
|
36
|
+
|
37
|
+
self.path = endpoint_path
|
38
|
+
self.timeout = timeout
|
39
|
+
|
40
|
+
async def start(self):
|
41
|
+
|
42
|
+
self.pub_task = asyncio.create_task(self.pub.run())
|
43
|
+
self.sub_task = asyncio.create_task(self.sub.run())
|
44
|
+
|
45
|
+
def add_routes(self, app):
|
46
|
+
|
47
|
+
app.add_routes([
|
48
|
+
web.post(self.path, self.handle),
|
49
|
+
])
|
50
|
+
|
51
|
+
def to_request(self, request):
|
52
|
+
raise RuntimeError("Not defined")
|
53
|
+
|
54
|
+
def from_response(self, response):
|
55
|
+
raise RuntimeError("Not defined")
|
56
|
+
|
57
|
+
async def handle(self, request):
|
58
|
+
|
59
|
+
id = str(uuid.uuid4())
|
60
|
+
|
61
|
+
try:
|
62
|
+
|
63
|
+
data = await request.json()
|
64
|
+
|
65
|
+
q = await self.sub.subscribe(id)
|
66
|
+
|
67
|
+
print(data)
|
68
|
+
|
69
|
+
await self.pub.send(
|
70
|
+
id,
|
71
|
+
self.to_request(data),
|
72
|
+
)
|
73
|
+
|
74
|
+
try:
|
75
|
+
resp = await asyncio.wait_for(q.get(), self.timeout)
|
76
|
+
except:
|
77
|
+
raise RuntimeError("Timeout waiting for response")
|
78
|
+
|
79
|
+
print(resp)
|
80
|
+
|
81
|
+
if resp.error:
|
82
|
+
return web.json_response(
|
83
|
+
{ "error": resp.error.message }
|
84
|
+
)
|
85
|
+
|
86
|
+
return web.json_response(
|
87
|
+
self.from_response(resp)
|
88
|
+
)
|
89
|
+
|
90
|
+
except Exception as e:
|
91
|
+
logging.error(f"Exception: {e}")
|
92
|
+
|
93
|
+
return web.json_response(
|
94
|
+
{ "error": str(e) }
|
95
|
+
)
|
96
|
+
|
97
|
+
finally:
|
98
|
+
await self.sub.unsubscribe(id)
|
99
|
+
|
100
|
+
|
101
|
+
class MultiResponseServiceEndpoint(ServiceEndpoint):
|
102
|
+
|
103
|
+
async def handle(self, request):
|
104
|
+
|
105
|
+
id = str(uuid.uuid4())
|
106
|
+
|
107
|
+
try:
|
108
|
+
|
109
|
+
data = await request.json()
|
110
|
+
|
111
|
+
q = await self.sub.subscribe(id)
|
112
|
+
|
113
|
+
print(data)
|
114
|
+
|
115
|
+
await self.pub.send(
|
116
|
+
id,
|
117
|
+
self.to_request(data),
|
118
|
+
)
|
119
|
+
|
120
|
+
# Keeps looking at responses...
|
121
|
+
|
122
|
+
while True:
|
123
|
+
|
124
|
+
try:
|
125
|
+
resp = await asyncio.wait_for(q.get(), self.timeout)
|
126
|
+
except:
|
127
|
+
raise RuntimeError("Timeout waiting for response")
|
128
|
+
|
129
|
+
print(resp)
|
130
|
+
|
131
|
+
if resp.error:
|
132
|
+
return web.json_response(
|
133
|
+
{ "error": resp.error.message }
|
134
|
+
)
|
135
|
+
|
136
|
+
# Until from_response says we have a finished answer
|
137
|
+
resp, fin = self.from_response(resp)
|
138
|
+
|
139
|
+
|
140
|
+
if fin:
|
141
|
+
return web.json_response(resp)
|
142
|
+
|
143
|
+
# Not finished, so loop round and continue
|
144
|
+
|
145
|
+
except Exception as e:
|
146
|
+
logging.error(f"Exception: {e}")
|
147
|
+
|
148
|
+
return web.json_response(
|
149
|
+
{ "error": str(e) }
|
150
|
+
)
|
151
|
+
|
152
|
+
finally:
|
153
|
+
await self.sub.unsubscribe(id)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
import asyncio
|
3
|
+
from pulsar.schema import JsonSchema
|
4
|
+
import uuid
|
5
|
+
from aiohttp import WSMsgType
|
6
|
+
|
7
|
+
from ... schema import Metadata
|
8
|
+
from ... schema import GraphEmbeddings
|
9
|
+
from ... schema import graph_embeddings_store_queue
|
10
|
+
|
11
|
+
from . publisher import Publisher
|
12
|
+
from . socket import SocketEndpoint
|
13
|
+
from . serialize import to_subgraph, to_value
|
14
|
+
|
15
|
+
class GraphEmbeddingsLoadEndpoint(SocketEndpoint):
|
16
|
+
|
17
|
+
def __init__(self, pulsar_host, path="/api/v1/load/graph-embeddings"):
|
18
|
+
|
19
|
+
super(GraphEmbeddingsLoadEndpoint, self).__init__(
|
20
|
+
endpoint_path=path
|
21
|
+
)
|
22
|
+
|
23
|
+
self.pulsar_host=pulsar_host
|
24
|
+
|
25
|
+
self.publisher = Publisher(
|
26
|
+
self.pulsar_host, graph_embeddings_store_queue,
|
27
|
+
schema=JsonSchema(GraphEmbeddings)
|
28
|
+
)
|
29
|
+
|
30
|
+
async def start(self):
|
31
|
+
|
32
|
+
self.task = asyncio.create_task(
|
33
|
+
self.publisher.run()
|
34
|
+
)
|
35
|
+
|
36
|
+
async def listener(self, ws, running):
|
37
|
+
|
38
|
+
async for msg in ws:
|
39
|
+
# On error, finish
|
40
|
+
if msg.type == WSMsgType.ERROR:
|
41
|
+
break
|
42
|
+
else:
|
43
|
+
|
44
|
+
data = msg.json()
|
45
|
+
|
46
|
+
elt = GraphEmbeddings(
|
47
|
+
metadata=Metadata(
|
48
|
+
id=data["metadata"]["id"],
|
49
|
+
metadata=to_subgraph(data["metadata"]["metadata"]),
|
50
|
+
user=data["metadata"]["user"],
|
51
|
+
collection=data["metadata"]["collection"],
|
52
|
+
),
|
53
|
+
entity=to_value(data["entity"]),
|
54
|
+
vectors=data["vectors"],
|
55
|
+
)
|
56
|
+
|
57
|
+
await self.publisher.send(None, elt)
|
58
|
+
|
59
|
+
|
60
|
+
running.stop()
|
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
import asyncio
|
3
|
+
from pulsar.schema import JsonSchema
|
4
|
+
import uuid
|
5
|
+
|
6
|
+
from ... schema import GraphEmbeddings
|
7
|
+
from ... schema import graph_embeddings_store_queue
|
8
|
+
|
9
|
+
from . subscriber import Subscriber
|
10
|
+
from . socket import SocketEndpoint
|
11
|
+
from . serialize import serialize_graph_embeddings
|
12
|
+
|
13
|
+
class GraphEmbeddingsStreamEndpoint(SocketEndpoint):
|
14
|
+
|
15
|
+
def __init__(self, pulsar_host, path="/api/v1/stream/graph-embeddings"):
|
16
|
+
|
17
|
+
super(GraphEmbeddingsStreamEndpoint, self).__init__(
|
18
|
+
endpoint_path=path
|
19
|
+
)
|
20
|
+
|
21
|
+
self.pulsar_host=pulsar_host
|
22
|
+
|
23
|
+
self.subscriber = Subscriber(
|
24
|
+
self.pulsar_host, graph_embeddings_store_queue,
|
25
|
+
"api-gateway", "api-gateway",
|
26
|
+
schema=JsonSchema(GraphEmbeddings)
|
27
|
+
)
|
28
|
+
|
29
|
+
async def start(self):
|
30
|
+
|
31
|
+
self.task = asyncio.create_task(
|
32
|
+
self.subscriber.run()
|
33
|
+
)
|
34
|
+
|
35
|
+
async def async_thread(self, ws, running):
|
36
|
+
|
37
|
+
id = str(uuid.uuid4())
|
38
|
+
|
39
|
+
q = await self.subscriber.subscribe_all(id)
|
40
|
+
|
41
|
+
while running.get():
|
42
|
+
try:
|
43
|
+
resp = await asyncio.wait_for(q.get(), 0.5)
|
44
|
+
await ws.send_json(serialize_graph_embeddings(resp))
|
45
|
+
|
46
|
+
except TimeoutError:
|
47
|
+
continue
|
48
|
+
|
49
|
+
except Exception as e:
|
50
|
+
print(f"Exception: {str(e)}", flush=True)
|
51
|
+
break
|
52
|
+
|
53
|
+
await self.subscriber.unsubscribe_all(id)
|
54
|
+
|
55
|
+
running.stop()
|
56
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
from ... schema import GraphRagQuery, GraphRagResponse
|
3
|
+
from ... schema import graph_rag_request_queue
|
4
|
+
from ... schema import graph_rag_response_queue
|
5
|
+
|
6
|
+
from . endpoint import ServiceEndpoint
|
7
|
+
|
8
|
+
class GraphRagEndpoint(ServiceEndpoint):
|
9
|
+
def __init__(self, pulsar_host, timeout):
|
10
|
+
|
11
|
+
super(GraphRagEndpoint, self).__init__(
|
12
|
+
pulsar_host=pulsar_host,
|
13
|
+
request_queue=graph_rag_request_queue,
|
14
|
+
response_queue=graph_rag_response_queue,
|
15
|
+
request_schema=GraphRagQuery,
|
16
|
+
response_schema=GraphRagResponse,
|
17
|
+
endpoint_path="/api/v1/graph-rag",
|
18
|
+
timeout=timeout,
|
19
|
+
)
|
20
|
+
|
21
|
+
def to_request(self, body):
|
22
|
+
return GraphRagQuery(
|
23
|
+
query=body["query"],
|
24
|
+
user=body.get("user", "trustgraph"),
|
25
|
+
collection=body.get("collection", "default"),
|
26
|
+
)
|
27
|
+
|
28
|
+
def from_response(self, message):
|
29
|
+
return { "response": message.response }
|
30
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
from ... schema import LookupRequest, LookupResponse
|
3
|
+
from ... schema import internet_search_request_queue
|
4
|
+
from ... schema import internet_search_response_queue
|
5
|
+
|
6
|
+
from . endpoint import ServiceEndpoint
|
7
|
+
|
8
|
+
class InternetSearchEndpoint(ServiceEndpoint):
|
9
|
+
def __init__(self, pulsar_host, timeout):
|
10
|
+
|
11
|
+
super(InternetSearchEndpoint, self).__init__(
|
12
|
+
pulsar_host=pulsar_host,
|
13
|
+
request_queue=internet_search_request_queue,
|
14
|
+
response_queue=internet_search_response_queue,
|
15
|
+
request_schema=LookupRequest,
|
16
|
+
response_schema=LookupResponse,
|
17
|
+
endpoint_path="/api/v1/internet-search",
|
18
|
+
timeout=timeout,
|
19
|
+
)
|
20
|
+
|
21
|
+
def to_request(self, body):
|
22
|
+
return LookupRequest(
|
23
|
+
term=body["term"],
|
24
|
+
kind=body.get("kind", None),
|
25
|
+
)
|
26
|
+
|
27
|
+
def from_response(self, message):
|
28
|
+
return { "text": message.text }
|
29
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
import json
|
3
|
+
|
4
|
+
from ... schema import PromptRequest, PromptResponse
|
5
|
+
from ... schema import prompt_request_queue
|
6
|
+
from ... schema import prompt_response_queue
|
7
|
+
|
8
|
+
from . endpoint import ServiceEndpoint
|
9
|
+
|
10
|
+
class PromptEndpoint(ServiceEndpoint):
|
11
|
+
def __init__(self, pulsar_host, timeout):
|
12
|
+
|
13
|
+
super(PromptEndpoint, self).__init__(
|
14
|
+
pulsar_host=pulsar_host,
|
15
|
+
request_queue=prompt_request_queue,
|
16
|
+
response_queue=prompt_response_queue,
|
17
|
+
request_schema=PromptRequest,
|
18
|
+
response_schema=PromptResponse,
|
19
|
+
endpoint_path="/api/v1/prompt",
|
20
|
+
timeout=timeout,
|
21
|
+
)
|
22
|
+
|
23
|
+
def to_request(self, body):
|
24
|
+
return PromptRequest(
|
25
|
+
id=body["id"],
|
26
|
+
terms={
|
27
|
+
k: json.dumps(v)
|
28
|
+
for k, v in body["variables"].items()
|
29
|
+
}
|
30
|
+
)
|
31
|
+
|
32
|
+
def from_response(self, message):
|
33
|
+
if message.object:
|
34
|
+
return {
|
35
|
+
"object": message.object
|
36
|
+
}
|
37
|
+
else:
|
38
|
+
return {
|
39
|
+
"text": message.text
|
40
|
+
}
|
41
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
import asyncio
|
3
|
+
import aiopulsar
|
4
|
+
|
5
|
+
class Publisher:
|
6
|
+
|
7
|
+
def __init__(self, pulsar_host, topic, schema=None, max_size=10,
|
8
|
+
chunking_enabled=False):
|
9
|
+
self.pulsar_host = pulsar_host
|
10
|
+
self.topic = topic
|
11
|
+
self.schema = schema
|
12
|
+
self.q = asyncio.Queue(maxsize=max_size)
|
13
|
+
self.chunking_enabled = chunking_enabled
|
14
|
+
|
15
|
+
async def run(self):
|
16
|
+
|
17
|
+
while True:
|
18
|
+
|
19
|
+
try:
|
20
|
+
async with aiopulsar.connect(self.pulsar_host) as client:
|
21
|
+
async with client.create_producer(
|
22
|
+
topic=self.topic,
|
23
|
+
schema=self.schema,
|
24
|
+
chunking_enabled=self.chunking_enabled,
|
25
|
+
) as producer:
|
26
|
+
while True:
|
27
|
+
id, item = await self.q.get()
|
28
|
+
|
29
|
+
if id:
|
30
|
+
await producer.send(item, { "id": id })
|
31
|
+
else:
|
32
|
+
await producer.send(item)
|
33
|
+
|
34
|
+
except Exception as e:
|
35
|
+
print("Exception:", e, flush=True)
|
36
|
+
|
37
|
+
# If handler drops out, sleep a retry
|
38
|
+
await asyncio.sleep(2)
|
39
|
+
|
40
|
+
async def send(self, id, msg):
|
41
|
+
await self.q.put((id, msg))
|
@@ -0,0 +1,57 @@
|
|
1
|
+
from ... schema import Value, Triple
|
2
|
+
|
3
|
+
def to_value(x):
|
4
|
+
return Value(value=x["v"], is_uri=x["e"])
|
5
|
+
|
6
|
+
def to_subgraph(x):
|
7
|
+
return [
|
8
|
+
Triple(
|
9
|
+
s=to_value(t["s"]),
|
10
|
+
p=to_value(t["p"]),
|
11
|
+
o=to_value(t["o"])
|
12
|
+
)
|
13
|
+
for t in x
|
14
|
+
]
|
15
|
+
|
16
|
+
def serialize_value(v):
|
17
|
+
return {
|
18
|
+
"v": v.value,
|
19
|
+
"e": v.is_uri,
|
20
|
+
}
|
21
|
+
|
22
|
+
def serialize_triple(t):
|
23
|
+
return {
|
24
|
+
"s": serialize_value(t.s),
|
25
|
+
"p": serialize_value(t.p),
|
26
|
+
"o": serialize_value(t.o)
|
27
|
+
}
|
28
|
+
|
29
|
+
def serialize_subgraph(sg):
|
30
|
+
return [
|
31
|
+
serialize_triple(t)
|
32
|
+
for t in sg
|
33
|
+
]
|
34
|
+
|
35
|
+
def serialize_triples(message):
|
36
|
+
return {
|
37
|
+
"metadata": {
|
38
|
+
"id": message.metadata.id,
|
39
|
+
"metadata": serialize_subgraph(message.metadata.metadata),
|
40
|
+
"user": message.metadata.user,
|
41
|
+
"collection": message.metadata.collection,
|
42
|
+
},
|
43
|
+
"triples": serialize_subgraph(message.triples),
|
44
|
+
}
|
45
|
+
|
46
|
+
def serialize_graph_embeddings(message):
|
47
|
+
return {
|
48
|
+
"metadata": {
|
49
|
+
"id": message.metadata.id,
|
50
|
+
"metadata": serialize_subgraph(message.metadata.metadata),
|
51
|
+
"user": message.metadata.user,
|
52
|
+
"collection": message.metadata.collection,
|
53
|
+
},
|
54
|
+
"vectors": message.vectors,
|
55
|
+
"entity": serialize_value(message.entity),
|
56
|
+
}
|
57
|
+
|