trustgraph-flow 0.15.6__tar.gz → 0.16.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.15.6 → trustgraph-flow-0.16.1}/PKG-INFO +2 -2
- trustgraph-flow-0.16.1/scripts/api-gateway +6 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/setup.py +4 -1
- trustgraph-flow-0.16.1/trustgraph/api/gateway/service.py +631 -0
- trustgraph-flow-0.16.1/trustgraph/flow_version.py +1 -0
- trustgraph-flow-0.16.1/trustgraph/model/prompt/template/__main__.py +7 -0
- trustgraph-flow-0.16.1/trustgraph/query/triples/neo4j/__init__.py +3 -0
- trustgraph-flow-0.16.1/trustgraph/storage/triples/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph_flow.egg-info/PKG-INFO +2 -2
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph_flow.egg-info/SOURCES.txt +5 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph_flow.egg-info/requires.txt +3 -1
- trustgraph-flow-0.15.6/trustgraph/flow_version.py +0 -1
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/README.md +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/agent-manager-react +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/chunker-recursive +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/chunker-token +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/de-query-milvus +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/de-query-qdrant +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/de-write-milvus +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/de-write-qdrant +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/document-rag +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/embeddings-ollama +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/embeddings-vectorize +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/ge-query-milvus +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/ge-query-qdrant +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/ge-write-milvus +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/ge-write-qdrant +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/graph-rag +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/kg-extract-definitions +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/kg-extract-relationships +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/kg-extract-topics +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/metering +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/object-extract-row +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/oe-write-milvus +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/pdf-decoder +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/prompt-generic +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/prompt-template +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/rows-write-cassandra +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/run-processing +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/text-completion-azure +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/text-completion-azure-openai +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/text-completion-claude +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/text-completion-cohere +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/text-completion-googleaistudio +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/text-completion-llamafile +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/text-completion-ollama +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/text-completion-openai +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/triples-query-cassandra +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/triples-query-neo4j +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/triples-write-cassandra +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/scripts/triples-write-neo4j +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/setup.cfg +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/agent/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/agent/react/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/agent/react/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/agent/react/agent_manager.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/agent/react/service.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/agent/react/tools.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/agent/react/types.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/chunking → trustgraph-flow-0.16.1/trustgraph/api}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/model/prompt/generic → trustgraph-flow-0.16.1/trustgraph/api/gateway}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/model/prompt/generic → trustgraph-flow-0.16.1/trustgraph/api/gateway}/__main__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/decoding → trustgraph-flow-0.16.1/trustgraph/chunking}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/chunking/recursive/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/chunking/recursive/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/chunking/recursive/chunker.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/chunking/token/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/chunking/token/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/chunking/token/chunker.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/direct → trustgraph-flow-0.16.1/trustgraph/decoding}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/decoding/pdf/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/decoding/pdf/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/decoding/pdf/pdf_decoder.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/embeddings → trustgraph-flow-0.16.1/trustgraph/direct}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/direct/cassandra.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/direct/milvus_doc_embeddings.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/direct/milvus_graph_embeddings.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/direct/milvus_object_embeddings.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/document_rag.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/extract → trustgraph-flow-0.16.1/trustgraph/embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/embeddings/ollama/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/embeddings/ollama/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/embeddings/ollama/processor.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/embeddings/vectorize/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/embeddings/vectorize/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/embeddings/vectorize/vectorize.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/extract/kg → trustgraph-flow-0.16.1/trustgraph/extract}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/extract/object → trustgraph-flow-0.16.1/trustgraph/extract/kg}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/kg/definitions/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/kg/definitions/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/kg/definitions/extract.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/kg/relationships/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/kg/relationships/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/kg/relationships/extract.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/kg/topics/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/kg/topics/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/kg/topics/extract.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/model → trustgraph-flow-0.16.1/trustgraph/extract/object}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/object/row/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/object/row/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/extract/object/row/extract.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/graph_rag.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/metering/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/metering/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/metering/counter.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/metering/pricelist.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/model/prompt → trustgraph-flow-0.16.1/trustgraph/model}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/model/text_completion → trustgraph-flow-0.16.1/trustgraph/model/prompt}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/model/prompt/template → trustgraph-flow-0.16.1/trustgraph/model/prompt/generic}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/model/prompt/template → trustgraph-flow-0.16.1/trustgraph/model/prompt/generic}/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/prompt/generic/prompts.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/prompt/generic/service.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/query/doc_embeddings/milvus → trustgraph-flow-0.16.1/trustgraph/model/prompt/template}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/prompt/template/prompt_manager.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/prompt/template/service.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/query → trustgraph-flow-0.16.1/trustgraph/model/text_completion}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/azure/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/azure/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/azure/llm.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/azure_openai/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/azure_openai/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/azure_openai/llm.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/claude/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/claude/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/claude/llm.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/cohere/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/cohere/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/cohere/llm.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/googleaistudio/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/googleaistudio/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/googleaistudio/llm.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/llamafile/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/llamafile/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/llamafile/llm.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/ollama/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/ollama/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/ollama/llm.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/openai/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/openai/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/model/text_completion/openai/llm.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/processing/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/processing/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/processing/processing.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/query/doc_embeddings → trustgraph-flow-0.16.1/trustgraph/query}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/query/graph_embeddings → trustgraph-flow-0.16.1/trustgraph/query/doc_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/query/doc_embeddings/qdrant → trustgraph-flow-0.16.1/trustgraph/query/doc_embeddings/milvus}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/doc_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/query/graph_embeddings/milvus → trustgraph-flow-0.16.1/trustgraph/query/doc_embeddings/qdrant}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/doc_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/query/triples → trustgraph-flow-0.16.1/trustgraph/query/graph_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/query/graph_embeddings/qdrant → trustgraph-flow-0.16.1/trustgraph/query/graph_embeddings/milvus}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/graph_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/query/triples/cassandra → trustgraph-flow-0.16.1/trustgraph/query/graph_embeddings/qdrant}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/graph_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/retrieval → trustgraph-flow-0.16.1/trustgraph/query/triples}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/query/triples/neo4j → trustgraph-flow-0.16.1/trustgraph/query/triples/cassandra}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/triples/cassandra/service.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/query/triples/neo4j/service.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/storage → trustgraph-flow-0.16.1/trustgraph/retrieval}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/retrieval/document_rag/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/retrieval/document_rag/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/retrieval/document_rag/rag.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/retrieval/graph_rag/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/retrieval/graph_rag/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/retrieval/graph_rag/rag.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/storage/doc_embeddings → trustgraph-flow-0.16.1/trustgraph/storage}/__init__.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/storage/graph_embeddings → trustgraph-flow-0.16.1/trustgraph/storage/doc_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/doc_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/doc_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/doc_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/doc_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/storage/object_embeddings → trustgraph-flow-0.16.1/trustgraph/storage/graph_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/graph_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/graph_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/graph_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/graph_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/storage/rows → trustgraph-flow-0.16.1/trustgraph/storage/object_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/object_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/object_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/object_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.15.6/trustgraph/storage/triples → trustgraph-flow-0.16.1/trustgraph/storage/rows}/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/rows/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/rows/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/rows/cassandra/write.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/triples/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/triples/cassandra/write.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/triples/neo4j/__init__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph/storage/triples/neo4j/write.py +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.1}/trustgraph_flow.egg-info/dependency_links.txt +0 -0
- {trustgraph-flow-0.15.6 → trustgraph-flow-0.16.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.16.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.16.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.16,<0.17",
|
38
38
|
"urllib3",
|
39
39
|
"rdflib",
|
40
40
|
"pymilvus",
|
@@ -58,8 +58,11 @@ setuptools.setup(
|
|
58
58
|
"google-generativeai",
|
59
59
|
"ibis",
|
60
60
|
"jsonschema",
|
61
|
+
"aiohttp",
|
62
|
+
"aiopulsar-py",
|
61
63
|
],
|
62
64
|
scripts=[
|
65
|
+
"scripts/api-gateway",
|
63
66
|
"scripts/agent-manager-react",
|
64
67
|
"scripts/chunker-recursive",
|
65
68
|
"scripts/chunker-token",
|
@@ -0,0 +1,631 @@
|
|
1
|
+
|
2
|
+
"""
|
3
|
+
API gateway. Offers HTTP services which are translated to interaction on the
|
4
|
+
Pulsar bus.
|
5
|
+
"""
|
6
|
+
|
7
|
+
module = ".".join(__name__.split(".")[1:-1])
|
8
|
+
|
9
|
+
# FIXME: Subscribes to Pulsar unnecessarily, should only do it when there
|
10
|
+
# are active listeners
|
11
|
+
|
12
|
+
# FIXME: Connection errors in publishers / subscribers cause those threads
|
13
|
+
# to fail and are not failed or retried
|
14
|
+
|
15
|
+
import asyncio
|
16
|
+
import argparse
|
17
|
+
from aiohttp import web
|
18
|
+
import json
|
19
|
+
import logging
|
20
|
+
import uuid
|
21
|
+
import os
|
22
|
+
|
23
|
+
import pulsar
|
24
|
+
from pulsar.asyncio import Client
|
25
|
+
from pulsar.schema import JsonSchema
|
26
|
+
import _pulsar
|
27
|
+
import aiopulsar
|
28
|
+
from prometheus_client import start_http_server
|
29
|
+
|
30
|
+
from ... log_level import LogLevel
|
31
|
+
|
32
|
+
from trustgraph.clients.llm_client import LlmClient
|
33
|
+
from trustgraph.clients.prompt_client import PromptClient
|
34
|
+
|
35
|
+
from ... schema import TextCompletionRequest, TextCompletionResponse
|
36
|
+
from ... schema import text_completion_request_queue
|
37
|
+
from ... schema import text_completion_response_queue
|
38
|
+
|
39
|
+
from ... schema import PromptRequest, PromptResponse
|
40
|
+
from ... schema import prompt_request_queue
|
41
|
+
from ... schema import prompt_response_queue
|
42
|
+
|
43
|
+
from ... schema import GraphRagQuery, GraphRagResponse
|
44
|
+
from ... schema import graph_rag_request_queue
|
45
|
+
from ... schema import graph_rag_response_queue
|
46
|
+
|
47
|
+
from ... schema import TriplesQueryRequest, TriplesQueryResponse, Value
|
48
|
+
from ... schema import triples_request_queue
|
49
|
+
from ... schema import triples_response_queue
|
50
|
+
|
51
|
+
from ... schema import AgentRequest, AgentResponse
|
52
|
+
from ... schema import agent_request_queue
|
53
|
+
from ... schema import agent_response_queue
|
54
|
+
|
55
|
+
from ... schema import EmbeddingsRequest, EmbeddingsResponse
|
56
|
+
from ... schema import embeddings_request_queue
|
57
|
+
from ... schema import embeddings_response_queue
|
58
|
+
|
59
|
+
logger = logging.getLogger("api")
|
60
|
+
logger.setLevel(logging.INFO)
|
61
|
+
|
62
|
+
default_pulsar_host = os.getenv("PULSAR_HOST", "pulsar://pulsar:6650")
|
63
|
+
default_timeout = 600
|
64
|
+
default_port = 8088
|
65
|
+
|
66
|
+
class Publisher:
|
67
|
+
|
68
|
+
def __init__(self, pulsar_host, topic, schema=None, max_size=10):
|
69
|
+
self.pulsar_host = pulsar_host
|
70
|
+
self.topic = topic
|
71
|
+
self.schema = schema
|
72
|
+
self.q = asyncio.Queue(maxsize=max_size)
|
73
|
+
|
74
|
+
async def run(self):
|
75
|
+
|
76
|
+
while True:
|
77
|
+
|
78
|
+
try:
|
79
|
+
async with aiopulsar.connect(self.pulsar_host) as client:
|
80
|
+
async with client.create_producer(
|
81
|
+
topic=self.topic,
|
82
|
+
schema=self.schema,
|
83
|
+
) as producer:
|
84
|
+
while True:
|
85
|
+
id, item = await self.q.get()
|
86
|
+
await producer.send(item, { "id": id })
|
87
|
+
except Exception as e:
|
88
|
+
print("Exception:", e, flush=True)
|
89
|
+
|
90
|
+
# If handler drops out, sleep a retry
|
91
|
+
await asyncio.sleep(2)
|
92
|
+
|
93
|
+
async def send(self, id, msg):
|
94
|
+
await self.q.put((id, msg))
|
95
|
+
|
96
|
+
class Subscriber:
|
97
|
+
|
98
|
+
def __init__(self, pulsar_host, topic, subscription, consumer_name,
|
99
|
+
schema=None, max_size=10):
|
100
|
+
self.pulsar_host = pulsar_host
|
101
|
+
self.topic = topic
|
102
|
+
self.subscription = subscription
|
103
|
+
self.consumer_name = consumer_name
|
104
|
+
self.schema = schema
|
105
|
+
self.q = {}
|
106
|
+
|
107
|
+
async def run(self):
|
108
|
+
while True:
|
109
|
+
try:
|
110
|
+
async with aiopulsar.connect(self.pulsar_host) as client:
|
111
|
+
async with client.subscribe(
|
112
|
+
topic=self.topic,
|
113
|
+
subscription_name=self.subscription,
|
114
|
+
consumer_name=self.consumer_name,
|
115
|
+
schema=self.schema,
|
116
|
+
) as consumer:
|
117
|
+
while True:
|
118
|
+
msg = await consumer.receive()
|
119
|
+
id = msg.properties()["id"]
|
120
|
+
value = msg.value()
|
121
|
+
if id in self.q:
|
122
|
+
await self.q[id].put(value)
|
123
|
+
except Exception as e:
|
124
|
+
print("Exception:", e, flush=True)
|
125
|
+
|
126
|
+
# If handler drops out, sleep a retry
|
127
|
+
await asyncio.sleep(2)
|
128
|
+
|
129
|
+
async def subscribe(self, id):
|
130
|
+
q = asyncio.Queue()
|
131
|
+
self.q[id] = q
|
132
|
+
return q
|
133
|
+
|
134
|
+
async def unsubscribe(self, id):
|
135
|
+
if id in self.q:
|
136
|
+
del self.q[id]
|
137
|
+
|
138
|
+
class Api:
|
139
|
+
|
140
|
+
def __init__(self, **config):
|
141
|
+
|
142
|
+
self.app = web.Application(middlewares=[])
|
143
|
+
|
144
|
+
self.port = int(config.get("port", default_port))
|
145
|
+
self.timeout = int(config.get("timeout", default_timeout))
|
146
|
+
self.pulsar_host = config.get("pulsar_host", default_pulsar_host)
|
147
|
+
|
148
|
+
self.llm_out = Publisher(
|
149
|
+
self.pulsar_host, text_completion_request_queue,
|
150
|
+
schema=JsonSchema(TextCompletionRequest)
|
151
|
+
)
|
152
|
+
|
153
|
+
self.llm_in = Subscriber(
|
154
|
+
self.pulsar_host, text_completion_response_queue,
|
155
|
+
"api-gateway", "api-gateway",
|
156
|
+
JsonSchema(TextCompletionResponse)
|
157
|
+
)
|
158
|
+
|
159
|
+
self.prompt_out = Publisher(
|
160
|
+
self.pulsar_host, prompt_request_queue,
|
161
|
+
schema=JsonSchema(PromptRequest)
|
162
|
+
)
|
163
|
+
|
164
|
+
self.prompt_in = Subscriber(
|
165
|
+
self.pulsar_host, prompt_response_queue,
|
166
|
+
"api-gateway", "api-gateway",
|
167
|
+
JsonSchema(PromptResponse)
|
168
|
+
)
|
169
|
+
|
170
|
+
self.graph_rag_out = Publisher(
|
171
|
+
self.pulsar_host, graph_rag_request_queue,
|
172
|
+
schema=JsonSchema(GraphRagQuery)
|
173
|
+
)
|
174
|
+
|
175
|
+
self.graph_rag_in = Subscriber(
|
176
|
+
self.pulsar_host, graph_rag_response_queue,
|
177
|
+
"api-gateway", "api-gateway",
|
178
|
+
JsonSchema(GraphRagResponse)
|
179
|
+
)
|
180
|
+
|
181
|
+
self.triples_query_out = Publisher(
|
182
|
+
self.pulsar_host, triples_request_queue,
|
183
|
+
schema=JsonSchema(TriplesQueryRequest)
|
184
|
+
)
|
185
|
+
|
186
|
+
self.triples_query_in = Subscriber(
|
187
|
+
self.pulsar_host, triples_response_queue,
|
188
|
+
"api-gateway", "api-gateway",
|
189
|
+
JsonSchema(TriplesQueryResponse)
|
190
|
+
)
|
191
|
+
|
192
|
+
self.agent_out = Publisher(
|
193
|
+
self.pulsar_host, agent_request_queue,
|
194
|
+
schema=JsonSchema(AgentRequest)
|
195
|
+
)
|
196
|
+
|
197
|
+
self.agent_in = Subscriber(
|
198
|
+
self.pulsar_host, agent_response_queue,
|
199
|
+
"api-gateway", "api-gateway",
|
200
|
+
JsonSchema(AgentResponse)
|
201
|
+
)
|
202
|
+
|
203
|
+
self.embeddings_out = Publisher(
|
204
|
+
self.pulsar_host, embeddings_request_queue,
|
205
|
+
schema=JsonSchema(EmbeddingsRequest)
|
206
|
+
)
|
207
|
+
|
208
|
+
self.embeddings_in = Subscriber(
|
209
|
+
self.pulsar_host, embeddings_response_queue,
|
210
|
+
"api-gateway", "api-gateway",
|
211
|
+
JsonSchema(EmbeddingsResponse)
|
212
|
+
)
|
213
|
+
|
214
|
+
self.app.add_routes([
|
215
|
+
web.post("/api/v1/text-completion", self.llm),
|
216
|
+
web.post("/api/v1/prompt", self.prompt),
|
217
|
+
web.post("/api/v1/graph-rag", self.graph_rag),
|
218
|
+
web.post("/api/v1/triples-query", self.triples_query),
|
219
|
+
web.post("/api/v1/agent", self.agent),
|
220
|
+
web.post("/api/v1/embeddings", self.embeddings),
|
221
|
+
])
|
222
|
+
|
223
|
+
async def llm(self, request):
|
224
|
+
|
225
|
+
id = str(uuid.uuid4())
|
226
|
+
|
227
|
+
try:
|
228
|
+
|
229
|
+
data = await request.json()
|
230
|
+
|
231
|
+
q = await self.llm_in.subscribe(id)
|
232
|
+
|
233
|
+
await self.llm_out.send(
|
234
|
+
id,
|
235
|
+
TextCompletionRequest(
|
236
|
+
system=data["system"],
|
237
|
+
prompt=data["prompt"]
|
238
|
+
)
|
239
|
+
)
|
240
|
+
|
241
|
+
try:
|
242
|
+
resp = await asyncio.wait_for(q.get(), self.timeout)
|
243
|
+
except:
|
244
|
+
raise RuntimeError("Timeout waiting for response")
|
245
|
+
|
246
|
+
if resp.error:
|
247
|
+
return web.json_response(
|
248
|
+
{ "error": resp.error.message }
|
249
|
+
)
|
250
|
+
|
251
|
+
return web.json_response(
|
252
|
+
{ "response": resp.response }
|
253
|
+
)
|
254
|
+
|
255
|
+
except Exception as e:
|
256
|
+
logging.error(f"Exception: {e}")
|
257
|
+
|
258
|
+
return web.json_response(
|
259
|
+
{ "error": str(e) }
|
260
|
+
)
|
261
|
+
|
262
|
+
finally:
|
263
|
+
await self.llm_in.unsubscribe(id)
|
264
|
+
|
265
|
+
async def prompt(self, request):
|
266
|
+
|
267
|
+
id = str(uuid.uuid4())
|
268
|
+
|
269
|
+
try:
|
270
|
+
|
271
|
+
data = await request.json()
|
272
|
+
|
273
|
+
q = await self.prompt_in.subscribe(id)
|
274
|
+
|
275
|
+
terms = {
|
276
|
+
k: json.dumps(v)
|
277
|
+
for k, v in data["variables"].items()
|
278
|
+
}
|
279
|
+
|
280
|
+
await self.prompt_out.send(
|
281
|
+
id,
|
282
|
+
PromptRequest(
|
283
|
+
id=data["id"],
|
284
|
+
terms=terms
|
285
|
+
)
|
286
|
+
)
|
287
|
+
|
288
|
+
try:
|
289
|
+
resp = await asyncio.wait_for(q.get(), self.timeout)
|
290
|
+
except:
|
291
|
+
raise RuntimeError("Timeout waiting for response")
|
292
|
+
|
293
|
+
if resp.error:
|
294
|
+
return web.json_response(
|
295
|
+
{ "error": resp.error.message }
|
296
|
+
)
|
297
|
+
|
298
|
+
if resp.object:
|
299
|
+
return web.json_response(
|
300
|
+
{ "object": resp.object }
|
301
|
+
)
|
302
|
+
|
303
|
+
return web.json_response(
|
304
|
+
{ "text": resp.text }
|
305
|
+
)
|
306
|
+
|
307
|
+
except Exception as e:
|
308
|
+
logging.error(f"Exception: {e}")
|
309
|
+
|
310
|
+
return web.json_response(
|
311
|
+
{ "error": str(e) }
|
312
|
+
)
|
313
|
+
|
314
|
+
finally:
|
315
|
+
await self.prompt_in.unsubscribe(id)
|
316
|
+
|
317
|
+
async def graph_rag(self, request):
|
318
|
+
|
319
|
+
id = str(uuid.uuid4())
|
320
|
+
|
321
|
+
try:
|
322
|
+
|
323
|
+
data = await request.json()
|
324
|
+
|
325
|
+
q = await self.graph_rag_in.subscribe(id)
|
326
|
+
|
327
|
+
await self.graph_rag_out.send(
|
328
|
+
id,
|
329
|
+
GraphRagQuery(
|
330
|
+
query=data["query"],
|
331
|
+
user=data.get("user", "trustgraph"),
|
332
|
+
collection=data.get("collection", "default"),
|
333
|
+
)
|
334
|
+
)
|
335
|
+
|
336
|
+
try:
|
337
|
+
resp = await asyncio.wait_for(q.get(), self.timeout)
|
338
|
+
except:
|
339
|
+
raise RuntimeError("Timeout waiting for response")
|
340
|
+
|
341
|
+
if resp.error:
|
342
|
+
return web.json_response(
|
343
|
+
{ "error": resp.error.message }
|
344
|
+
)
|
345
|
+
|
346
|
+
return web.json_response(
|
347
|
+
{ "response": resp.response }
|
348
|
+
)
|
349
|
+
|
350
|
+
except Exception as e:
|
351
|
+
logging.error(f"Exception: {e}")
|
352
|
+
|
353
|
+
return web.json_response(
|
354
|
+
{ "error": str(e) }
|
355
|
+
)
|
356
|
+
|
357
|
+
finally:
|
358
|
+
await self.graph_rag_in.unsubscribe(id)
|
359
|
+
|
360
|
+
async def triples_query(self, request):
|
361
|
+
|
362
|
+
id = str(uuid.uuid4())
|
363
|
+
|
364
|
+
try:
|
365
|
+
|
366
|
+
data = await request.json()
|
367
|
+
|
368
|
+
q = await self.triples_query_in.subscribe(id)
|
369
|
+
|
370
|
+
if "s" in data:
|
371
|
+
if data["s"].startswith("http:") or data["s"].startswith("https:"):
|
372
|
+
s = Value(value=data["s"], is_uri=True)
|
373
|
+
else:
|
374
|
+
s = Value(value=data["s"], is_uri=True)
|
375
|
+
else:
|
376
|
+
s = None
|
377
|
+
|
378
|
+
if "p" in data:
|
379
|
+
if data["p"].startswith("http:") or data["p"].startswith("https:"):
|
380
|
+
p = Value(value=data["p"], is_uri=True)
|
381
|
+
else:
|
382
|
+
p = Value(value=data["p"], is_uri=True)
|
383
|
+
else:
|
384
|
+
p = None
|
385
|
+
|
386
|
+
if "o" in data:
|
387
|
+
if data["o"].startswith("http:") or data["o"].startswith("https:"):
|
388
|
+
o = Value(value=data["o"], is_uri=True)
|
389
|
+
else:
|
390
|
+
o = Value(value=data["o"], is_uri=True)
|
391
|
+
else:
|
392
|
+
o = None
|
393
|
+
|
394
|
+
limit = int(data.get("limit", 10000))
|
395
|
+
|
396
|
+
await self.triples_query_out.send(
|
397
|
+
id,
|
398
|
+
TriplesQueryRequest(
|
399
|
+
s = s, p = p, o = o,
|
400
|
+
limit = limit,
|
401
|
+
user = data.get("user", "trustgraph"),
|
402
|
+
collection = data.get("collection", "default"),
|
403
|
+
)
|
404
|
+
)
|
405
|
+
|
406
|
+
try:
|
407
|
+
resp = await asyncio.wait_for(q.get(), self.timeout)
|
408
|
+
except:
|
409
|
+
raise RuntimeError("Timeout waiting for response")
|
410
|
+
|
411
|
+
if resp.error:
|
412
|
+
return web.json_response(
|
413
|
+
{ "error": resp.error.message }
|
414
|
+
)
|
415
|
+
|
416
|
+
return web.json_response(
|
417
|
+
{
|
418
|
+
"response": [
|
419
|
+
{
|
420
|
+
"s": {
|
421
|
+
"v": t.s.value,
|
422
|
+
"e": t.s.is_uri,
|
423
|
+
},
|
424
|
+
"p": {
|
425
|
+
"v": t.p.value,
|
426
|
+
"e": t.p.is_uri,
|
427
|
+
},
|
428
|
+
"o": {
|
429
|
+
"v": t.o.value,
|
430
|
+
"e": t.o.is_uri,
|
431
|
+
}
|
432
|
+
}
|
433
|
+
for t in resp.triples
|
434
|
+
]
|
435
|
+
}
|
436
|
+
)
|
437
|
+
|
438
|
+
except Exception as e:
|
439
|
+
logging.error(f"Exception: {e}")
|
440
|
+
|
441
|
+
return web.json_response(
|
442
|
+
{ "error": str(e) }
|
443
|
+
)
|
444
|
+
|
445
|
+
finally:
|
446
|
+
await self.graph_rag_in.unsubscribe(id)
|
447
|
+
|
448
|
+
async def agent(self, request):
|
449
|
+
|
450
|
+
id = str(uuid.uuid4())
|
451
|
+
|
452
|
+
try:
|
453
|
+
|
454
|
+
data = await request.json()
|
455
|
+
|
456
|
+
q = await self.agent_in.subscribe(id)
|
457
|
+
|
458
|
+
await self.agent_out.send(
|
459
|
+
id,
|
460
|
+
AgentRequest(
|
461
|
+
question=data["question"],
|
462
|
+
)
|
463
|
+
)
|
464
|
+
|
465
|
+
while True:
|
466
|
+
try:
|
467
|
+
resp = await asyncio.wait_for(q.get(), self.timeout)
|
468
|
+
except:
|
469
|
+
raise RuntimeError("Timeout waiting for response")
|
470
|
+
|
471
|
+
if resp.error:
|
472
|
+
return web.json_response(
|
473
|
+
{ "error": resp.error.message }
|
474
|
+
)
|
475
|
+
|
476
|
+
if resp.answer: break
|
477
|
+
|
478
|
+
if resp.thought: print("thought:", resp.thought)
|
479
|
+
if resp.observation: print("observation:", resp.observation)
|
480
|
+
|
481
|
+
if resp.answer:
|
482
|
+
return web.json_response(
|
483
|
+
{ "answer": resp.answer }
|
484
|
+
)
|
485
|
+
|
486
|
+
# Can't happen, ook at the logic
|
487
|
+
raise RuntimeError("Strange state")
|
488
|
+
|
489
|
+
except Exception as e:
|
490
|
+
logging.error(f"Exception: {e}")
|
491
|
+
|
492
|
+
return web.json_response(
|
493
|
+
{ "error": str(e) }
|
494
|
+
)
|
495
|
+
|
496
|
+
finally:
|
497
|
+
await self.agent_in.unsubscribe(id)
|
498
|
+
|
499
|
+
async def embeddings(self, request):
|
500
|
+
|
501
|
+
id = str(uuid.uuid4())
|
502
|
+
|
503
|
+
try:
|
504
|
+
|
505
|
+
data = await request.json()
|
506
|
+
|
507
|
+
q = await self.embeddings_in.subscribe(id)
|
508
|
+
|
509
|
+
await self.embeddings_out.send(
|
510
|
+
id,
|
511
|
+
EmbeddingsRequest(
|
512
|
+
text=data["text"],
|
513
|
+
)
|
514
|
+
)
|
515
|
+
|
516
|
+
try:
|
517
|
+
resp = await asyncio.wait_for(q.get(), self.timeout)
|
518
|
+
except:
|
519
|
+
raise RuntimeError("Timeout waiting for response")
|
520
|
+
|
521
|
+
if resp.error:
|
522
|
+
return web.json_response(
|
523
|
+
{ "error": resp.error.message }
|
524
|
+
)
|
525
|
+
|
526
|
+
return web.json_response(
|
527
|
+
{ "vectors": resp.vectors }
|
528
|
+
)
|
529
|
+
|
530
|
+
except Exception as e:
|
531
|
+
logging.error(f"Exception: {e}")
|
532
|
+
|
533
|
+
return web.json_response(
|
534
|
+
{ "error": str(e) }
|
535
|
+
)
|
536
|
+
|
537
|
+
finally:
|
538
|
+
await self.embeddings_in.unsubscribe(id)
|
539
|
+
|
540
|
+
async def app_factory(self):
|
541
|
+
|
542
|
+
self.llm_pub_task = asyncio.create_task(self.llm_in.run())
|
543
|
+
self.llm_sub_task = asyncio.create_task(self.llm_out.run())
|
544
|
+
|
545
|
+
self.prompt_pub_task = asyncio.create_task(self.prompt_in.run())
|
546
|
+
self.prompt_sub_task = asyncio.create_task(self.prompt_out.run())
|
547
|
+
|
548
|
+
self.graph_rag_pub_task = asyncio.create_task(self.graph_rag_in.run())
|
549
|
+
self.graph_rag_sub_task = asyncio.create_task(self.graph_rag_out.run())
|
550
|
+
|
551
|
+
self.triples_query_pub_task = asyncio.create_task(
|
552
|
+
self.triples_query_in.run()
|
553
|
+
)
|
554
|
+
self.triples_query_sub_task = asyncio.create_task(
|
555
|
+
self.triples_query_out.run()
|
556
|
+
)
|
557
|
+
|
558
|
+
self.agent_pub_task = asyncio.create_task(self.agent_in.run())
|
559
|
+
self.agent_sub_task = asyncio.create_task(self.agent_out.run())
|
560
|
+
|
561
|
+
self.embeddings_pub_task = asyncio.create_task(
|
562
|
+
self.embeddings_in.run()
|
563
|
+
)
|
564
|
+
self.embeddings_sub_task = asyncio.create_task(
|
565
|
+
self.embeddings_out.run()
|
566
|
+
)
|
567
|
+
|
568
|
+
return self.app
|
569
|
+
|
570
|
+
def run(self):
|
571
|
+
web.run_app(self.app_factory(), port=self.port)
|
572
|
+
|
573
|
+
def run():
|
574
|
+
|
575
|
+
|
576
|
+
parser = argparse.ArgumentParser(
|
577
|
+
prog="api-gateway",
|
578
|
+
description=__doc__
|
579
|
+
)
|
580
|
+
|
581
|
+
parser.add_argument(
|
582
|
+
'-p', '--pulsar-host',
|
583
|
+
default=default_pulsar_host,
|
584
|
+
help=f'Pulsar host (default: {default_pulsar_host})',
|
585
|
+
)
|
586
|
+
|
587
|
+
parser.add_argument(
|
588
|
+
'--port',
|
589
|
+
type=int,
|
590
|
+
default=default_port,
|
591
|
+
help=f'Port number to listen on (default: {default_port})',
|
592
|
+
)
|
593
|
+
|
594
|
+
parser.add_argument(
|
595
|
+
'--timeout',
|
596
|
+
type=int,
|
597
|
+
default=default_timeout,
|
598
|
+
help=f'API request timeout in seconds (default: {default_timeout})',
|
599
|
+
)
|
600
|
+
|
601
|
+
parser.add_argument(
|
602
|
+
'-l', '--log-level',
|
603
|
+
type=LogLevel,
|
604
|
+
default=LogLevel.INFO,
|
605
|
+
choices=list(LogLevel),
|
606
|
+
help=f'Output queue (default: info)'
|
607
|
+
)
|
608
|
+
|
609
|
+
parser.add_argument(
|
610
|
+
'--metrics',
|
611
|
+
action=argparse.BooleanOptionalAction,
|
612
|
+
default=True,
|
613
|
+
help=f'Metrics enabled (default: true)',
|
614
|
+
)
|
615
|
+
|
616
|
+
parser.add_argument(
|
617
|
+
'-P', '--metrics-port',
|
618
|
+
type=int,
|
619
|
+
default=8000,
|
620
|
+
help=f'Prometheus metrics port (default: 8000)',
|
621
|
+
)
|
622
|
+
|
623
|
+
args = parser.parse_args()
|
624
|
+
args = vars(args)
|
625
|
+
|
626
|
+
if args["metrics"]:
|
627
|
+
start_http_server(args["metrics_port"])
|
628
|
+
|
629
|
+
a = Api(**args)
|
630
|
+
a.run()
|
631
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.16.1"
|
File without changes
|
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: trustgraph-flow
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.16.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.16.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+)
|