trustgraph-flow 0.17.11__tar.gz → 0.17.12__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.17.11 → trustgraph-flow-0.17.12}/PKG-INFO +2 -2
- trustgraph-flow-0.17.12/trustgraph/flow_version.py +1 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/agent.py +19 -8
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/dbpedia.py +4 -5
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/embeddings.py +6 -5
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/encyclopedia.py +4 -5
- trustgraph-flow-0.17.12/trustgraph/gateway/endpoint.py +69 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/graph_rag.py +4 -5
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/internet_search.py +4 -5
- trustgraph-flow-0.17.12/trustgraph/gateway/mux.py +94 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/prompt.py +5 -6
- trustgraph-flow-0.17.12/trustgraph/gateway/requestor.py +88 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/service.py +67 -21
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/text_completion.py +5 -5
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/triples_query.py +4 -5
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph_flow.egg-info/PKG-INFO +2 -2
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph_flow.egg-info/SOURCES.txt +2 -0
- trustgraph-flow-0.17.11/trustgraph/flow_version.py +0 -1
- trustgraph-flow-0.17.11/trustgraph/gateway/endpoint.py +0 -166
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/README.md +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/agent-manager-react +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/api-gateway +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/chunker-recursive +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/chunker-token +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/de-query-milvus +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/de-query-pinecone +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/de-query-qdrant +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/de-write-milvus +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/de-write-pinecone +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/de-write-qdrant +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/document-rag +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/embeddings-ollama +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/embeddings-vectorize +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/ge-query-milvus +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/ge-query-pinecone +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/ge-query-qdrant +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/ge-write-milvus +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/ge-write-pinecone +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/ge-write-qdrant +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/graph-rag +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/kg-extract-definitions +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/kg-extract-relationships +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/kg-extract-topics +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/metering +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/object-extract-row +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/oe-write-milvus +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/pdf-decoder +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/prompt-generic +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/prompt-template +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/rows-write-cassandra +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/run-processing +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/text-completion-azure +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/text-completion-azure-openai +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/text-completion-claude +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/text-completion-cohere +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/text-completion-googleaistudio +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/text-completion-llamafile +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/text-completion-ollama +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/text-completion-openai +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/triples-query-cassandra +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/triples-query-memgraph +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/triples-query-neo4j +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/triples-write-cassandra +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/triples-write-memgraph +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/triples-write-neo4j +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/scripts/wikipedia-lookup +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/setup.cfg +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/setup.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/agent/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/agent/react/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/agent/react/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/agent/react/agent_manager.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/agent/react/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/agent/react/tools.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/agent/react/types.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/chunking/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/chunking/recursive/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/chunking/recursive/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/chunking/recursive/chunker.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/chunking/token/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/chunking/token/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/chunking/token/chunker.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/decoding/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/decoding/pdf/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/decoding/pdf/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/decoding/pdf/pdf_decoder.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/direct/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/direct/cassandra.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/direct/milvus_doc_embeddings.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/direct/milvus_graph_embeddings.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/direct/milvus_object_embeddings.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/document_rag.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/embeddings/ollama/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/embeddings/ollama/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/embeddings/ollama/processor.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/embeddings/vectorize/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/embeddings/vectorize/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/embeddings/vectorize/vectorize.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/external/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/external/wikipedia/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/external/wikipedia/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/external/wikipedia/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/kg/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/kg/definitions/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/kg/definitions/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/kg/definitions/extract.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/kg/relationships/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/kg/relationships/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/kg/relationships/extract.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/kg/topics/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/kg/topics/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/kg/topics/extract.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/object/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/object/row/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/object/row/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/extract/object/row/extract.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/auth.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/graph_embeddings_load.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/graph_embeddings_stream.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/publisher.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/running.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/serialize.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/socket.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/subscriber.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/triples_load.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/gateway/triples_stream.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/graph_rag.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/metering/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/metering/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/metering/counter.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/metering/pricelist.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/prompt/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/prompt/generic/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/prompt/generic/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/prompt/generic/prompts.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/prompt/generic/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/prompt/template/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/prompt/template/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/prompt/template/prompt_manager.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/prompt/template/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/azure/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/azure/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/azure/llm.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/azure_openai/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/azure_openai/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/azure_openai/llm.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/claude/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/claude/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/claude/llm.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/cohere/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/cohere/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/cohere/llm.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/googleaistudio/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/googleaistudio/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/googleaistudio/llm.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/llamafile/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/llamafile/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/llamafile/llm.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/ollama/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/ollama/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/ollama/llm.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/openai/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/openai/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/model/text_completion/openai/llm.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/processing/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/processing/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/processing/processing.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/doc_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/doc_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/doc_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/doc_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/doc_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/doc_embeddings/pinecone/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/doc_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/doc_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/graph_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/graph_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/graph_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/graph_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/graph_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/graph_embeddings/pinecone/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/graph_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/graph_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/triples/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/triples/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/triples/cassandra/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/triples/memgraph/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/triples/memgraph/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/triples/memgraph/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/triples/neo4j/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/query/triples/neo4j/service.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/retrieval/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/retrieval/document_rag/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/retrieval/document_rag/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/retrieval/document_rag/rag.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/retrieval/graph_rag/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/retrieval/graph_rag/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/retrieval/graph_rag/rag.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/doc_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/doc_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/doc_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/doc_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/doc_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/doc_embeddings/pinecone/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/doc_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/doc_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/graph_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/graph_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/graph_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/graph_embeddings/pinecone/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/graph_embeddings/pinecone/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/graph_embeddings/pinecone/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/graph_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/graph_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/object_embeddings/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/object_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/object_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/object_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/rows/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/rows/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/rows/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/rows/cassandra/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/triples/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/triples/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/triples/cassandra/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/triples/memgraph/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/triples/memgraph/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/triples/memgraph/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/triples/neo4j/__init__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph/storage/triples/neo4j/write.py +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph_flow.egg-info/dependency_links.txt +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/trustgraph_flow.egg-info/requires.txt +0 -0
- {trustgraph-flow-0.17.11 → trustgraph-flow-0.17.12}/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.17.
|
3
|
+
Version: 0.17.12
|
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.17.
|
9
|
+
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.17.12.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+)
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.17.12"
|
@@ -3,20 +3,19 @@ from .. schema import AgentRequest, AgentResponse
|
|
3
3
|
from .. schema import agent_request_queue
|
4
4
|
from .. schema import agent_response_queue
|
5
5
|
|
6
|
-
from . endpoint import
|
6
|
+
from . endpoint import ServiceEndpoint
|
7
|
+
from . requestor import ServiceRequestor
|
7
8
|
|
8
|
-
class
|
9
|
+
class AgentRequestor(ServiceRequestor):
|
9
10
|
def __init__(self, pulsar_host, timeout, auth):
|
10
11
|
|
11
|
-
super(
|
12
|
+
super(AgentRequestor, self).__init__(
|
12
13
|
pulsar_host=pulsar_host,
|
13
14
|
request_queue=agent_request_queue,
|
14
15
|
response_queue=agent_response_queue,
|
15
16
|
request_schema=AgentRequest,
|
16
17
|
response_schema=AgentResponse,
|
17
|
-
endpoint_path="/api/v1/agent",
|
18
18
|
timeout=timeout,
|
19
|
-
auth=auth,
|
20
19
|
)
|
21
20
|
|
22
21
|
def to_request(self, body):
|
@@ -25,7 +24,19 @@ class AgentEndpoint(MultiResponseServiceEndpoint):
|
|
25
24
|
)
|
26
25
|
|
27
26
|
def from_response(self, message):
|
27
|
+
resp = {
|
28
|
+
}
|
29
|
+
|
28
30
|
if message.answer:
|
29
|
-
|
30
|
-
|
31
|
-
|
31
|
+
resp["answer"] = message.answer
|
32
|
+
|
33
|
+
if message.thought:
|
34
|
+
resp["thought"] = message.thought
|
35
|
+
|
36
|
+
if message.observation:
|
37
|
+
resp["observation"] = message.observation
|
38
|
+
|
39
|
+
# The 2nd boolean expression indicates whether we're done responding
|
40
|
+
return resp, (message.answer is not None)
|
41
|
+
|
42
|
+
|
@@ -4,19 +4,18 @@ from .. schema import dbpedia_lookup_request_queue
|
|
4
4
|
from .. schema import dbpedia_lookup_response_queue
|
5
5
|
|
6
6
|
from . endpoint import ServiceEndpoint
|
7
|
+
from . requestor import ServiceRequestor
|
7
8
|
|
8
|
-
class
|
9
|
+
class DbpediaRequestor(ServiceRequestor):
|
9
10
|
def __init__(self, pulsar_host, timeout, auth):
|
10
11
|
|
11
|
-
super(
|
12
|
+
super(DbpediaRequestor, self).__init__(
|
12
13
|
pulsar_host=pulsar_host,
|
13
14
|
request_queue=dbpedia_lookup_request_queue,
|
14
15
|
response_queue=dbpedia_lookup_response_queue,
|
15
16
|
request_schema=LookupRequest,
|
16
17
|
response_schema=LookupResponse,
|
17
|
-
endpoint_path="/api/v1/dbpedia",
|
18
18
|
timeout=timeout,
|
19
|
-
auth=auth,
|
20
19
|
)
|
21
20
|
|
22
21
|
def to_request(self, body):
|
@@ -26,5 +25,5 @@ class DbpediaEndpoint(ServiceEndpoint):
|
|
26
25
|
)
|
27
26
|
|
28
27
|
def from_response(self, message):
|
29
|
-
return { "text": message.text }
|
28
|
+
return { "text": message.text }, True
|
30
29
|
|
@@ -4,19 +4,18 @@ from .. schema import embeddings_request_queue
|
|
4
4
|
from .. schema import embeddings_response_queue
|
5
5
|
|
6
6
|
from . endpoint import ServiceEndpoint
|
7
|
+
from . requestor import ServiceRequestor
|
7
8
|
|
8
|
-
class
|
9
|
+
class EmbeddingsRequestor(ServiceRequestor):
|
9
10
|
def __init__(self, pulsar_host, timeout, auth):
|
10
11
|
|
11
|
-
super(
|
12
|
+
super(EmbeddingsRequestor, self).__init__(
|
12
13
|
pulsar_host=pulsar_host,
|
13
14
|
request_queue=embeddings_request_queue,
|
14
15
|
response_queue=embeddings_response_queue,
|
15
16
|
request_schema=EmbeddingsRequest,
|
16
17
|
response_schema=EmbeddingsResponse,
|
17
|
-
endpoint_path="/api/v1/embeddings",
|
18
18
|
timeout=timeout,
|
19
|
-
auth=auth,
|
20
19
|
)
|
21
20
|
|
22
21
|
def to_request(self, body):
|
@@ -25,4 +24,6 @@ class EmbeddingsEndpoint(ServiceEndpoint):
|
|
25
24
|
)
|
26
25
|
|
27
26
|
def from_response(self, message):
|
28
|
-
return { "vectors": message.vectors }
|
27
|
+
return { "vectors": message.vectors }, True
|
28
|
+
|
29
|
+
|
@@ -4,19 +4,18 @@ from .. schema import encyclopedia_lookup_request_queue
|
|
4
4
|
from .. schema import encyclopedia_lookup_response_queue
|
5
5
|
|
6
6
|
from . endpoint import ServiceEndpoint
|
7
|
+
from . requestor import ServiceRequestor
|
7
8
|
|
8
|
-
class
|
9
|
+
class EncyclopediaRequestor(ServiceRequestor):
|
9
10
|
def __init__(self, pulsar_host, timeout, auth):
|
10
11
|
|
11
|
-
super(
|
12
|
+
super(EncyclopediaRequestor, self).__init__(
|
12
13
|
pulsar_host=pulsar_host,
|
13
14
|
request_queue=encyclopedia_lookup_request_queue,
|
14
15
|
response_queue=encyclopedia_lookup_response_queue,
|
15
16
|
request_schema=LookupRequest,
|
16
17
|
response_schema=LookupResponse,
|
17
|
-
endpoint_path="/api/v1/encyclopedia",
|
18
18
|
timeout=timeout,
|
19
|
-
auth=auth,
|
20
19
|
)
|
21
20
|
|
22
21
|
def to_request(self, body):
|
@@ -26,5 +25,5 @@ class EncyclopediaEndpoint(ServiceEndpoint):
|
|
26
25
|
)
|
27
26
|
|
28
27
|
def from_response(self, message):
|
29
|
-
return { "text": message.text }
|
28
|
+
return { "text": message.text }, True
|
30
29
|
|
@@ -0,0 +1,69 @@
|
|
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__(self, endpoint_path, auth, requestor):
|
17
|
+
|
18
|
+
self.path = endpoint_path
|
19
|
+
|
20
|
+
self.auth = auth
|
21
|
+
self.operation = "service"
|
22
|
+
|
23
|
+
self.requestor = requestor
|
24
|
+
|
25
|
+
async def start(self):
|
26
|
+
await self.requestor.start()
|
27
|
+
|
28
|
+
def add_routes(self, app):
|
29
|
+
|
30
|
+
app.add_routes([
|
31
|
+
web.post(self.path, self.handle),
|
32
|
+
])
|
33
|
+
|
34
|
+
async def handle(self, request):
|
35
|
+
|
36
|
+
print(request.path, "...")
|
37
|
+
|
38
|
+
try:
|
39
|
+
ht = request.headers["Authorization"]
|
40
|
+
tokens = ht.split(" ", 2)
|
41
|
+
if tokens[0] != "Bearer":
|
42
|
+
return web.HTTPUnauthorized()
|
43
|
+
token = tokens[1]
|
44
|
+
except:
|
45
|
+
token = ""
|
46
|
+
|
47
|
+
if not self.auth.permitted(token, self.operation):
|
48
|
+
return web.HTTPUnauthorized()
|
49
|
+
|
50
|
+
try:
|
51
|
+
|
52
|
+
data = await request.json()
|
53
|
+
|
54
|
+
print(data)
|
55
|
+
|
56
|
+
def responder(x, fin):
|
57
|
+
print(x)
|
58
|
+
|
59
|
+
resp, fin = await self.requestor.process(data, responder)
|
60
|
+
|
61
|
+
return web.json_response(resp)
|
62
|
+
|
63
|
+
except Exception as e:
|
64
|
+
logging.error(f"Exception: {e}")
|
65
|
+
|
66
|
+
return web.json_response(
|
67
|
+
{ "error": str(e) }
|
68
|
+
)
|
69
|
+
|
@@ -4,19 +4,18 @@ from .. schema import graph_rag_request_queue
|
|
4
4
|
from .. schema import graph_rag_response_queue
|
5
5
|
|
6
6
|
from . endpoint import ServiceEndpoint
|
7
|
+
from . requestor import ServiceRequestor
|
7
8
|
|
8
|
-
class
|
9
|
+
class GraphRagRequestor(ServiceRequestor):
|
9
10
|
def __init__(self, pulsar_host, timeout, auth):
|
10
11
|
|
11
|
-
super(
|
12
|
+
super(GraphRagRequestor, self).__init__(
|
12
13
|
pulsar_host=pulsar_host,
|
13
14
|
request_queue=graph_rag_request_queue,
|
14
15
|
response_queue=graph_rag_response_queue,
|
15
16
|
request_schema=GraphRagQuery,
|
16
17
|
response_schema=GraphRagResponse,
|
17
|
-
endpoint_path="/api/v1/graph-rag",
|
18
18
|
timeout=timeout,
|
19
|
-
auth=auth,
|
20
19
|
)
|
21
20
|
|
22
21
|
def to_request(self, body):
|
@@ -27,5 +26,5 @@ class GraphRagEndpoint(ServiceEndpoint):
|
|
27
26
|
)
|
28
27
|
|
29
28
|
def from_response(self, message):
|
30
|
-
return { "response": message.response }
|
29
|
+
return { "response": message.response }, True
|
31
30
|
|
@@ -4,19 +4,18 @@ from .. schema import internet_search_request_queue
|
|
4
4
|
from .. schema import internet_search_response_queue
|
5
5
|
|
6
6
|
from . endpoint import ServiceEndpoint
|
7
|
+
from . requestor import ServiceRequestor
|
7
8
|
|
8
|
-
class
|
9
|
+
class InternetSearchRequestor(ServiceRequestor):
|
9
10
|
def __init__(self, pulsar_host, timeout, auth):
|
10
11
|
|
11
|
-
super(
|
12
|
+
super(InternetSearchRequestor, self).__init__(
|
12
13
|
pulsar_host=pulsar_host,
|
13
14
|
request_queue=internet_search_request_queue,
|
14
15
|
response_queue=internet_search_response_queue,
|
15
16
|
request_schema=LookupRequest,
|
16
17
|
response_schema=LookupResponse,
|
17
|
-
endpoint_path="/api/v1/internet-search",
|
18
18
|
timeout=timeout,
|
19
|
-
auth=auth,
|
20
19
|
)
|
21
20
|
|
22
21
|
def to_request(self, body):
|
@@ -26,5 +25,5 @@ class InternetSearchEndpoint(ServiceEndpoint):
|
|
26
25
|
)
|
27
26
|
|
28
27
|
def from_response(self, message):
|
29
|
-
return { "text": message.text }
|
28
|
+
return { "text": message.text }, True
|
30
29
|
|
@@ -0,0 +1,94 @@
|
|
1
|
+
|
2
|
+
import asyncio
|
3
|
+
import queue
|
4
|
+
from pulsar.schema import JsonSchema
|
5
|
+
import uuid
|
6
|
+
from aiohttp import web, WSMsgType
|
7
|
+
|
8
|
+
from . socket import SocketEndpoint
|
9
|
+
from . text_completion import TextCompletionRequestor
|
10
|
+
|
11
|
+
class MuxEndpoint(SocketEndpoint):
|
12
|
+
|
13
|
+
def __init__(
|
14
|
+
self, pulsar_host, auth,
|
15
|
+
services,
|
16
|
+
path="/api/v1/mux",
|
17
|
+
):
|
18
|
+
|
19
|
+
super(MuxEndpoint, self).__init__(
|
20
|
+
endpoint_path=path, auth=auth,
|
21
|
+
)
|
22
|
+
|
23
|
+
self.q = asyncio.Queue(maxsize=10)
|
24
|
+
|
25
|
+
self.services = services
|
26
|
+
|
27
|
+
async def start(self):
|
28
|
+
pass
|
29
|
+
|
30
|
+
async def async_thread(self, ws, running):
|
31
|
+
|
32
|
+
while running.get():
|
33
|
+
|
34
|
+
try:
|
35
|
+
id, svc, request = await asyncio.wait_for(self.q.get(), 1)
|
36
|
+
except TimeoutError:
|
37
|
+
continue
|
38
|
+
except Exception as e:
|
39
|
+
await ws.send_json({"id": id, "error": str(e)})
|
40
|
+
|
41
|
+
try:
|
42
|
+
|
43
|
+
print(svc, request)
|
44
|
+
|
45
|
+
requestor = self.services[svc]
|
46
|
+
|
47
|
+
async def responder(resp, fin):
|
48
|
+
await ws.send_json({
|
49
|
+
"id": id,
|
50
|
+
"response": resp,
|
51
|
+
"complete": fin,
|
52
|
+
})
|
53
|
+
|
54
|
+
resp = await requestor.process(request, responder)
|
55
|
+
|
56
|
+
except Exception as e:
|
57
|
+
|
58
|
+
await ws.send_json({"error": str(e)})
|
59
|
+
|
60
|
+
running.stop()
|
61
|
+
|
62
|
+
async def listener(self, ws, running):
|
63
|
+
|
64
|
+
async for msg in ws:
|
65
|
+
|
66
|
+
# On error, finish
|
67
|
+
if msg.type == WSMsgType.ERROR:
|
68
|
+
break
|
69
|
+
else:
|
70
|
+
|
71
|
+
try:
|
72
|
+
|
73
|
+
data = msg.json()
|
74
|
+
|
75
|
+
if data["service"] not in self.services:
|
76
|
+
raise RuntimeError("Bad service")
|
77
|
+
|
78
|
+
if "request" not in data:
|
79
|
+
raise RuntimeError("Bad message")
|
80
|
+
|
81
|
+
if "id" not in data:
|
82
|
+
raise RuntimeError("Bad message")
|
83
|
+
|
84
|
+
await self.q.put(
|
85
|
+
(data["id"], data["service"], data["request"])
|
86
|
+
)
|
87
|
+
|
88
|
+
except Exception as e:
|
89
|
+
|
90
|
+
await ws.send_json({"error": str(e)})
|
91
|
+
continue
|
92
|
+
|
93
|
+
running.stop()
|
94
|
+
|
@@ -6,19 +6,18 @@ from .. schema import prompt_request_queue
|
|
6
6
|
from .. schema import prompt_response_queue
|
7
7
|
|
8
8
|
from . endpoint import ServiceEndpoint
|
9
|
+
from . requestor import ServiceRequestor
|
9
10
|
|
10
|
-
class
|
11
|
+
class PromptRequestor(ServiceRequestor):
|
11
12
|
def __init__(self, pulsar_host, timeout, auth):
|
12
13
|
|
13
|
-
super(
|
14
|
+
super(PromptRequestor, self).__init__(
|
14
15
|
pulsar_host=pulsar_host,
|
15
16
|
request_queue=prompt_request_queue,
|
16
17
|
response_queue=prompt_response_queue,
|
17
18
|
request_schema=PromptRequest,
|
18
19
|
response_schema=PromptResponse,
|
19
|
-
endpoint_path="/api/v1/prompt",
|
20
20
|
timeout=timeout,
|
21
|
-
auth=auth,
|
22
21
|
)
|
23
22
|
|
24
23
|
def to_request(self, body):
|
@@ -34,9 +33,9 @@ class PromptEndpoint(ServiceEndpoint):
|
|
34
33
|
if message.object:
|
35
34
|
return {
|
36
35
|
"object": message.object
|
37
|
-
}
|
36
|
+
}, True
|
38
37
|
else:
|
39
38
|
return {
|
40
39
|
"text": message.text
|
41
|
-
}
|
40
|
+
}, True
|
42
41
|
|
@@ -0,0 +1,88 @@
|
|
1
|
+
|
2
|
+
import asyncio
|
3
|
+
from pulsar.schema import JsonSchema
|
4
|
+
import uuid
|
5
|
+
import logging
|
6
|
+
|
7
|
+
from . publisher import Publisher
|
8
|
+
from . subscriber import Subscriber
|
9
|
+
|
10
|
+
logger = logging.getLogger("requestor")
|
11
|
+
logger.setLevel(logging.INFO)
|
12
|
+
|
13
|
+
class ServiceRequestor:
|
14
|
+
|
15
|
+
def __init__(
|
16
|
+
self,
|
17
|
+
pulsar_host,
|
18
|
+
request_queue, request_schema,
|
19
|
+
response_queue, response_schema,
|
20
|
+
subscription="api-gateway", consumer_name="api-gateway",
|
21
|
+
timeout=600,
|
22
|
+
):
|
23
|
+
|
24
|
+
self.pub = Publisher(
|
25
|
+
pulsar_host, request_queue,
|
26
|
+
schema=JsonSchema(request_schema)
|
27
|
+
)
|
28
|
+
|
29
|
+
self.sub = Subscriber(
|
30
|
+
pulsar_host, response_queue,
|
31
|
+
subscription, consumer_name,
|
32
|
+
JsonSchema(response_schema)
|
33
|
+
)
|
34
|
+
|
35
|
+
self.timeout = timeout
|
36
|
+
|
37
|
+
async def start(self):
|
38
|
+
|
39
|
+
self.pub.start()
|
40
|
+
self.sub.start()
|
41
|
+
|
42
|
+
def to_request(self, request):
|
43
|
+
raise RuntimeError("Not defined")
|
44
|
+
|
45
|
+
def from_response(self, response):
|
46
|
+
raise RuntimeError("Not defined")
|
47
|
+
|
48
|
+
async def process(self, request, responder=None):
|
49
|
+
|
50
|
+
id = str(uuid.uuid4())
|
51
|
+
|
52
|
+
try:
|
53
|
+
|
54
|
+
q = self.sub.subscribe(id)
|
55
|
+
|
56
|
+
await asyncio.to_thread(
|
57
|
+
self.pub.send, id, self.to_request(request)
|
58
|
+
)
|
59
|
+
|
60
|
+
while True:
|
61
|
+
|
62
|
+
try:
|
63
|
+
resp = await asyncio.to_thread(q.get, timeout=self.timeout)
|
64
|
+
except Exception as e:
|
65
|
+
raise RuntimeError("Timeout")
|
66
|
+
|
67
|
+
if resp.error:
|
68
|
+
return { "error": resp.error.message }
|
69
|
+
|
70
|
+
resp, fin = self.from_response(resp)
|
71
|
+
|
72
|
+
print(resp, fin)
|
73
|
+
|
74
|
+
if responder:
|
75
|
+
await responder(resp, fin)
|
76
|
+
|
77
|
+
if fin:
|
78
|
+
return resp
|
79
|
+
|
80
|
+
except Exception as e:
|
81
|
+
|
82
|
+
logging.error(f"Exception: {e}")
|
83
|
+
|
84
|
+
return { "error": str(e) }
|
85
|
+
|
86
|
+
finally:
|
87
|
+
self.sub.unsubscribe(id)
|
88
|
+
|
@@ -31,20 +31,22 @@ from . serialize import to_subgraph
|
|
31
31
|
from . running import Running
|
32
32
|
from . publisher import Publisher
|
33
33
|
from . subscriber import Subscriber
|
34
|
-
from .
|
35
|
-
from .
|
36
|
-
from .
|
37
|
-
from .
|
38
|
-
from .
|
39
|
-
from .
|
40
|
-
from .
|
41
|
-
from .
|
42
|
-
from .
|
43
|
-
from . internet_search import InternetSearchEndpoint
|
34
|
+
from . text_completion import TextCompletionRequestor
|
35
|
+
from . prompt import PromptRequestor
|
36
|
+
from . graph_rag import GraphRagRequestor
|
37
|
+
from . triples_query import TriplesQueryRequestor
|
38
|
+
from . embeddings import EmbeddingsRequestor
|
39
|
+
from . encyclopedia import EncyclopediaRequestor
|
40
|
+
from . agent import AgentRequestor
|
41
|
+
from . dbpedia import DbpediaRequestor
|
42
|
+
from . internet_search import InternetSearchRequestor
|
44
43
|
from . triples_stream import TriplesStreamEndpoint
|
45
44
|
from . graph_embeddings_stream import GraphEmbeddingsStreamEndpoint
|
46
45
|
from . triples_load import TriplesLoadEndpoint
|
47
46
|
from . graph_embeddings_load import GraphEmbeddingsLoadEndpoint
|
47
|
+
from . mux import MuxEndpoint
|
48
|
+
|
49
|
+
from . endpoint import ServiceEndpoint
|
48
50
|
from . auth import Authenticator
|
49
51
|
|
50
52
|
logger = logging.getLogger("api")
|
@@ -76,43 +78,82 @@ class Api:
|
|
76
78
|
else:
|
77
79
|
self.auth = Authenticator(allow_all=True)
|
78
80
|
|
79
|
-
self.
|
80
|
-
|
81
|
+
self.services = {
|
82
|
+
"text-completion": TextCompletionRequestor(
|
81
83
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
82
84
|
auth = self.auth,
|
83
85
|
),
|
84
|
-
|
86
|
+
"prompt": PromptRequestor(
|
85
87
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
86
88
|
auth = self.auth,
|
87
89
|
),
|
88
|
-
|
90
|
+
"graph-rag": GraphRagRequestor(
|
89
91
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
90
92
|
auth = self.auth,
|
91
93
|
),
|
92
|
-
|
94
|
+
"triples-query": TriplesQueryRequestor(
|
93
95
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
94
96
|
auth = self.auth,
|
95
97
|
),
|
96
|
-
|
98
|
+
"embeddings": EmbeddingsRequestor(
|
97
99
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
98
100
|
auth = self.auth,
|
99
101
|
),
|
100
|
-
|
102
|
+
"agent": AgentRequestor(
|
101
103
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
102
104
|
auth = self.auth,
|
103
105
|
),
|
104
|
-
|
106
|
+
"encyclopedia": EncyclopediaRequestor(
|
105
107
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
106
108
|
auth = self.auth,
|
107
109
|
),
|
108
|
-
|
110
|
+
"dbpedia": DbpediaRequestor(
|
109
111
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
110
112
|
auth = self.auth,
|
111
113
|
),
|
112
|
-
|
114
|
+
"internet-search": InternetSearchRequestor(
|
113
115
|
pulsar_host=self.pulsar_host, timeout=self.timeout,
|
114
116
|
auth = self.auth,
|
115
117
|
),
|
118
|
+
}
|
119
|
+
|
120
|
+
self.endpoints = [
|
121
|
+
ServiceEndpoint(
|
122
|
+
endpoint_path = "/api/v1/text-completion", auth=self.auth,
|
123
|
+
requestor = self.services["text-completion"],
|
124
|
+
),
|
125
|
+
ServiceEndpoint(
|
126
|
+
endpoint_path = "/api/v1/prompt", auth=self.auth,
|
127
|
+
requestor = self.services["prompt"],
|
128
|
+
),
|
129
|
+
ServiceEndpoint(
|
130
|
+
endpoint_path = "/api/v1/graph-rag", auth=self.auth,
|
131
|
+
requestor = self.services["graph-rag"],
|
132
|
+
),
|
133
|
+
ServiceEndpoint(
|
134
|
+
endpoint_path = "/api/v1/triples-query", auth=self.auth,
|
135
|
+
requestor = self.services["triples-query"],
|
136
|
+
),
|
137
|
+
ServiceEndpoint(
|
138
|
+
endpoint_path = "/api/v1/embeddings", auth=self.auth,
|
139
|
+
requestor = self.services["embeddings"],
|
140
|
+
),
|
141
|
+
ServiceEndpoint(
|
142
|
+
endpoint_path = "/api/v1/agent", auth=self.auth,
|
143
|
+
requestor = self.services["agent"],
|
144
|
+
),
|
145
|
+
ServiceEndpoint(
|
146
|
+
endpoint_path = "/api/v1/encyclopedia", auth=self.auth,
|
147
|
+
requestor = self.services["encyclopedia"],
|
148
|
+
),
|
149
|
+
ServiceEndpoint(
|
150
|
+
endpoint_path = "/api/v1/dbpedia", auth=self.auth,
|
151
|
+
requestor = self.services["dbpedia"],
|
152
|
+
),
|
153
|
+
ServiceEndpoint(
|
154
|
+
endpoint_path = "/api/v1/internet-search", auth=self.auth,
|
155
|
+
requestor = self.services["internet-search"],
|
156
|
+
),
|
116
157
|
TriplesStreamEndpoint(
|
117
158
|
pulsar_host=self.pulsar_host,
|
118
159
|
auth = self.auth,
|
@@ -129,6 +170,11 @@ class Api:
|
|
129
170
|
pulsar_host=self.pulsar_host,
|
130
171
|
auth = self.auth,
|
131
172
|
),
|
173
|
+
MuxEndpoint(
|
174
|
+
pulsar_host=self.pulsar_host,
|
175
|
+
auth = self.auth,
|
176
|
+
services = self.services,
|
177
|
+
),
|
132
178
|
]
|
133
179
|
|
134
180
|
self.document_out = Publisher(
|
@@ -162,7 +208,7 @@ class Api:
|
|
162
208
|
else:
|
163
209
|
metadata = []
|
164
210
|
|
165
|
-
# Doing a base64
|
211
|
+
# Doing a base64 decoe/encode here to make sure the
|
166
212
|
# content is valid base64
|
167
213
|
doc = base64.b64decode(data["data"])
|
168
214
|
|
@@ -4,19 +4,18 @@ from .. schema import text_completion_request_queue
|
|
4
4
|
from .. schema import text_completion_response_queue
|
5
5
|
|
6
6
|
from . endpoint import ServiceEndpoint
|
7
|
+
from . requestor import ServiceRequestor
|
7
8
|
|
8
|
-
class
|
9
|
+
class TextCompletionRequestor(ServiceRequestor):
|
9
10
|
def __init__(self, pulsar_host, timeout, auth):
|
10
11
|
|
11
|
-
super(
|
12
|
+
super(TextCompletionRequestor, self).__init__(
|
12
13
|
pulsar_host=pulsar_host,
|
13
14
|
request_queue=text_completion_request_queue,
|
14
15
|
response_queue=text_completion_response_queue,
|
15
16
|
request_schema=TextCompletionRequest,
|
16
17
|
response_schema=TextCompletionResponse,
|
17
|
-
endpoint_path="/api/v1/text-completion",
|
18
18
|
timeout=timeout,
|
19
|
-
auth=auth,
|
20
19
|
)
|
21
20
|
|
22
21
|
def to_request(self, body):
|
@@ -26,4 +25,5 @@ class TextCompletionEndpoint(ServiceEndpoint):
|
|
26
25
|
)
|
27
26
|
|
28
27
|
def from_response(self, message):
|
29
|
-
return { "response": message.response }
|
28
|
+
return { "response": message.response }, True
|
29
|
+
|