trustgraph-flow 0.16.12__tar.gz → 0.17.1__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.12 → trustgraph-flow-0.17.1}/PKG-INFO +2 -2
- trustgraph-flow-0.17.1/scripts/wikipedia-lookup +6 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/setup.py +2 -1
- trustgraph-flow-0.17.1/trustgraph/api/gateway/agent.py +31 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/auth.py +22 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/dbpedia.py +30 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/embeddings.py +28 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/encyclopedia.py +30 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/endpoint.py +161 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/graph_embeddings_load.py +62 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/graph_embeddings_stream.py +58 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/graph_rag.py +31 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/internet_search.py +30 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/prompt.py +42 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/publisher.py +41 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/running.py +5 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/serialize.py +57 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/service.py +316 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/socket.py +84 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/subscriber.py +68 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/text_completion.py +29 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/triples_load.py +59 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/triples_query.py +54 -0
- trustgraph-flow-0.17.1/trustgraph/api/gateway/triples_stream.py +56 -0
- {trustgraph-flow-0.16.12/trustgraph/model/prompt/generic → trustgraph-flow-0.17.1/trustgraph/external/wikipedia}/__main__.py +0 -0
- trustgraph-flow-0.17.1/trustgraph/external/wikipedia/service.py +102 -0
- trustgraph-flow-0.17.1/trustgraph/flow_version.py +1 -0
- trustgraph-flow-0.17.1/trustgraph/model/prompt/template/__main__.py +7 -0
- trustgraph-flow-0.17.1/trustgraph/query/triples/neo4j/__init__.py +3 -0
- trustgraph-flow-0.17.1/trustgraph/storage/triples/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph_flow.egg-info/PKG-INFO +2 -2
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph_flow.egg-info/SOURCES.txt +25 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph_flow.egg-info/requires.txt +1 -1
- trustgraph-flow-0.16.12/trustgraph/api/gateway/service.py +0 -1026
- trustgraph-flow-0.16.12/trustgraph/flow_version.py +0 -1
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/README.md +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/agent-manager-react +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/api-gateway +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/chunker-recursive +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/chunker-token +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/de-query-milvus +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/de-query-pinecone +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/de-query-qdrant +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/de-write-milvus +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/de-write-pinecone +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/de-write-qdrant +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/document-rag +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/embeddings-ollama +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/embeddings-vectorize +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/ge-query-milvus +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/ge-query-pinecone +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/ge-query-qdrant +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/ge-write-milvus +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/ge-write-pinecone +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/ge-write-qdrant +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/graph-rag +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/kg-extract-definitions +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/kg-extract-relationships +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/kg-extract-topics +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/metering +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/object-extract-row +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/oe-write-milvus +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/pdf-decoder +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/prompt-generic +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/prompt-template +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/rows-write-cassandra +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/run-processing +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/text-completion-azure +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/text-completion-azure-openai +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/text-completion-claude +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/text-completion-cohere +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/text-completion-googleaistudio +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/text-completion-llamafile +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/text-completion-ollama +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/text-completion-openai +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/triples-query-cassandra +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/triples-query-neo4j +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/triples-write-cassandra +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/scripts/triples-write-neo4j +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/setup.cfg +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/agent/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/agent/react/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/agent/react/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/agent/react/agent_manager.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/agent/react/service.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/agent/react/tools.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/agent/react/types.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/api/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/api/gateway/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/api/gateway/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/chunking/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/chunking/recursive/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/chunking/recursive/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/chunking/recursive/chunker.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/chunking/token/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/chunking/token/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/chunking/token/chunker.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/decoding/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/decoding/pdf/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/decoding/pdf/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/decoding/pdf/pdf_decoder.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/direct/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/direct/cassandra.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/direct/milvus_doc_embeddings.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/direct/milvus_graph_embeddings.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/direct/milvus_object_embeddings.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/document_rag.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/embeddings/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/embeddings/ollama/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/embeddings/ollama/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/embeddings/ollama/processor.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/embeddings/vectorize/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/embeddings/vectorize/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/embeddings/vectorize/vectorize.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/extract → trustgraph-flow-0.17.1/trustgraph/external}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/model/prompt/generic → trustgraph-flow-0.17.1/trustgraph/external/wikipedia}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/extract/kg → trustgraph-flow-0.17.1/trustgraph/extract}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/extract/object → trustgraph-flow-0.17.1/trustgraph/extract/kg}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/kg/definitions/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/kg/definitions/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/kg/definitions/extract.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/kg/relationships/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/kg/relationships/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/kg/relationships/extract.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/kg/topics/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/kg/topics/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/kg/topics/extract.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/model → trustgraph-flow-0.17.1/trustgraph/extract/object}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/object/row/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/object/row/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/extract/object/row/extract.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/graph_rag.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/metering/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/metering/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/metering/counter.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/metering/pricelist.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/model/prompt → trustgraph-flow-0.17.1/trustgraph/model}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/model/text_completion → trustgraph-flow-0.17.1/trustgraph/model/prompt}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/model/prompt/template → trustgraph-flow-0.17.1/trustgraph/model/prompt/generic}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/model/prompt/template → trustgraph-flow-0.17.1/trustgraph/model/prompt/generic}/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/prompt/generic/prompts.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/prompt/generic/service.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/doc_embeddings/milvus → trustgraph-flow-0.17.1/trustgraph/model/prompt/template}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/prompt/template/prompt_manager.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/prompt/template/service.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query → trustgraph-flow-0.17.1/trustgraph/model/text_completion}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/azure/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/azure/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/azure/llm.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/azure_openai/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/azure_openai/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/azure_openai/llm.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/claude/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/claude/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/claude/llm.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/cohere/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/cohere/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/cohere/llm.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/googleaistudio/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/googleaistudio/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/googleaistudio/llm.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/llamafile/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/llamafile/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/llamafile/llm.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/ollama/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/ollama/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/ollama/llm.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/openai/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/openai/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/model/text_completion/openai/llm.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/processing/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/processing/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/processing/processing.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/doc_embeddings → trustgraph-flow-0.17.1/trustgraph/query}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/graph_embeddings → trustgraph-flow-0.17.1/trustgraph/query/doc_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/doc_embeddings/pinecone → trustgraph-flow-0.17.1/trustgraph/query/doc_embeddings/milvus}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/doc_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/doc_embeddings/qdrant → trustgraph-flow-0.17.1/trustgraph/query/doc_embeddings/pinecone}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/doc_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/doc_embeddings/pinecone/service.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/graph_embeddings/milvus → trustgraph-flow-0.17.1/trustgraph/query/doc_embeddings/qdrant}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/doc_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/triples → trustgraph-flow-0.17.1/trustgraph/query/graph_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/graph_embeddings/pinecone → trustgraph-flow-0.17.1/trustgraph/query/graph_embeddings/milvus}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/graph_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/graph_embeddings/qdrant → trustgraph-flow-0.17.1/trustgraph/query/graph_embeddings/pinecone}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/graph_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/graph_embeddings/pinecone/service.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/triples/cassandra → trustgraph-flow-0.17.1/trustgraph/query/graph_embeddings/qdrant}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/graph_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/retrieval → trustgraph-flow-0.17.1/trustgraph/query/triples}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/query/triples/neo4j → trustgraph-flow-0.17.1/trustgraph/query/triples/cassandra}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/triples/cassandra/service.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/query/triples/neo4j/service.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/storage → trustgraph-flow-0.17.1/trustgraph/retrieval}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/retrieval/document_rag/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/retrieval/document_rag/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/retrieval/document_rag/rag.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/retrieval/graph_rag/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/retrieval/graph_rag/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/retrieval/graph_rag/rag.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/storage/doc_embeddings → trustgraph-flow-0.17.1/trustgraph/storage}/__init__.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/storage/graph_embeddings → trustgraph-flow-0.17.1/trustgraph/storage/doc_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/doc_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/doc_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/doc_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/doc_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/doc_embeddings/pinecone/write.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/doc_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/doc_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/storage/object_embeddings → trustgraph-flow-0.17.1/trustgraph/storage/graph_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/graph_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/graph_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/graph_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/graph_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/graph_embeddings/pinecone/write.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/graph_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/graph_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/storage/rows → trustgraph-flow-0.17.1/trustgraph/storage/object_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/object_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/object_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/object_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.16.12/trustgraph/storage/triples → trustgraph-flow-0.17.1/trustgraph/storage/rows}/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/rows/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/rows/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/rows/cassandra/write.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/triples/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/triples/cassandra/write.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/triples/neo4j/__init__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph/storage/triples/neo4j/write.py +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/trustgraph_flow.egg-info/dependency_links.txt +0 -0
- {trustgraph-flow-0.16.12 → trustgraph-flow-0.17.1}/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.1
|
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.1.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,31 @@
|
|
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, auth):
|
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
|
+
auth=auth,
|
20
|
+
)
|
21
|
+
|
22
|
+
def to_request(self, body):
|
23
|
+
return AgentRequest(
|
24
|
+
question=body["question"]
|
25
|
+
)
|
26
|
+
|
27
|
+
def from_response(self, message):
|
28
|
+
if message.answer:
|
29
|
+
return { "answer": message.answer }, True
|
30
|
+
else:
|
31
|
+
return {}, False
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
class Authenticator:
|
3
|
+
|
4
|
+
def __init__(self, token=None, allow_all=False):
|
5
|
+
|
6
|
+
if not allow_all and token is None:
|
7
|
+
raise RuntimeError("Need a token")
|
8
|
+
|
9
|
+
if not allow_all and token == "":
|
10
|
+
raise RuntimeError("Need a token")
|
11
|
+
|
12
|
+
self.token = token
|
13
|
+
self.allow_all = allow_all
|
14
|
+
|
15
|
+
def permitted(self, token, roles):
|
16
|
+
|
17
|
+
if self.allow_all: return True
|
18
|
+
|
19
|
+
if self.token != token: return False
|
20
|
+
|
21
|
+
return True
|
22
|
+
|
@@ -0,0 +1,30 @@
|
|
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, auth):
|
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
|
+
auth=auth,
|
20
|
+
)
|
21
|
+
|
22
|
+
def to_request(self, body):
|
23
|
+
return LookupRequest(
|
24
|
+
term=body["term"],
|
25
|
+
kind=body.get("kind", None),
|
26
|
+
)
|
27
|
+
|
28
|
+
def from_response(self, message):
|
29
|
+
return { "text": message.text }
|
30
|
+
|
@@ -0,0 +1,28 @@
|
|
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, auth):
|
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
|
+
auth=auth,
|
20
|
+
)
|
21
|
+
|
22
|
+
def to_request(self, body):
|
23
|
+
return EmbeddingsRequest(
|
24
|
+
text=body["text"]
|
25
|
+
)
|
26
|
+
|
27
|
+
def from_response(self, message):
|
28
|
+
return { "vectors": message.vectors }
|
@@ -0,0 +1,30 @@
|
|
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, auth):
|
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
|
+
auth=auth,
|
20
|
+
)
|
21
|
+
|
22
|
+
def to_request(self, body):
|
23
|
+
return LookupRequest(
|
24
|
+
term=body["term"],
|
25
|
+
kind=body.get("kind", None),
|
26
|
+
)
|
27
|
+
|
28
|
+
def from_response(self, message):
|
29
|
+
return { "text": message.text }
|
30
|
+
|
@@ -0,0 +1,161 @@
|
|
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
|
+
auth,
|
23
|
+
subscription="api-gateway", consumer_name="api-gateway",
|
24
|
+
timeout=600,
|
25
|
+
):
|
26
|
+
|
27
|
+
self.pub = Publisher(
|
28
|
+
pulsar_host, request_queue,
|
29
|
+
schema=JsonSchema(request_schema)
|
30
|
+
)
|
31
|
+
|
32
|
+
self.sub = Subscriber(
|
33
|
+
pulsar_host, response_queue,
|
34
|
+
subscription, consumer_name,
|
35
|
+
JsonSchema(response_schema)
|
36
|
+
)
|
37
|
+
|
38
|
+
self.path = endpoint_path
|
39
|
+
self.timeout = timeout
|
40
|
+
self.auth = auth
|
41
|
+
|
42
|
+
self.operation = "service"
|
43
|
+
|
44
|
+
async def start(self):
|
45
|
+
|
46
|
+
self.pub_task = asyncio.create_task(self.pub.run())
|
47
|
+
self.sub_task = asyncio.create_task(self.sub.run())
|
48
|
+
|
49
|
+
def add_routes(self, app):
|
50
|
+
|
51
|
+
app.add_routes([
|
52
|
+
web.post(self.path, self.handle),
|
53
|
+
])
|
54
|
+
|
55
|
+
def to_request(self, request):
|
56
|
+
raise RuntimeError("Not defined")
|
57
|
+
|
58
|
+
def from_response(self, response):
|
59
|
+
raise RuntimeError("Not defined")
|
60
|
+
|
61
|
+
async def handle(self, request):
|
62
|
+
|
63
|
+
id = str(uuid.uuid4())
|
64
|
+
|
65
|
+
try:
|
66
|
+
ht = request.headers["Authorization"]
|
67
|
+
tokens = ht.split(" ", 2)
|
68
|
+
if tokens[0] != "Bearer":
|
69
|
+
return web.HTTPUnauthorized()
|
70
|
+
token = tokens[1]
|
71
|
+
except:
|
72
|
+
token = ""
|
73
|
+
|
74
|
+
if not self.auth.permitted(token, self.operation):
|
75
|
+
return web.HTTPUnauthorized()
|
76
|
+
|
77
|
+
try:
|
78
|
+
|
79
|
+
data = await request.json()
|
80
|
+
|
81
|
+
q = await self.sub.subscribe(id)
|
82
|
+
|
83
|
+
await self.pub.send(
|
84
|
+
id,
|
85
|
+
self.to_request(data),
|
86
|
+
)
|
87
|
+
|
88
|
+
try:
|
89
|
+
resp = await asyncio.wait_for(q.get(), self.timeout)
|
90
|
+
except:
|
91
|
+
raise RuntimeError("Timeout waiting for response")
|
92
|
+
|
93
|
+
if resp.error:
|
94
|
+
return web.json_response(
|
95
|
+
{ "error": resp.error.message }
|
96
|
+
)
|
97
|
+
|
98
|
+
return web.json_response(
|
99
|
+
self.from_response(resp)
|
100
|
+
)
|
101
|
+
|
102
|
+
except Exception as e:
|
103
|
+
logging.error(f"Exception: {e}")
|
104
|
+
|
105
|
+
return web.json_response(
|
106
|
+
{ "error": str(e) }
|
107
|
+
)
|
108
|
+
|
109
|
+
finally:
|
110
|
+
await self.sub.unsubscribe(id)
|
111
|
+
|
112
|
+
|
113
|
+
class MultiResponseServiceEndpoint(ServiceEndpoint):
|
114
|
+
|
115
|
+
async def handle(self, request):
|
116
|
+
|
117
|
+
id = str(uuid.uuid4())
|
118
|
+
|
119
|
+
try:
|
120
|
+
|
121
|
+
data = await request.json()
|
122
|
+
|
123
|
+
q = await self.sub.subscribe(id)
|
124
|
+
|
125
|
+
await self.pub.send(
|
126
|
+
id,
|
127
|
+
self.to_request(data),
|
128
|
+
)
|
129
|
+
|
130
|
+
# Keeps looking at responses...
|
131
|
+
|
132
|
+
while True:
|
133
|
+
|
134
|
+
try:
|
135
|
+
resp = await asyncio.wait_for(q.get(), self.timeout)
|
136
|
+
except:
|
137
|
+
raise RuntimeError("Timeout waiting for response")
|
138
|
+
|
139
|
+
if resp.error:
|
140
|
+
return web.json_response(
|
141
|
+
{ "error": resp.error.message }
|
142
|
+
)
|
143
|
+
|
144
|
+
# Until from_response says we have a finished answer
|
145
|
+
resp, fin = self.from_response(resp)
|
146
|
+
|
147
|
+
|
148
|
+
if fin:
|
149
|
+
return web.json_response(resp)
|
150
|
+
|
151
|
+
# Not finished, so loop round and continue
|
152
|
+
|
153
|
+
except Exception as e:
|
154
|
+
logging.error(f"Exception: {e}")
|
155
|
+
|
156
|
+
return web.json_response(
|
157
|
+
{ "error": str(e) }
|
158
|
+
)
|
159
|
+
|
160
|
+
finally:
|
161
|
+
await self.sub.unsubscribe(id)
|
@@ -0,0 +1,62 @@
|
|
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__(
|
18
|
+
self, pulsar_host, auth, path="/api/v1/load/graph-embeddings",
|
19
|
+
):
|
20
|
+
|
21
|
+
super(GraphEmbeddingsLoadEndpoint, self).__init__(
|
22
|
+
endpoint_path=path, auth=auth,
|
23
|
+
)
|
24
|
+
|
25
|
+
self.pulsar_host=pulsar_host
|
26
|
+
|
27
|
+
self.publisher = Publisher(
|
28
|
+
self.pulsar_host, graph_embeddings_store_queue,
|
29
|
+
schema=JsonSchema(GraphEmbeddings)
|
30
|
+
)
|
31
|
+
|
32
|
+
async def start(self):
|
33
|
+
|
34
|
+
self.task = asyncio.create_task(
|
35
|
+
self.publisher.run()
|
36
|
+
)
|
37
|
+
|
38
|
+
async def listener(self, ws, running):
|
39
|
+
|
40
|
+
async for msg in ws:
|
41
|
+
# On error, finish
|
42
|
+
if msg.type == WSMsgType.ERROR:
|
43
|
+
break
|
44
|
+
else:
|
45
|
+
|
46
|
+
data = msg.json()
|
47
|
+
|
48
|
+
elt = GraphEmbeddings(
|
49
|
+
metadata=Metadata(
|
50
|
+
id=data["metadata"]["id"],
|
51
|
+
metadata=to_subgraph(data["metadata"]["metadata"]),
|
52
|
+
user=data["metadata"]["user"],
|
53
|
+
collection=data["metadata"]["collection"],
|
54
|
+
),
|
55
|
+
entity=to_value(data["entity"]),
|
56
|
+
vectors=data["vectors"],
|
57
|
+
)
|
58
|
+
|
59
|
+
await self.publisher.send(None, elt)
|
60
|
+
|
61
|
+
|
62
|
+
running.stop()
|
@@ -0,0 +1,58 @@
|
|
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__(
|
16
|
+
self, pulsar_host, auth, path="/api/v1/stream/graph-embeddings"
|
17
|
+
):
|
18
|
+
|
19
|
+
super(GraphEmbeddingsStreamEndpoint, self).__init__(
|
20
|
+
endpoint_path=path, auth=auth,
|
21
|
+
)
|
22
|
+
|
23
|
+
self.pulsar_host=pulsar_host
|
24
|
+
|
25
|
+
self.subscriber = Subscriber(
|
26
|
+
self.pulsar_host, graph_embeddings_store_queue,
|
27
|
+
"api-gateway", "api-gateway",
|
28
|
+
schema=JsonSchema(GraphEmbeddings)
|
29
|
+
)
|
30
|
+
|
31
|
+
async def start(self):
|
32
|
+
|
33
|
+
self.task = asyncio.create_task(
|
34
|
+
self.subscriber.run()
|
35
|
+
)
|
36
|
+
|
37
|
+
async def async_thread(self, ws, running):
|
38
|
+
|
39
|
+
id = str(uuid.uuid4())
|
40
|
+
|
41
|
+
q = await self.subscriber.subscribe_all(id)
|
42
|
+
|
43
|
+
while running.get():
|
44
|
+
try:
|
45
|
+
resp = await asyncio.wait_for(q.get(), 0.5)
|
46
|
+
await ws.send_json(serialize_graph_embeddings(resp))
|
47
|
+
|
48
|
+
except TimeoutError:
|
49
|
+
continue
|
50
|
+
|
51
|
+
except Exception as e:
|
52
|
+
print(f"Exception: {str(e)}", flush=True)
|
53
|
+
break
|
54
|
+
|
55
|
+
await self.subscriber.unsubscribe_all(id)
|
56
|
+
|
57
|
+
running.stop()
|
58
|
+
|
@@ -0,0 +1,31 @@
|
|
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, auth):
|
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
|
+
auth=auth,
|
20
|
+
)
|
21
|
+
|
22
|
+
def to_request(self, body):
|
23
|
+
return GraphRagQuery(
|
24
|
+
query=body["query"],
|
25
|
+
user=body.get("user", "trustgraph"),
|
26
|
+
collection=body.get("collection", "default"),
|
27
|
+
)
|
28
|
+
|
29
|
+
def from_response(self, message):
|
30
|
+
return { "response": message.response }
|
31
|
+
|
@@ -0,0 +1,30 @@
|
|
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, auth):
|
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
|
+
auth=auth,
|
20
|
+
)
|
21
|
+
|
22
|
+
def to_request(self, body):
|
23
|
+
return LookupRequest(
|
24
|
+
term=body["term"],
|
25
|
+
kind=body.get("kind", None),
|
26
|
+
)
|
27
|
+
|
28
|
+
def from_response(self, message):
|
29
|
+
return { "text": message.text }
|
30
|
+
|
@@ -0,0 +1,42 @@
|
|
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, auth):
|
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
|
+
auth=auth,
|
22
|
+
)
|
23
|
+
|
24
|
+
def to_request(self, body):
|
25
|
+
return PromptRequest(
|
26
|
+
id=body["id"],
|
27
|
+
terms={
|
28
|
+
k: json.dumps(v)
|
29
|
+
for k, v in body["variables"].items()
|
30
|
+
}
|
31
|
+
)
|
32
|
+
|
33
|
+
def from_response(self, message):
|
34
|
+
if message.object:
|
35
|
+
return {
|
36
|
+
"object": message.object
|
37
|
+
}
|
38
|
+
else:
|
39
|
+
return {
|
40
|
+
"text": message.text
|
41
|
+
}
|
42
|
+
|
@@ -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
|
+
|