trustgraph-flow 0.19.4__tar.gz → 0.19.6__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.19.4 → trustgraph-flow-0.19.6}/PKG-INFO +2 -2
- trustgraph-flow-0.19.6/scripts/document-embeddings +6 -0
- trustgraph-flow-0.19.6/scripts/graph-embeddings +6 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/setup.py +10 -9
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/document_rag.py +44 -32
- trustgraph-flow-0.19.6/trustgraph/embeddings/document_embeddings/__init__.py +3 -0
- {trustgraph-flow-0.19.4/trustgraph/embeddings/vectorize → trustgraph-flow-0.19.6/trustgraph/embeddings/document_embeddings}/__main__.py +1 -1
- trustgraph-flow-0.19.6/trustgraph/embeddings/document_embeddings/embeddings.py +109 -0
- trustgraph-flow-0.19.6/trustgraph/embeddings/graph_embeddings/__init__.py +3 -0
- trustgraph-flow-0.19.6/trustgraph/embeddings/graph_embeddings/__main__.py +6 -0
- trustgraph-flow-0.19.4/trustgraph/embeddings/vectorize/vectorize.py → trustgraph-flow-0.19.6/trustgraph/embeddings/graph_embeddings/embeddings.py +3 -7
- trustgraph-flow-0.19.6/trustgraph/flow_version.py +1 -0
- trustgraph-flow-0.19.6/trustgraph/gateway/document_rag.py +30 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/service.py +9 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/doc_embeddings/milvus/write.py +15 -9
- trustgraph-flow-0.19.6/trustgraph/storage/doc_embeddings/pinecone/write.py +170 -0
- trustgraph-flow-0.19.6/trustgraph/storage/doc_embeddings/qdrant/write.py +106 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph_flow.egg-info/PKG-INFO +2 -2
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph_flow.egg-info/SOURCES.txt +9 -4
- trustgraph-flow-0.19.4/scripts/embeddings-vectorize +0 -6
- trustgraph-flow-0.19.4/trustgraph/embeddings/vectorize/__init__.py +0 -3
- trustgraph-flow-0.19.4/trustgraph/flow_version.py +0 -1
- trustgraph-flow-0.19.4/trustgraph/storage/doc_embeddings/pinecone/write.py +0 -167
- trustgraph-flow-0.19.4/trustgraph/storage/doc_embeddings/qdrant/write.py +0 -105
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/README.md +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/agent-manager-react +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/api-gateway +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/chunker-recursive +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/chunker-token +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/de-query-milvus +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/de-query-pinecone +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/de-query-qdrant +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/de-write-milvus +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/de-write-pinecone +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/de-write-qdrant +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/document-rag +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/embeddings-ollama +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/ge-query-milvus +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/ge-query-pinecone +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/ge-query-qdrant +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/ge-write-milvus +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/ge-write-pinecone +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/ge-write-qdrant +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/graph-rag +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/kg-extract-definitions +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/kg-extract-relationships +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/kg-extract-topics +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/metering +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/object-extract-row +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/oe-write-milvus +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/pdf-decoder +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/prompt-generic +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/prompt-template +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/rows-write-cassandra +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/run-processing +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/text-completion-azure +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/text-completion-azure-openai +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/text-completion-claude +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/text-completion-cohere +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/text-completion-googleaistudio +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/text-completion-llamafile +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/text-completion-ollama +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/text-completion-openai +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/triples-query-cassandra +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/triples-query-falkordb +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/triples-query-memgraph +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/triples-query-neo4j +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/triples-write-cassandra +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/triples-write-falkordb +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/triples-write-memgraph +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/triples-write-neo4j +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/scripts/wikipedia-lookup +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/setup.cfg +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/agent/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/agent/react/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/agent/react/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/agent/react/agent_manager.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/agent/react/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/agent/react/tools.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/agent/react/types.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/chunking/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/chunking/recursive/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/chunking/recursive/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/chunking/recursive/chunker.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/chunking/token/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/chunking/token/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/chunking/token/chunker.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/decoding/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/decoding/pdf/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/decoding/pdf/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/decoding/pdf/pdf_decoder.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/direct/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/direct/cassandra.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/direct/milvus_doc_embeddings.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/direct/milvus_graph_embeddings.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/direct/milvus_object_embeddings.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/embeddings/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/embeddings/ollama/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/embeddings/ollama/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/embeddings/ollama/processor.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/external/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/external/wikipedia/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/external/wikipedia/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/external/wikipedia/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/kg/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/kg/definitions/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/kg/definitions/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/kg/definitions/extract.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/kg/relationships/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/kg/relationships/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/kg/relationships/extract.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/kg/topics/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/kg/topics/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/kg/topics/extract.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/object/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/object/row/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/object/row/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/extract/object/row/extract.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/agent.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/auth.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/dbpedia.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/document_load.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/embeddings.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/encyclopedia.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/endpoint.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/graph_embeddings_load.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/graph_embeddings_query.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/graph_embeddings_stream.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/graph_rag.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/internet_search.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/mux.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/prompt.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/publisher.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/requestor.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/running.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/sender.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/serialize.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/socket.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/subscriber.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/text_completion.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/text_load.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/triples_load.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/triples_query.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/gateway/triples_stream.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/graph_rag.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/metering/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/metering/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/metering/counter.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/metering/pricelist.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/prompt/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/prompt/generic/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/prompt/generic/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/prompt/generic/prompts.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/prompt/generic/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/prompt/template/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/prompt/template/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/prompt/template/prompt_manager.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/prompt/template/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/azure/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/azure/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/azure/llm.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/azure_openai/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/azure_openai/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/azure_openai/llm.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/claude/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/claude/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/claude/llm.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/cohere/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/cohere/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/cohere/llm.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/googleaistudio/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/googleaistudio/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/googleaistudio/llm.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/llamafile/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/llamafile/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/llamafile/llm.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/ollama/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/ollama/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/ollama/llm.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/openai/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/openai/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/model/text_completion/openai/llm.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/processing/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/processing/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/processing/processing.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/doc_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/doc_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/doc_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/doc_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/doc_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/doc_embeddings/pinecone/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/doc_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/doc_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/graph_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/graph_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/graph_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/graph_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/graph_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/graph_embeddings/pinecone/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/graph_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/graph_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/cassandra/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/falkordb/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/falkordb/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/falkordb/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/memgraph/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/memgraph/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/memgraph/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/neo4j/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/query/triples/neo4j/service.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/retrieval/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/retrieval/document_rag/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/retrieval/document_rag/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/retrieval/document_rag/rag.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/retrieval/graph_rag/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/retrieval/graph_rag/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/retrieval/graph_rag/rag.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/doc_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/doc_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/doc_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/doc_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/doc_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/graph_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/graph_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/graph_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/graph_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/graph_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/graph_embeddings/pinecone/write.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/graph_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/graph_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/object_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/object_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/object_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/object_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/rows/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/rows/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/rows/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/rows/cassandra/write.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/cassandra/write.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/falkordb/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/falkordb/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/falkordb/write.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/memgraph/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/memgraph/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/memgraph/write.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/neo4j/__init__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/triples/neo4j/write.py +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph_flow.egg-info/dependency_links.txt +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph_flow.egg-info/requires.txt +0 -0
- {trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/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.19.
|
3
|
+
Version: 0.19.6
|
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.19.
|
9
|
+
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.19.6.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+)
|
@@ -63,29 +63,30 @@ setuptools.setup(
|
|
63
63
|
"falkordb",
|
64
64
|
],
|
65
65
|
scripts=[
|
66
|
-
"scripts/api-gateway",
|
67
66
|
"scripts/agent-manager-react",
|
67
|
+
"scripts/api-gateway",
|
68
68
|
"scripts/chunker-recursive",
|
69
69
|
"scripts/chunker-token",
|
70
70
|
"scripts/de-query-milvus",
|
71
|
-
"scripts/de-query-qdrant",
|
72
71
|
"scripts/de-query-pinecone",
|
72
|
+
"scripts/de-query-qdrant",
|
73
73
|
"scripts/de-write-milvus",
|
74
|
-
"scripts/de-write-qdrant",
|
75
74
|
"scripts/de-write-pinecone",
|
75
|
+
"scripts/de-write-qdrant",
|
76
|
+
"scripts/document-embeddings",
|
76
77
|
"scripts/document-rag",
|
77
78
|
"scripts/embeddings-ollama",
|
78
|
-
"scripts/embeddings-vectorize",
|
79
79
|
"scripts/ge-query-milvus",
|
80
80
|
"scripts/ge-query-pinecone",
|
81
81
|
"scripts/ge-query-qdrant",
|
82
82
|
"scripts/ge-write-milvus",
|
83
83
|
"scripts/ge-write-pinecone",
|
84
84
|
"scripts/ge-write-qdrant",
|
85
|
+
"scripts/graph-embeddings",
|
85
86
|
"scripts/graph-rag",
|
86
87
|
"scripts/kg-extract-definitions",
|
87
|
-
"scripts/kg-extract-topics",
|
88
88
|
"scripts/kg-extract-relationships",
|
89
|
+
"scripts/kg-extract-topics",
|
89
90
|
"scripts/metering",
|
90
91
|
"scripts/object-extract-row",
|
91
92
|
"scripts/oe-write-milvus",
|
@@ -103,13 +104,13 @@ setuptools.setup(
|
|
103
104
|
"scripts/text-completion-ollama",
|
104
105
|
"scripts/text-completion-openai",
|
105
106
|
"scripts/triples-query-cassandra",
|
106
|
-
"scripts/triples-query-neo4j",
|
107
|
-
"scripts/triples-query-memgraph",
|
108
107
|
"scripts/triples-query-falkordb",
|
108
|
+
"scripts/triples-query-memgraph",
|
109
|
+
"scripts/triples-query-neo4j",
|
109
110
|
"scripts/triples-write-cassandra",
|
110
|
-
"scripts/triples-write-neo4j",
|
111
|
-
"scripts/triples-write-memgraph",
|
112
111
|
"scripts/triples-write-falkordb",
|
112
|
+
"scripts/triples-write-memgraph",
|
113
|
+
"scripts/triples-write-neo4j",
|
113
114
|
"scripts/wikipedia-lookup",
|
114
115
|
]
|
115
116
|
)
|
@@ -16,6 +16,44 @@ from . schema import document_embeddings_response_queue
|
|
16
16
|
LABEL="http://www.w3.org/2000/01/rdf-schema#label"
|
17
17
|
DEFINITION="http://www.w3.org/2004/02/skos/core#definition"
|
18
18
|
|
19
|
+
class Query:
|
20
|
+
|
21
|
+
def __init__(self, rag, user, collection, verbose):
|
22
|
+
self.rag = rag
|
23
|
+
self.user = user
|
24
|
+
self.collection = collection
|
25
|
+
self.verbose = verbose
|
26
|
+
|
27
|
+
def get_vector(self, query):
|
28
|
+
|
29
|
+
if self.verbose:
|
30
|
+
print("Compute embeddings...", flush=True)
|
31
|
+
|
32
|
+
qembeds = self.rag.embeddings.request(query)
|
33
|
+
|
34
|
+
if self.verbose:
|
35
|
+
print("Done.", flush=True)
|
36
|
+
|
37
|
+
return qembeds
|
38
|
+
|
39
|
+
def get_docs(self, query):
|
40
|
+
|
41
|
+
vectors = self.get_vector(query)
|
42
|
+
|
43
|
+
if self.verbose:
|
44
|
+
print("Get entities...", flush=True)
|
45
|
+
|
46
|
+
docs = self.rag.de_client.request(
|
47
|
+
vectors, limit=self.rag.doc_limit
|
48
|
+
)
|
49
|
+
|
50
|
+
if self.verbose:
|
51
|
+
print("Docs:", flush=True)
|
52
|
+
for doc in docs:
|
53
|
+
print(doc, flush=True)
|
54
|
+
|
55
|
+
return docs
|
56
|
+
|
19
57
|
class DocumentRag:
|
20
58
|
|
21
59
|
def __init__(
|
@@ -55,7 +93,7 @@ class DocumentRag:
|
|
55
93
|
print("Initialising...", flush=True)
|
56
94
|
|
57
95
|
# FIXME: Configurable
|
58
|
-
self.
|
96
|
+
self.doc_limit = 20
|
59
97
|
|
60
98
|
self.de_client = DocumentEmbeddingsClient(
|
61
99
|
pulsar_host=pulsar_host,
|
@@ -81,42 +119,16 @@ class DocumentRag:
|
|
81
119
|
if self.verbose:
|
82
120
|
print("Initialised", flush=True)
|
83
121
|
|
84
|
-
def
|
85
|
-
|
86
|
-
if self.verbose:
|
87
|
-
print("Compute embeddings...", flush=True)
|
88
|
-
|
89
|
-
qembeds = self.embeddings.request(query)
|
90
|
-
|
91
|
-
if self.verbose:
|
92
|
-
print("Done.", flush=True)
|
93
|
-
|
94
|
-
return qembeds
|
95
|
-
|
96
|
-
def get_docs(self, query):
|
97
|
-
|
98
|
-
vectors = self.get_vector(query)
|
122
|
+
def query(self, query, user="trustgraph", collection="default"):
|
99
123
|
|
100
124
|
if self.verbose:
|
101
|
-
print("
|
125
|
+
print("Construct prompt...", flush=True)
|
102
126
|
|
103
|
-
|
104
|
-
|
127
|
+
q = Query(
|
128
|
+
rag=self, user=user, collection=collection, verbose=self.verbose
|
105
129
|
)
|
106
130
|
|
107
|
-
|
108
|
-
print("Docs:", flush=True)
|
109
|
-
for doc in docs:
|
110
|
-
print(doc, flush=True)
|
111
|
-
|
112
|
-
return docs
|
113
|
-
|
114
|
-
def query(self, query):
|
115
|
-
|
116
|
-
if self.verbose:
|
117
|
-
print("Construct prompt...", flush=True)
|
118
|
-
|
119
|
-
docs = self.get_docs(query)
|
131
|
+
docs = q.get_docs(query)
|
120
132
|
|
121
133
|
if self.verbose:
|
122
134
|
print("Invoke LLM...", flush=True)
|
@@ -0,0 +1,109 @@
|
|
1
|
+
|
2
|
+
"""
|
3
|
+
Document embeddings, calls the embeddings service to get embeddings for a
|
4
|
+
chunk of text. Input is chunk of text plus metadata.
|
5
|
+
Output is chunk plus embedding.
|
6
|
+
"""
|
7
|
+
|
8
|
+
from ... schema import Chunk, ChunkEmbeddings, DocumentEmbeddings
|
9
|
+
from ... schema import chunk_ingest_queue
|
10
|
+
from ... schema import document_embeddings_store_queue
|
11
|
+
from ... schema import embeddings_request_queue, embeddings_response_queue
|
12
|
+
from ... clients.embeddings_client import EmbeddingsClient
|
13
|
+
from ... log_level import LogLevel
|
14
|
+
from ... base import ConsumerProducer
|
15
|
+
|
16
|
+
module = ".".join(__name__.split(".")[1:-1])
|
17
|
+
|
18
|
+
default_input_queue = chunk_ingest_queue
|
19
|
+
default_output_queue = document_embeddings_store_queue
|
20
|
+
default_subscriber = module
|
21
|
+
|
22
|
+
class Processor(ConsumerProducer):
|
23
|
+
|
24
|
+
def __init__(self, **params):
|
25
|
+
|
26
|
+
input_queue = params.get("input_queue", default_input_queue)
|
27
|
+
output_queue = params.get("output_queue", default_output_queue)
|
28
|
+
subscriber = params.get("subscriber", default_subscriber)
|
29
|
+
emb_request_queue = params.get(
|
30
|
+
"embeddings_request_queue", embeddings_request_queue
|
31
|
+
)
|
32
|
+
emb_response_queue = params.get(
|
33
|
+
"embeddings_response_queue", embeddings_response_queue
|
34
|
+
)
|
35
|
+
|
36
|
+
super(Processor, self).__init__(
|
37
|
+
**params | {
|
38
|
+
"input_queue": input_queue,
|
39
|
+
"output_queue": output_queue,
|
40
|
+
"embeddings_request_queue": emb_request_queue,
|
41
|
+
"embeddings_response_queue": emb_response_queue,
|
42
|
+
"subscriber": subscriber,
|
43
|
+
"input_schema": Chunk,
|
44
|
+
"output_schema": DocumentEmbeddings,
|
45
|
+
}
|
46
|
+
)
|
47
|
+
|
48
|
+
self.embeddings = EmbeddingsClient(
|
49
|
+
pulsar_host=self.pulsar_host,
|
50
|
+
input_queue=emb_request_queue,
|
51
|
+
output_queue=emb_response_queue,
|
52
|
+
subscriber=module + "-emb",
|
53
|
+
)
|
54
|
+
|
55
|
+
def handle(self, msg):
|
56
|
+
|
57
|
+
v = msg.value()
|
58
|
+
print(f"Indexing {v.metadata.id}...", flush=True)
|
59
|
+
|
60
|
+
try:
|
61
|
+
|
62
|
+
vectors = self.embeddings.request(v.chunk)
|
63
|
+
|
64
|
+
embeds = [
|
65
|
+
ChunkEmbeddings(
|
66
|
+
chunk=v.chunk,
|
67
|
+
vectors=vectors,
|
68
|
+
)
|
69
|
+
]
|
70
|
+
|
71
|
+
r = DocumentEmbeddings(
|
72
|
+
metadata=v.metadata,
|
73
|
+
chunks=embeds,
|
74
|
+
)
|
75
|
+
|
76
|
+
self.producer.send(r)
|
77
|
+
|
78
|
+
except Exception as e:
|
79
|
+
print("Exception:", e, flush=True)
|
80
|
+
|
81
|
+
# Retry
|
82
|
+
raise e
|
83
|
+
|
84
|
+
print("Done.", flush=True)
|
85
|
+
|
86
|
+
@staticmethod
|
87
|
+
def add_args(parser):
|
88
|
+
|
89
|
+
ConsumerProducer.add_args(
|
90
|
+
parser, default_input_queue, default_subscriber,
|
91
|
+
default_output_queue,
|
92
|
+
)
|
93
|
+
|
94
|
+
parser.add_argument(
|
95
|
+
'--embeddings-request-queue',
|
96
|
+
default=embeddings_request_queue,
|
97
|
+
help=f'Embeddings request queue (default: {embeddings_request_queue})',
|
98
|
+
)
|
99
|
+
|
100
|
+
parser.add_argument(
|
101
|
+
'--embeddings-response-queue',
|
102
|
+
default=embeddings_response_queue,
|
103
|
+
help=f'Embeddings request queue (default: {embeddings_response_queue})',
|
104
|
+
)
|
105
|
+
|
106
|
+
def run():
|
107
|
+
|
108
|
+
Processor.start(module, __doc__)
|
109
|
+
|
@@ -1,7 +1,8 @@
|
|
1
1
|
|
2
2
|
"""
|
3
|
-
|
4
|
-
|
3
|
+
Graph embeddings, calls the embeddings service to get embeddings for a
|
4
|
+
set of entity contexts. Input is entity plus textual context.
|
5
|
+
Output is entity plus embedding.
|
5
6
|
"""
|
6
7
|
|
7
8
|
from ... schema import EntityContexts, EntityEmbeddings, GraphEmbeddings
|
@@ -51,11 +52,6 @@ class Processor(ConsumerProducer):
|
|
51
52
|
subscriber=module + "-emb",
|
52
53
|
)
|
53
54
|
|
54
|
-
def emit(self, rec, vectors):
|
55
|
-
|
56
|
-
r = GraphEmbeddings(metadata=metadata, chunk=chunk, vectors=vectors)
|
57
|
-
self.producer.send(r)
|
58
|
-
|
59
55
|
def handle(self, msg):
|
60
56
|
|
61
57
|
v = msg.value()
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.19.6"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
from .. schema import DocumentRagQuery, DocumentRagResponse
|
3
|
+
from .. schema import document_rag_request_queue
|
4
|
+
from .. schema import document_rag_response_queue
|
5
|
+
|
6
|
+
from . endpoint import ServiceEndpoint
|
7
|
+
from . requestor import ServiceRequestor
|
8
|
+
|
9
|
+
class DocumentRagRequestor(ServiceRequestor):
|
10
|
+
def __init__(self, pulsar_host, timeout, auth):
|
11
|
+
|
12
|
+
super(DocumentRagRequestor, self).__init__(
|
13
|
+
pulsar_host=pulsar_host,
|
14
|
+
request_queue=document_rag_request_queue,
|
15
|
+
response_queue=document_rag_response_queue,
|
16
|
+
request_schema=DocumentRagQuery,
|
17
|
+
response_schema=DocumentRagResponse,
|
18
|
+
timeout=timeout,
|
19
|
+
)
|
20
|
+
|
21
|
+
def to_request(self, body):
|
22
|
+
return DocumentRagQuery(
|
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 }, True
|
30
|
+
|
@@ -31,6 +31,7 @@ from . subscriber import Subscriber
|
|
31
31
|
from . text_completion import TextCompletionRequestor
|
32
32
|
from . prompt import PromptRequestor
|
33
33
|
from . graph_rag import GraphRagRequestor
|
34
|
+
from . document_rag import DocumentRagRequestor
|
34
35
|
from . triples_query import TriplesQueryRequestor
|
35
36
|
from . graph_embeddings_query import GraphEmbeddingsQueryRequestor
|
36
37
|
from . embeddings import EmbeddingsRequestor
|
@@ -91,6 +92,10 @@ class Api:
|
|
91
92
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
92
93
|
auth = self.auth,
|
93
94
|
),
|
95
|
+
"document-rag": DocumentRagRequestor(
|
96
|
+
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
97
|
+
auth = self.auth,
|
98
|
+
),
|
94
99
|
"triples-query": TriplesQueryRequestor(
|
95
100
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
96
101
|
auth = self.auth,
|
@@ -140,6 +145,10 @@ class Api:
|
|
140
145
|
endpoint_path = "/api/v1/graph-rag", auth=self.auth,
|
141
146
|
requestor = self.services["graph-rag"],
|
142
147
|
),
|
148
|
+
ServiceEndpoint(
|
149
|
+
endpoint_path = "/api/v1/document-rag", auth=self.auth,
|
150
|
+
requestor = self.services["document-rag"],
|
151
|
+
),
|
143
152
|
ServiceEndpoint(
|
144
153
|
endpoint_path = "/api/v1/triples-query", auth=self.auth,
|
145
154
|
requestor = self.services["triples-query"],
|
{trustgraph-flow-0.19.4 → trustgraph-flow-0.19.6}/trustgraph/storage/doc_embeddings/milvus/write.py
RENAMED
@@ -3,15 +3,16 @@
|
|
3
3
|
Accepts entity/vector pairs and writes them to a Milvus store.
|
4
4
|
"""
|
5
5
|
|
6
|
-
from .... schema import ChunkEmbeddings
|
7
|
-
from .... schema import chunk_embeddings_ingest_queue
|
8
|
-
from .... log_level import LogLevel
|
9
6
|
from .... direct.milvus_doc_embeddings import DocVectors
|
7
|
+
|
8
|
+
from .... schema import DocumentEmbeddings
|
9
|
+
from .... schema import document_embeddings_store_queue
|
10
|
+
from .... log_level import LogLevel
|
10
11
|
from .... base import Consumer
|
11
12
|
|
12
13
|
module = ".".join(__name__.split(".")[1:-1])
|
13
14
|
|
14
|
-
default_input_queue =
|
15
|
+
default_input_queue = document_embeddings_store_queue
|
15
16
|
default_subscriber = module
|
16
17
|
default_store_uri = 'http://localhost:19530'
|
17
18
|
|
@@ -27,7 +28,7 @@ class Processor(Consumer):
|
|
27
28
|
**params | {
|
28
29
|
"input_queue": input_queue,
|
29
30
|
"subscriber": subscriber,
|
30
|
-
"input_schema":
|
31
|
+
"input_schema": DocumentEmbeddings,
|
31
32
|
"store_uri": store_uri,
|
32
33
|
}
|
33
34
|
)
|
@@ -38,11 +39,16 @@ class Processor(Consumer):
|
|
38
39
|
|
39
40
|
v = msg.value()
|
40
41
|
|
41
|
-
|
42
|
+
for emb in v.chunks:
|
43
|
+
|
44
|
+
chunk = emb.chunk.decode("utf-8")
|
45
|
+
if chunk == "" or chunk is None: continue
|
46
|
+
|
47
|
+
for vec in emb.vectors:
|
42
48
|
|
43
|
-
|
44
|
-
|
45
|
-
|
49
|
+
if chunk != "" and v.chunk is not None:
|
50
|
+
for vec in v.vectors:
|
51
|
+
self.vecstore.insert(vec, chunk)
|
46
52
|
|
47
53
|
@staticmethod
|
48
54
|
def add_args(parser):
|
@@ -0,0 +1,170 @@
|
|
1
|
+
|
2
|
+
"""
|
3
|
+
Accepts entity/vector pairs and writes them to a Qdrant store.
|
4
|
+
"""
|
5
|
+
|
6
|
+
from qdrant_client import QdrantClient
|
7
|
+
from qdrant_client.models import PointStruct
|
8
|
+
from qdrant_client.models import Distance, VectorParams
|
9
|
+
|
10
|
+
import time
|
11
|
+
import uuid
|
12
|
+
import os
|
13
|
+
|
14
|
+
from .... schema import DocumentEmbeddings
|
15
|
+
from .... schema import document_embeddings_store_queue
|
16
|
+
from .... log_level import LogLevel
|
17
|
+
from .... base import Consumer
|
18
|
+
|
19
|
+
module = ".".join(__name__.split(".")[1:-1])
|
20
|
+
|
21
|
+
default_input_queue = document_embeddings_store_queue
|
22
|
+
default_subscriber = module
|
23
|
+
default_api_key = os.getenv("PINECONE_API_KEY", "not-specified")
|
24
|
+
default_cloud = "aws"
|
25
|
+
default_region = "us-east-1"
|
26
|
+
|
27
|
+
class Processor(Consumer):
|
28
|
+
|
29
|
+
def __init__(self, **params):
|
30
|
+
|
31
|
+
input_queue = params.get("input_queue", default_input_queue)
|
32
|
+
subscriber = params.get("subscriber", default_subscriber)
|
33
|
+
|
34
|
+
self.url = params.get("url", None)
|
35
|
+
self.cloud = params.get("cloud", default_cloud)
|
36
|
+
self.region = params.get("region", default_region)
|
37
|
+
self.api_key = params.get("api_key", default_api_key)
|
38
|
+
|
39
|
+
if self.api_key is None:
|
40
|
+
raise RuntimeError("Pinecone API key must be specified")
|
41
|
+
|
42
|
+
if self.url:
|
43
|
+
|
44
|
+
self.pinecone = PineconeGRPC(
|
45
|
+
api_key = self.api_key,
|
46
|
+
host = self.url
|
47
|
+
)
|
48
|
+
|
49
|
+
else:
|
50
|
+
|
51
|
+
self.pinecone = Pinecone(api_key = self.api_key)
|
52
|
+
|
53
|
+
super(Processor, self).__init__(
|
54
|
+
**params | {
|
55
|
+
"input_queue": input_queue,
|
56
|
+
"subscriber": subscriber,
|
57
|
+
"input_schema": DocumentEmbeddings,
|
58
|
+
"url": self.url,
|
59
|
+
}
|
60
|
+
)
|
61
|
+
|
62
|
+
self.last_index_name = None
|
63
|
+
|
64
|
+
def handle(self, msg):
|
65
|
+
|
66
|
+
v = msg.value()
|
67
|
+
|
68
|
+
for emb in v.chunks:
|
69
|
+
|
70
|
+
chunk = emb.chunk.decode("utf-8")
|
71
|
+
if chunk == "" or chunk is None: continue
|
72
|
+
|
73
|
+
for vec in emb.vectors:
|
74
|
+
|
75
|
+
for vec in v.vectors:
|
76
|
+
|
77
|
+
dim = len(vec)
|
78
|
+
collection = (
|
79
|
+
"d-" + v.metadata.user + "-" + str(dim)
|
80
|
+
)
|
81
|
+
|
82
|
+
if index_name != self.last_index_name:
|
83
|
+
|
84
|
+
if not self.pinecone.has_index(index_name):
|
85
|
+
|
86
|
+
try:
|
87
|
+
|
88
|
+
self.pinecone.create_index(
|
89
|
+
name = index_name,
|
90
|
+
dimension = dim,
|
91
|
+
metric = "cosine",
|
92
|
+
spec = ServerlessSpec(
|
93
|
+
cloud = self.cloud,
|
94
|
+
region = self.region,
|
95
|
+
)
|
96
|
+
)
|
97
|
+
|
98
|
+
for i in range(0, 1000):
|
99
|
+
|
100
|
+
if self.pinecone.describe_index(
|
101
|
+
index_name
|
102
|
+
).status["ready"]:
|
103
|
+
break
|
104
|
+
|
105
|
+
time.sleep(1)
|
106
|
+
|
107
|
+
if not self.pinecone.describe_index(
|
108
|
+
index_name
|
109
|
+
).status["ready"]:
|
110
|
+
raise RuntimeError(
|
111
|
+
"Gave up waiting for index creation"
|
112
|
+
)
|
113
|
+
|
114
|
+
except Exception as e:
|
115
|
+
print("Pinecone index creation failed")
|
116
|
+
raise e
|
117
|
+
|
118
|
+
print(f"Index {index_name} created", flush=True)
|
119
|
+
|
120
|
+
self.last_index_name = index_name
|
121
|
+
|
122
|
+
index = self.pinecone.Index(index_name)
|
123
|
+
|
124
|
+
records = [
|
125
|
+
{
|
126
|
+
"id": id,
|
127
|
+
"values": vec,
|
128
|
+
"metadata": { "doc": chunk },
|
129
|
+
}
|
130
|
+
]
|
131
|
+
|
132
|
+
index.upsert(
|
133
|
+
vectors = records,
|
134
|
+
namespace = v.metadata.collection,
|
135
|
+
)
|
136
|
+
|
137
|
+
@staticmethod
|
138
|
+
def add_args(parser):
|
139
|
+
|
140
|
+
Consumer.add_args(
|
141
|
+
parser, default_input_queue, default_subscriber,
|
142
|
+
)
|
143
|
+
|
144
|
+
parser.add_argument(
|
145
|
+
'-a', '--api-key',
|
146
|
+
default=default_api_key,
|
147
|
+
help='Pinecone API key. (default from PINECONE_API_KEY)'
|
148
|
+
)
|
149
|
+
|
150
|
+
parser.add_argument(
|
151
|
+
'-u', '--url',
|
152
|
+
help='Pinecone URL. If unspecified, serverless is used'
|
153
|
+
)
|
154
|
+
|
155
|
+
parser.add_argument(
|
156
|
+
'--cloud',
|
157
|
+
default=default_cloud,
|
158
|
+
help=f'Pinecone cloud, (default: {default_cloud}'
|
159
|
+
)
|
160
|
+
|
161
|
+
parser.add_argument(
|
162
|
+
'--region',
|
163
|
+
default=default_region,
|
164
|
+
help=f'Pinecone region, (default: {default_region}'
|
165
|
+
)
|
166
|
+
|
167
|
+
def run():
|
168
|
+
|
169
|
+
Processor.start(module, __doc__)
|
170
|
+
|