trustgraph-flow 0.14.16__tar.gz → 0.15.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/PKG-INFO +2 -2
- trustgraph-flow-0.15.0/scripts/agent-manager-react +6 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/setup.py +1 -0
- trustgraph-flow-0.15.0/trustgraph/agent/react/agent_manager.py +200 -0
- trustgraph-flow-0.15.0/trustgraph/agent/react/service.py +400 -0
- trustgraph-flow-0.15.0/trustgraph/agent/react/tools.py +19 -0
- trustgraph-flow-0.15.0/trustgraph/agent/react/types.py +30 -0
- trustgraph-flow-0.15.0/trustgraph/flow_version.py +1 -0
- trustgraph-flow-0.15.0/trustgraph/model/prompt/template/__main__.py +7 -0
- trustgraph-flow-0.15.0/trustgraph/query/triples/neo4j/__init__.py +3 -0
- trustgraph-flow-0.15.0/trustgraph/storage/triples/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph_flow.egg-info/PKG-INFO +2 -2
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph_flow.egg-info/SOURCES.txt +8 -0
- trustgraph-flow-0.14.16/trustgraph/flow_version.py +0 -1
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/README.md +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/chunker-recursive +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/chunker-token +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/de-query-milvus +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/de-query-qdrant +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/de-write-milvus +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/de-write-qdrant +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/document-rag +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/embeddings-ollama +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/embeddings-vectorize +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/ge-query-milvus +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/ge-query-qdrant +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/ge-write-milvus +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/ge-write-qdrant +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/graph-rag +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/kg-extract-definitions +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/kg-extract-relationships +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/kg-extract-topics +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/metering +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/object-extract-row +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/oe-write-milvus +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/pdf-decoder +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/prompt-generic +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/prompt-template +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/rows-write-cassandra +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/run-processing +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/text-completion-azure +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/text-completion-azure-openai +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/text-completion-claude +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/text-completion-cohere +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/text-completion-googleaistudio +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/text-completion-llamafile +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/text-completion-ollama +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/text-completion-openai +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/triples-query-cassandra +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/triples-query-neo4j +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/triples-write-cassandra +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/scripts/triples-write-neo4j +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/setup.cfg +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/chunking → trustgraph-flow-0.15.0/trustgraph/agent}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/model/prompt/generic → trustgraph-flow-0.15.0/trustgraph/agent/react}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/model/prompt/generic → trustgraph-flow-0.15.0/trustgraph/agent/react}/__main__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/decoding → trustgraph-flow-0.15.0/trustgraph/chunking}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/chunking/recursive/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/chunking/recursive/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/chunking/recursive/chunker.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/chunking/token/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/chunking/token/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/chunking/token/chunker.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/direct → trustgraph-flow-0.15.0/trustgraph/decoding}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/decoding/pdf/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/decoding/pdf/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/decoding/pdf/pdf_decoder.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/embeddings → trustgraph-flow-0.15.0/trustgraph/direct}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/direct/cassandra.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/direct/milvus_doc_embeddings.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/direct/milvus_graph_embeddings.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/direct/milvus_object_embeddings.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/document_rag.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/extract → trustgraph-flow-0.15.0/trustgraph/embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/embeddings/ollama/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/embeddings/ollama/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/embeddings/ollama/processor.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/embeddings/vectorize/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/embeddings/vectorize/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/embeddings/vectorize/vectorize.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/extract/kg → trustgraph-flow-0.15.0/trustgraph/extract}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/extract/object → trustgraph-flow-0.15.0/trustgraph/extract/kg}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/kg/definitions/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/kg/definitions/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/kg/definitions/extract.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/kg/relationships/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/kg/relationships/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/kg/relationships/extract.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/kg/topics/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/kg/topics/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/kg/topics/extract.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/model → trustgraph-flow-0.15.0/trustgraph/extract/object}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/object/row/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/object/row/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/extract/object/row/extract.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/graph_rag.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/metering/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/metering/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/metering/counter.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/metering/pricelist.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/model/prompt → trustgraph-flow-0.15.0/trustgraph/model}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/model/text_completion → trustgraph-flow-0.15.0/trustgraph/model/prompt}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/model/prompt/template → trustgraph-flow-0.15.0/trustgraph/model/prompt/generic}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/model/prompt/template → trustgraph-flow-0.15.0/trustgraph/model/prompt/generic}/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/prompt/generic/prompts.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/prompt/generic/service.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/query/doc_embeddings/milvus → trustgraph-flow-0.15.0/trustgraph/model/prompt/template}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/prompt/template/prompt_manager.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/prompt/template/service.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/query → trustgraph-flow-0.15.0/trustgraph/model/text_completion}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/azure/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/azure/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/azure/llm.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/azure_openai/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/azure_openai/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/azure_openai/llm.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/claude/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/claude/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/claude/llm.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/cohere/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/cohere/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/cohere/llm.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/googleaistudio/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/googleaistudio/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/googleaistudio/llm.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/llamafile/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/llamafile/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/llamafile/llm.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/ollama/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/ollama/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/ollama/llm.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/openai/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/openai/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/model/text_completion/openai/llm.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/processing/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/processing/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/processing/processing.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/query/doc_embeddings → trustgraph-flow-0.15.0/trustgraph/query}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/query/graph_embeddings → trustgraph-flow-0.15.0/trustgraph/query/doc_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/query/doc_embeddings/qdrant → trustgraph-flow-0.15.0/trustgraph/query/doc_embeddings/milvus}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/doc_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/query/graph_embeddings/milvus → trustgraph-flow-0.15.0/trustgraph/query/doc_embeddings/qdrant}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/doc_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/query/triples → trustgraph-flow-0.15.0/trustgraph/query/graph_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/query/graph_embeddings/qdrant → trustgraph-flow-0.15.0/trustgraph/query/graph_embeddings/milvus}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/graph_embeddings/milvus/service.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/query/triples/cassandra → trustgraph-flow-0.15.0/trustgraph/query/graph_embeddings/qdrant}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/graph_embeddings/qdrant/service.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/retrieval → trustgraph-flow-0.15.0/trustgraph/query/triples}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/query/triples/neo4j → trustgraph-flow-0.15.0/trustgraph/query/triples/cassandra}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/triples/cassandra/service.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/query/triples/neo4j/service.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/storage → trustgraph-flow-0.15.0/trustgraph/retrieval}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/retrieval/document_rag/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/retrieval/document_rag/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/retrieval/document_rag/rag.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/retrieval/graph_rag/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/retrieval/graph_rag/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/retrieval/graph_rag/rag.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/storage/doc_embeddings → trustgraph-flow-0.15.0/trustgraph/storage}/__init__.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/storage/graph_embeddings → trustgraph-flow-0.15.0/trustgraph/storage/doc_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/doc_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/doc_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/doc_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/doc_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/doc_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/doc_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/storage/object_embeddings → trustgraph-flow-0.15.0/trustgraph/storage/graph_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/graph_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/graph_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/graph_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/graph_embeddings/qdrant/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/graph_embeddings/qdrant/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/graph_embeddings/qdrant/write.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/storage/rows → trustgraph-flow-0.15.0/trustgraph/storage/object_embeddings}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/object_embeddings/milvus/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/object_embeddings/milvus/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/object_embeddings/milvus/write.py +0 -0
- {trustgraph-flow-0.14.16/trustgraph/storage/triples → trustgraph-flow-0.15.0/trustgraph/storage/rows}/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/rows/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/rows/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/rows/cassandra/write.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/triples/cassandra/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/triples/cassandra/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/triples/cassandra/write.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/triples/neo4j/__init__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/triples/neo4j/__main__.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph/storage/triples/neo4j/write.py +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph_flow.egg-info/dependency_links.txt +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph_flow.egg-info/requires.txt +0 -0
- {trustgraph-flow-0.14.16 → trustgraph-flow-0.15.0}/trustgraph_flow.egg-info/top_level.txt +0 -0
@@ -1,12 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: trustgraph-flow
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.15.0
|
4
4
|
Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
|
5
5
|
Home-page: https://github.com/trustgraph-ai/trustgraph
|
6
6
|
Author: trustgraph.ai
|
7
7
|
Author-email: security@trustgraph.ai
|
8
8
|
License: UNKNOWN
|
9
|
-
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.
|
9
|
+
Download-URL: https://github.com/trustgraph-ai/trustgraph/archive/refs/tags/v0.15.0.tar.gz
|
10
10
|
Platform: UNKNOWN
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
12
12
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
@@ -0,0 +1,200 @@
|
|
1
|
+
|
2
|
+
import ibis
|
3
|
+
import logging
|
4
|
+
import json
|
5
|
+
|
6
|
+
from . types import Action, Final
|
7
|
+
|
8
|
+
logger = logging.getLogger(__name__)
|
9
|
+
|
10
|
+
class AgentManager:
|
11
|
+
|
12
|
+
template="""Answer the following questions as best you can. You have
|
13
|
+
access to the following functions:
|
14
|
+
|
15
|
+
{% for tool in tools %}{
|
16
|
+
"function": "{{ tool.name }}",
|
17
|
+
"description": "{{ tool.description }}",
|
18
|
+
"arguments": [
|
19
|
+
{% for arg in tool.arguments %} {
|
20
|
+
"name": "{{ arg.name }}",
|
21
|
+
"type": "{{ arg.type }}",
|
22
|
+
"description": "{{ arg.description }}",
|
23
|
+
}
|
24
|
+
{% endfor %}
|
25
|
+
]
|
26
|
+
}
|
27
|
+
{% endfor %}
|
28
|
+
|
29
|
+
You can either choose to call a function to get more information, or
|
30
|
+
return a final answer.
|
31
|
+
|
32
|
+
To call a function, respond with a JSON object of the following format:
|
33
|
+
|
34
|
+
{
|
35
|
+
"thought": "your thought about what to do",
|
36
|
+
"action": "the action to take, should be one of [{{tool_names}}]",
|
37
|
+
"arguments": {
|
38
|
+
"argument1": "argument_value",
|
39
|
+
"argument2": "argument_value"
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
To provide a final answer, response a JSON object of the following format:
|
44
|
+
|
45
|
+
{
|
46
|
+
"thought": "I now know the final answer",
|
47
|
+
"final-answer": "the final answer to the original input question"
|
48
|
+
}
|
49
|
+
|
50
|
+
Previous steps are included in the input. Each step has the following
|
51
|
+
format in your output:
|
52
|
+
|
53
|
+
{
|
54
|
+
"thought": "your thought about what to do",
|
55
|
+
"action": "the action taken",
|
56
|
+
"arguments": {
|
57
|
+
"argument1": action argument,
|
58
|
+
"argument2": action argument2
|
59
|
+
},
|
60
|
+
"observation": "the result of the action",
|
61
|
+
}
|
62
|
+
|
63
|
+
Respond by describing either one single thought/action/arguments or
|
64
|
+
the final-answer. Pause after providing one action or final-answer.
|
65
|
+
|
66
|
+
{% if context %}Additional context has been provided:
|
67
|
+
{{context}}{% endif %}
|
68
|
+
|
69
|
+
Question: {{question}}
|
70
|
+
|
71
|
+
Input:
|
72
|
+
|
73
|
+
{% for h in history %}
|
74
|
+
{
|
75
|
+
"action": "{{h.action}}",
|
76
|
+
"arguments": [
|
77
|
+
{% for k, v in h.arguments.items() %} {
|
78
|
+
"{{k}}": "{{v}}",
|
79
|
+
{%endfor%} }
|
80
|
+
],
|
81
|
+
"observation": "{{h.observation}}"
|
82
|
+
}
|
83
|
+
{% endfor %}"""
|
84
|
+
|
85
|
+
def __init__(self, context, tools, additional_context=None):
|
86
|
+
self.context = context
|
87
|
+
self.tools = tools
|
88
|
+
self.additional_context = additional_context
|
89
|
+
|
90
|
+
def reason(self, question, history):
|
91
|
+
|
92
|
+
tpl = ibis.Template(self.template)
|
93
|
+
|
94
|
+
tools = self.tools
|
95
|
+
|
96
|
+
tool_names = ",".join([
|
97
|
+
t for t in self.tools.keys()
|
98
|
+
])
|
99
|
+
|
100
|
+
prompt = tpl.render({
|
101
|
+
"tools": [
|
102
|
+
{
|
103
|
+
"name": tool.name,
|
104
|
+
"description": tool.description,
|
105
|
+
"arguments": [
|
106
|
+
{
|
107
|
+
"name": arg.name,
|
108
|
+
"type": arg.type,
|
109
|
+
"description": arg.description
|
110
|
+
}
|
111
|
+
for arg in tool.arguments.values()
|
112
|
+
]
|
113
|
+
}
|
114
|
+
for tool in self.tools.values()
|
115
|
+
],
|
116
|
+
"context": self.additional_context,
|
117
|
+
"question": question,
|
118
|
+
"tool_names": tool_names,
|
119
|
+
"history": [
|
120
|
+
{
|
121
|
+
"thought": h.thought,
|
122
|
+
"action": h.name,
|
123
|
+
"arguments": h.arguments,
|
124
|
+
"observation": h.observation,
|
125
|
+
}
|
126
|
+
for h in history
|
127
|
+
],
|
128
|
+
})
|
129
|
+
|
130
|
+
print(prompt)
|
131
|
+
|
132
|
+
logger.info(f"prompt: {prompt}")
|
133
|
+
|
134
|
+
resp = self.context.prompt.request(
|
135
|
+
"question",
|
136
|
+
{
|
137
|
+
"question": prompt
|
138
|
+
}
|
139
|
+
)
|
140
|
+
|
141
|
+
resp = resp.replace("```json", "")
|
142
|
+
resp = resp.replace("```", "")
|
143
|
+
|
144
|
+
logger.info(f"response: {resp}")
|
145
|
+
|
146
|
+
obj = json.loads(resp)
|
147
|
+
|
148
|
+
if obj.get("final-answer"):
|
149
|
+
|
150
|
+
a = Final(
|
151
|
+
thought = obj.get("thought"),
|
152
|
+
final = obj.get("final-answer"),
|
153
|
+
)
|
154
|
+
|
155
|
+
return a
|
156
|
+
|
157
|
+
else:
|
158
|
+
|
159
|
+
a = Action(
|
160
|
+
thought = obj.get("thought"),
|
161
|
+
name = obj.get("action"),
|
162
|
+
arguments = obj.get("arguments"),
|
163
|
+
observation = ""
|
164
|
+
)
|
165
|
+
|
166
|
+
return a
|
167
|
+
|
168
|
+
def react(self, question, history, think, observe):
|
169
|
+
|
170
|
+
act = self.reason(question, history)
|
171
|
+
logger.info(f"act: {act}")
|
172
|
+
|
173
|
+
if isinstance(act, Final):
|
174
|
+
|
175
|
+
think(act.thought)
|
176
|
+
return act
|
177
|
+
|
178
|
+
else:
|
179
|
+
|
180
|
+
think(act.thought)
|
181
|
+
|
182
|
+
if act.name in self.tools:
|
183
|
+
action = self.tools[act.name]
|
184
|
+
else:
|
185
|
+
raise RuntimeError(f"No action for {act.name}!")
|
186
|
+
|
187
|
+
resp = action.implementation.invoke(**act.arguments)
|
188
|
+
|
189
|
+
resp = resp.strip()
|
190
|
+
|
191
|
+
logger.info(f"resp: {resp}")
|
192
|
+
|
193
|
+
observe(resp)
|
194
|
+
|
195
|
+
act.observation = resp
|
196
|
+
|
197
|
+
logger.info(f"iter: {act}")
|
198
|
+
|
199
|
+
return act
|
200
|
+
|
@@ -0,0 +1,400 @@
|
|
1
|
+
"""
|
2
|
+
Simple agent infrastructure broadly implements the ReAct flow.
|
3
|
+
"""
|
4
|
+
|
5
|
+
import json
|
6
|
+
import re
|
7
|
+
import sys
|
8
|
+
|
9
|
+
from pulsar.schema import JsonSchema
|
10
|
+
|
11
|
+
from ... base import ConsumerProducer
|
12
|
+
from ... schema import Error
|
13
|
+
from ... schema import AgentRequest, AgentResponse, AgentStep
|
14
|
+
from ... schema import agent_request_queue, agent_response_queue
|
15
|
+
from ... schema import prompt_request_queue as pr_request_queue
|
16
|
+
from ... schema import prompt_response_queue as pr_response_queue
|
17
|
+
from ... schema import text_completion_request_queue as tc_request_queue
|
18
|
+
from ... schema import text_completion_response_queue as tc_response_queue
|
19
|
+
from ... schema import graph_rag_request_queue as gr_request_queue
|
20
|
+
from ... schema import graph_rag_response_queue as gr_response_queue
|
21
|
+
from ... clients.prompt_client import PromptClient
|
22
|
+
from ... clients.llm_client import LlmClient
|
23
|
+
from ... clients.graph_rag_client import GraphRagClient
|
24
|
+
|
25
|
+
from . tools import KnowledgeQueryImpl, TextCompletionImpl
|
26
|
+
from . agent_manager import AgentManager
|
27
|
+
|
28
|
+
from . types import Final, Action, Tool, Argument
|
29
|
+
|
30
|
+
module = ".".join(__name__.split(".")[1:-1])
|
31
|
+
|
32
|
+
default_input_queue = agent_request_queue
|
33
|
+
default_output_queue = agent_response_queue
|
34
|
+
default_subscriber = module
|
35
|
+
|
36
|
+
class Processor(ConsumerProducer):
|
37
|
+
|
38
|
+
def __init__(self, **params):
|
39
|
+
|
40
|
+
additional = params.get("context", None)
|
41
|
+
|
42
|
+
tools = {}
|
43
|
+
|
44
|
+
# Parsing the prompt information to the prompt configuration
|
45
|
+
# structure
|
46
|
+
tool_type_arg = params.get("tool_type", [])
|
47
|
+
if tool_type_arg:
|
48
|
+
for t in tool_type_arg:
|
49
|
+
toks = t.split("=", 1)
|
50
|
+
if len(toks) < 2:
|
51
|
+
raise RuntimeError(
|
52
|
+
f"Tool-type string not well-formed: {t}"
|
53
|
+
)
|
54
|
+
ttoks = toks[1].split(":", 1)
|
55
|
+
if len(ttoks) < 1:
|
56
|
+
raise RuntimeError(
|
57
|
+
f"Tool-type string not well-formed: {t}"
|
58
|
+
)
|
59
|
+
|
60
|
+
if ttoks[0] == "knowledge-query":
|
61
|
+
impl = KnowledgeQueryImpl(self)
|
62
|
+
elif ttoks[0] == "text-completion":
|
63
|
+
impl = TextCompletionImpl(self)
|
64
|
+
else:
|
65
|
+
raise RuntimeError(
|
66
|
+
f"Tool-kind {ttoks[0]} not known"
|
67
|
+
)
|
68
|
+
|
69
|
+
if len(ttoks) == 1:
|
70
|
+
tools[toks[0]] = Tool(
|
71
|
+
name = ttoks[0],
|
72
|
+
description = "",
|
73
|
+
implementation = impl,
|
74
|
+
config = { "input": "query" },
|
75
|
+
arguments = {},
|
76
|
+
)
|
77
|
+
else:
|
78
|
+
tools[toks[0]] = Tool(
|
79
|
+
name = ttoks[0],
|
80
|
+
description = "",
|
81
|
+
implementation = impl,
|
82
|
+
config = { "input": ttoks[1] },
|
83
|
+
arguments = {},
|
84
|
+
)
|
85
|
+
|
86
|
+
# parsing the prompt information to the prompt configuration
|
87
|
+
# structure
|
88
|
+
tool_desc_arg = params.get("tool_description", [])
|
89
|
+
if tool_desc_arg:
|
90
|
+
for t in tool_desc_arg:
|
91
|
+
toks = t.split("=", 1)
|
92
|
+
if len(toks) < 2:
|
93
|
+
raise runtimeerror(
|
94
|
+
f"tool-type string not well-formed: {t}"
|
95
|
+
)
|
96
|
+
if toks[0] not in tools:
|
97
|
+
raise runtimeerror(f"description, tool {toks[0]} not known")
|
98
|
+
tools[toks[0]].description = toks[1]
|
99
|
+
|
100
|
+
# Parsing the prompt information to the prompt configuration
|
101
|
+
# structure
|
102
|
+
tool_arg_arg = params.get("tool_argument", [])
|
103
|
+
if tool_arg_arg:
|
104
|
+
for t in tool_arg_arg:
|
105
|
+
toks = t.split("=", 1)
|
106
|
+
if len(toks) < 2:
|
107
|
+
raise RuntimeError(
|
108
|
+
f"Tool-type string not well-formed: {t}"
|
109
|
+
)
|
110
|
+
ttoks = toks[1].split(":", 2)
|
111
|
+
if len(ttoks) != 3:
|
112
|
+
raise RuntimeError(
|
113
|
+
f"Tool argument string not well-formed: {t}"
|
114
|
+
)
|
115
|
+
if toks[0] not in tools:
|
116
|
+
raise RuntimeError(f"Description, tool {toks[0]} not known")
|
117
|
+
tools[toks[0]].arguments[ttoks[0]] = Argument(
|
118
|
+
name = ttoks[0],
|
119
|
+
type = ttoks[1],
|
120
|
+
description = ttoks[2]
|
121
|
+
)
|
122
|
+
|
123
|
+
input_queue = params.get("input_queue", default_input_queue)
|
124
|
+
output_queue = params.get("output_queue", default_output_queue)
|
125
|
+
subscriber = params.get("subscriber", default_subscriber)
|
126
|
+
prompt_request_queue = params.get(
|
127
|
+
"prompt_request_queue", pr_request_queue
|
128
|
+
)
|
129
|
+
prompt_response_queue = params.get(
|
130
|
+
"prompt_response_queue", pr_response_queue
|
131
|
+
)
|
132
|
+
text_completion_request_queue = params.get(
|
133
|
+
"text_completion_request_queue", tc_request_queue
|
134
|
+
)
|
135
|
+
text_completion_response_queue = params.get(
|
136
|
+
"text_completion_response_queue", tc_response_queue
|
137
|
+
)
|
138
|
+
graph_rag_request_queue = params.get(
|
139
|
+
"graph_rag_request_queue", gr_request_queue
|
140
|
+
)
|
141
|
+
graph_rag_response_queue = params.get(
|
142
|
+
"graph_rag_response_queue", gr_response_queue
|
143
|
+
)
|
144
|
+
|
145
|
+
super(Processor, self).__init__(
|
146
|
+
**params | {
|
147
|
+
"input_queue": input_queue,
|
148
|
+
"output_queue": output_queue,
|
149
|
+
"subscriber": subscriber,
|
150
|
+
"input_schema": AgentRequest,
|
151
|
+
"output_schema": AgentResponse,
|
152
|
+
"prompt_request_queue": prompt_request_queue,
|
153
|
+
"prompt_response_queue": prompt_response_queue,
|
154
|
+
"text_completion_request_queue": tc_request_queue,
|
155
|
+
"text_completion_response_queue": tc_response_queue,
|
156
|
+
"graph_rag_request_queue": gr_request_queue,
|
157
|
+
"graph_rag_response_queue": gr_response_queue,
|
158
|
+
}
|
159
|
+
)
|
160
|
+
|
161
|
+
self.prompt = PromptClient(
|
162
|
+
subscriber=subscriber,
|
163
|
+
input_queue=prompt_request_queue,
|
164
|
+
output_queue=prompt_response_queue,
|
165
|
+
pulsar_host = self.pulsar_host
|
166
|
+
)
|
167
|
+
|
168
|
+
self.llm = LlmClient(
|
169
|
+
subscriber=subscriber,
|
170
|
+
input_queue=text_completion_request_queue,
|
171
|
+
output_queue=text_completion_response_queue,
|
172
|
+
pulsar_host = self.pulsar_host
|
173
|
+
)
|
174
|
+
|
175
|
+
self.graph_rag = GraphRagClient(
|
176
|
+
subscriber=subscriber,
|
177
|
+
input_queue=graph_rag_request_queue,
|
178
|
+
output_queue=graph_rag_response_queue,
|
179
|
+
pulsar_host = self.pulsar_host
|
180
|
+
)
|
181
|
+
|
182
|
+
# Need to be able to feed requests to myself
|
183
|
+
self.recursive_input = self.client.create_producer(
|
184
|
+
topic=input_queue,
|
185
|
+
schema=JsonSchema(AgentRequest),
|
186
|
+
)
|
187
|
+
|
188
|
+
self.agent = AgentManager(
|
189
|
+
context=self,
|
190
|
+
tools=tools,
|
191
|
+
additional_context=additional
|
192
|
+
)
|
193
|
+
|
194
|
+
def parse_json(self, text):
|
195
|
+
json_match = re.search(r'```(?:json)?(.*?)```', text, re.DOTALL)
|
196
|
+
|
197
|
+
if json_match:
|
198
|
+
json_str = json_match.group(1).strip()
|
199
|
+
else:
|
200
|
+
# If no delimiters, assume the entire output is JSON
|
201
|
+
json_str = text.strip()
|
202
|
+
|
203
|
+
return json.loads(json_str)
|
204
|
+
|
205
|
+
def handle(self, msg):
|
206
|
+
|
207
|
+
try:
|
208
|
+
|
209
|
+
v = msg.value()
|
210
|
+
|
211
|
+
# Sender-produced ID
|
212
|
+
id = msg.properties()["id"]
|
213
|
+
|
214
|
+
if v.history:
|
215
|
+
history = [
|
216
|
+
Action(
|
217
|
+
thought=h.thought,
|
218
|
+
name=h.action,
|
219
|
+
arguments=h.arguments,
|
220
|
+
observation=h.observation
|
221
|
+
)
|
222
|
+
for h in v.history
|
223
|
+
]
|
224
|
+
else:
|
225
|
+
history = []
|
226
|
+
|
227
|
+
print(f"Question: {v.question}", flush=True)
|
228
|
+
|
229
|
+
if len(history) > 10:
|
230
|
+
raise RuntimeError("Too many agent iterations")
|
231
|
+
|
232
|
+
print(f"History: {history}", flush=True)
|
233
|
+
|
234
|
+
def think(x):
|
235
|
+
|
236
|
+
print(f"Think: {x}", flush=True)
|
237
|
+
|
238
|
+
r = AgentResponse(
|
239
|
+
answer=None,
|
240
|
+
error=None,
|
241
|
+
thought=x,
|
242
|
+
observation=None,
|
243
|
+
)
|
244
|
+
|
245
|
+
self.producer.send(r, properties={"id": id})
|
246
|
+
|
247
|
+
def observe(x):
|
248
|
+
|
249
|
+
print(f"Observe: {x}", flush=True)
|
250
|
+
|
251
|
+
r = AgentResponse(
|
252
|
+
answer=None,
|
253
|
+
error=None,
|
254
|
+
thought=None,
|
255
|
+
observation=x,
|
256
|
+
)
|
257
|
+
|
258
|
+
self.producer.send(r, properties={"id": id})
|
259
|
+
|
260
|
+
act = self.agent.react(v.question, history, think, observe)
|
261
|
+
|
262
|
+
print(f"Action: {act}", flush=True)
|
263
|
+
|
264
|
+
print("Send response...", flush=True)
|
265
|
+
|
266
|
+
if type(act) == Final:
|
267
|
+
|
268
|
+
r = AgentResponse(
|
269
|
+
answer=act.final,
|
270
|
+
error=None,
|
271
|
+
thought=None,
|
272
|
+
)
|
273
|
+
|
274
|
+
self.producer.send(r, properties={"id": id})
|
275
|
+
|
276
|
+
print("Done.", flush=True)
|
277
|
+
|
278
|
+
return
|
279
|
+
|
280
|
+
history.append(act)
|
281
|
+
|
282
|
+
r = AgentRequest(
|
283
|
+
question=v.question,
|
284
|
+
plan=v.plan,
|
285
|
+
state=v.state,
|
286
|
+
history=[
|
287
|
+
AgentStep(
|
288
|
+
thought=h.thought,
|
289
|
+
action=h.name,
|
290
|
+
arguments=h.arguments,
|
291
|
+
observation=h.observation
|
292
|
+
)
|
293
|
+
for h in history
|
294
|
+
]
|
295
|
+
)
|
296
|
+
|
297
|
+
self.recursive_input.send(r, properties={"id": id})
|
298
|
+
|
299
|
+
print("Done.", flush=True)
|
300
|
+
|
301
|
+
return
|
302
|
+
|
303
|
+
except Exception as e:
|
304
|
+
|
305
|
+
print(f"Exception: {e}")
|
306
|
+
|
307
|
+
print("Send error response...", flush=True)
|
308
|
+
|
309
|
+
r = AgentResponse(
|
310
|
+
error=Error(
|
311
|
+
type = "agent-error",
|
312
|
+
message = str(e),
|
313
|
+
),
|
314
|
+
response=None,
|
315
|
+
)
|
316
|
+
|
317
|
+
self.producer.send(r, properties={"id": id})
|
318
|
+
|
319
|
+
@staticmethod
|
320
|
+
def add_args(parser):
|
321
|
+
|
322
|
+
ConsumerProducer.add_args(
|
323
|
+
parser, default_input_queue, default_subscriber,
|
324
|
+
default_output_queue,
|
325
|
+
)
|
326
|
+
|
327
|
+
parser.add_argument(
|
328
|
+
'--prompt-request-queue',
|
329
|
+
default=pr_request_queue,
|
330
|
+
help=f'Prompt request queue (default: {pr_request_queue})',
|
331
|
+
)
|
332
|
+
|
333
|
+
parser.add_argument(
|
334
|
+
'--prompt-response-queue',
|
335
|
+
default=pr_response_queue,
|
336
|
+
help=f'Prompt response queue (default: {pr_response_queue})',
|
337
|
+
)
|
338
|
+
|
339
|
+
parser.add_argument(
|
340
|
+
'--text-completion-request-queue',
|
341
|
+
default=tc_request_queue,
|
342
|
+
help=f'Text completion request queue (default: {tc_request_queue})',
|
343
|
+
)
|
344
|
+
|
345
|
+
parser.add_argument(
|
346
|
+
'--text-completion-response-queue',
|
347
|
+
default=tc_response_queue,
|
348
|
+
help=f'Text completion response queue (default: {tc_response_queue})',
|
349
|
+
)
|
350
|
+
|
351
|
+
parser.add_argument(
|
352
|
+
'--graph-rag-request-queue',
|
353
|
+
default=gr_request_queue,
|
354
|
+
help=f'Graph RAG request queue (default: {gr_request_queue})',
|
355
|
+
)
|
356
|
+
|
357
|
+
parser.add_argument(
|
358
|
+
'--graph-rag-response-queue',
|
359
|
+
default=gr_response_queue,
|
360
|
+
help=f'Graph RAG response queue (default: {gr_response_queue})',
|
361
|
+
)
|
362
|
+
|
363
|
+
parser.add_argument(
|
364
|
+
'--tool-type', nargs='*',
|
365
|
+
help=f'''Specifies the type of an agent tool. Takes the form
|
366
|
+
<id>=<specifier>. <id> is the name of the tool. <specifier> is one of
|
367
|
+
knowledge-query, text-completion. Additional parameters are specified
|
368
|
+
for different tools which are tool-specific. e.g. knowledge-query:<arg>
|
369
|
+
which specifies the name of the arg whose content is fed into the knowledge
|
370
|
+
query as a question. text-completion:<arg> specifies the name of the arg
|
371
|
+
whose content is fed into the text-completion service as a prompt'''
|
372
|
+
)
|
373
|
+
|
374
|
+
parser.add_argument(
|
375
|
+
'--tool-description', nargs='*',
|
376
|
+
help=f'''Specifies the textual description of a tool. Takes
|
377
|
+
the form <id>=<description>. The description is important, it teaches the
|
378
|
+
LLM how to use the tool. It should describe what it does and how to
|
379
|
+
use the arguments. This is specified in natural language.'''
|
380
|
+
)
|
381
|
+
|
382
|
+
parser.add_argument(
|
383
|
+
'--tool-argument', nargs='*',
|
384
|
+
help=f'''Specifies argument usage for a tool. Takes
|
385
|
+
the form <id>=<arg>:<type>:<description>. The description is important,
|
386
|
+
it is read by the LLM and used to determine how to use the argument.
|
387
|
+
<id> can be specified multiple times to give a tool multiple arguments.
|
388
|
+
<type> is one of string, number. <description> is a natural language
|
389
|
+
description.'''
|
390
|
+
)
|
391
|
+
|
392
|
+
parser.add_argument(
|
393
|
+
'--context',
|
394
|
+
help=f'Optional, specifies additional context text for the LLM.'
|
395
|
+
)
|
396
|
+
|
397
|
+
def run():
|
398
|
+
|
399
|
+
Processor.start(module, __doc__)
|
400
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
# This tool implementation knows how to put a question to the graph RAG
|
3
|
+
# service
|
4
|
+
class KnowledgeQueryImpl:
|
5
|
+
def __init__(self, context):
|
6
|
+
self.context = context
|
7
|
+
def invoke(self, **arguments):
|
8
|
+
return self.context.graph_rag.request(arguments.get("query"))
|
9
|
+
|
10
|
+
# This tool implementation knows how to do text completion. This uses
|
11
|
+
# the prompt service, rather than talking to TextCompletion directly.
|
12
|
+
class TextCompletionImpl:
|
13
|
+
def __init__(self, context):
|
14
|
+
self.context = context
|
15
|
+
def invoke(self, **arguments):
|
16
|
+
return self.context.prompt.request(
|
17
|
+
"question", { "question": arguments.get("computation") }
|
18
|
+
)
|
19
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
import dataclasses
|
3
|
+
from typing import Any, Dict
|
4
|
+
|
5
|
+
@dataclasses.dataclass
|
6
|
+
class Argument:
|
7
|
+
name : str
|
8
|
+
type : str
|
9
|
+
description : str
|
10
|
+
|
11
|
+
@dataclasses.dataclass
|
12
|
+
class Tool:
|
13
|
+
name : str
|
14
|
+
description : str
|
15
|
+
arguments : list[Argument]
|
16
|
+
implementation : Any
|
17
|
+
config : Dict[str, str]
|
18
|
+
|
19
|
+
@dataclasses.dataclass
|
20
|
+
class Action:
|
21
|
+
thought : str
|
22
|
+
name : str
|
23
|
+
arguments : dict
|
24
|
+
observation : str
|
25
|
+
|
26
|
+
@dataclasses.dataclass
|
27
|
+
class Final:
|
28
|
+
thought : str
|
29
|
+
final : str
|
30
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.15.0"
|
File without changes
|