trustgraph-base 2.6.2__tar.gz → 2.6.4__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_base-2.6.2 → trustgraph_base-2.6.4}/PKG-INFO +1 -1
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/async_flow.py +10 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/async_socket_client.py +13 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/explainability.py +19 -4
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/flow.py +13 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/socket_client.py +13 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/__init__.py +2 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/prompt_client.py +0 -15
- trustgraph_base-2.6.4/trustgraph/base/reranker_client.py +43 -0
- trustgraph_base-2.6.4/trustgraph/base/reranker_service.py +109 -0
- trustgraph_base-2.6.4/trustgraph/base_version.py +1 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/prompt_client.py +0 -14
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/__init__.py +7 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/__init__.py +1 -0
- trustgraph_base-2.6.4/trustgraph/messaging/translators/reranker.py +73 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/provenance/__init__.py +6 -2
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/provenance/namespaces.py +4 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/provenance/triples.py +24 -4
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/provenance/vocabulary.py +3 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/__init__.py +2 -1
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/prompt.py +1 -12
- trustgraph_base-2.6.4/trustgraph/schema/services/reranker.py +35 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph_base.egg-info/PKG-INFO +1 -1
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph_base.egg-info/SOURCES.txt +4 -0
- trustgraph_base-2.6.2/trustgraph/base_version.py +0 -1
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/README.md +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/pyproject.toml +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/setup.cfg +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/__init__.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/api.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/async_bulk_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/async_metrics.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/bulk_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/collection.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/config.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/exceptions.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/knowledge.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/library.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/metrics.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/api/types.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/agent_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/agent_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/async_processor.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/backend.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/cassandra_config.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/chunking_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/collection_config_handler.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/config_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/consumer.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/consumer_spec.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/document_embeddings_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/document_embeddings_query_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/document_embeddings_store_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/dynamic_tool_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/embeddings_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/embeddings_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/flow.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/flow_processor.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/graph_embeddings_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/graph_embeddings_query_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/graph_embeddings_store_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/graph_rag_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/iam_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/kafka_backend.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/librarian_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/librarian_spec.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/llm_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/logging.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/metrics.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/parameter_spec.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/processor_group.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/producer.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/producer_spec.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/publisher.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/pubsub.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/pulsar_backend.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/qdrant_config.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/rabbitmq_backend.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/request_response_spec.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/row_embeddings_query_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/serialization.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/spec.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/structured_query_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/subscriber.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/subscriber_spec.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/text_completion_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/tool_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/tool_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/tool_service_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/triples_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/triples_query_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/triples_store_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/base/workspace_processor.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/__init__.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/agent_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/base.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/config_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/document_embeddings_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/document_rag_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/embeddings_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/graph_embeddings_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/graph_rag_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/llm_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/row_embeddings_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/clients/triples_query_client.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/exceptions.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/__init__.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/__init__.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/ar.json +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/en.json +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/es.json +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/he.json +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/hi.json +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/pt.json +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/ru.json +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/sw.json +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/tr.json +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/i18n/packs/zh-cn.json +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/knowledge/__init__.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/knowledge/defs.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/knowledge/document.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/knowledge/identifier.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/knowledge/organization.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/knowledge/publication.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/log_level.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/registry.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/agent.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/base.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/collection.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/config.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/diagnosis.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/document_loading.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/embeddings.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/embeddings_query.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/flow.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/iam.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/knowledge.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/library.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/metadata.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/nlp_query.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/primitives.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/prompt.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/retrieval.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/rows_query.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/sparql_query.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/structured_query.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/text_completion.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/tool.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/triples.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/objects/__init__.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/objects/field.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/objects/object.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/provenance/agent.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/provenance/uris.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/rdf.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/__init__.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/core/__init__.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/core/metadata.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/core/primitives.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/core/topic.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/knowledge/__init__.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/knowledge/document.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/knowledge/embeddings.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/knowledge/graph.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/knowledge/knowledge.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/knowledge/nlp.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/knowledge/object.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/knowledge/rows.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/knowledge/structured.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/agent.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/collection.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/config.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/diagnosis.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/flow.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/iam.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/library.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/llm.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/lookup.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/nlp_query.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/query.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/retrieval.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/rows_query.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/sparql_query.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/storage.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/structured_query.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/schema/services/tool_service.py +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph_base.egg-info/dependency_links.txt +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph_base.egg-info/entry_points.txt +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph_base.egg-info/requires.txt +0 -0
- {trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph_base.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trustgraph-base
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.4
|
|
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
|
Author-email: "trustgraph.ai" <security@trustgraph.ai>
|
|
6
6
|
Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
|
|
@@ -646,6 +646,16 @@ class AsyncFlowInstance:
|
|
|
646
646
|
|
|
647
647
|
return await self.request("embeddings", request_data)
|
|
648
648
|
|
|
649
|
+
async def rerank(self, queries: list, documents: list, limit: int = 10, **kwargs: Any):
|
|
650
|
+
request_data = {
|
|
651
|
+
"queries": queries,
|
|
652
|
+
"documents": documents,
|
|
653
|
+
"limit": limit,
|
|
654
|
+
}
|
|
655
|
+
request_data.update(kwargs)
|
|
656
|
+
|
|
657
|
+
return await self.request("reranker", request_data)
|
|
658
|
+
|
|
649
659
|
async def triples_query(self, s=None, p=None, o=None, collection=None, limit=100, **kwargs: Any):
|
|
650
660
|
"""
|
|
651
661
|
Query RDF triples using pattern matching.
|
|
@@ -443,6 +443,19 @@ class AsyncSocketFlowInstance:
|
|
|
443
443
|
|
|
444
444
|
return await self.client._send_request("embeddings", self.flow_id, request)
|
|
445
445
|
|
|
446
|
+
async def rerank(self, queries: list, documents: list, limit: int = 10,
|
|
447
|
+
**kwargs):
|
|
448
|
+
request = {
|
|
449
|
+
"queries": queries,
|
|
450
|
+
"documents": documents,
|
|
451
|
+
"limit": limit,
|
|
452
|
+
}
|
|
453
|
+
request.update(kwargs)
|
|
454
|
+
|
|
455
|
+
return await self.client._send_request(
|
|
456
|
+
"reranker", self.flow_id, request,
|
|
457
|
+
)
|
|
458
|
+
|
|
446
459
|
async def triples_query(self, s=None, p=None, o=None, collection=None, limit=100, **kwargs):
|
|
447
460
|
"""Triple pattern query"""
|
|
448
461
|
request = {"limit": limit}
|
|
@@ -18,6 +18,7 @@ TG_EDGE_COUNT = TG + "edgeCount"
|
|
|
18
18
|
TG_SELECTED_EDGE = TG + "selectedEdge"
|
|
19
19
|
TG_EDGE = TG + "edge"
|
|
20
20
|
TG_REASONING = TG + "reasoning"
|
|
21
|
+
TG_SCORE = TG + "score"
|
|
21
22
|
TG_DOCUMENT = TG + "document"
|
|
22
23
|
TG_CONCEPT = TG + "concept"
|
|
23
24
|
TG_ENTITY = TG + "entity"
|
|
@@ -66,10 +67,12 @@ RDFS_LABEL = "http://www.w3.org/2000/01/rdf-schema#label"
|
|
|
66
67
|
|
|
67
68
|
@dataclass
|
|
68
69
|
class EdgeSelection:
|
|
69
|
-
"""A selected edge with
|
|
70
|
+
"""A selected edge with cross-encoder metadata from GraphRAG Focus step."""
|
|
70
71
|
uri: str
|
|
71
72
|
edge: Optional[Dict[str, str]] = None # {"s": ..., "p": ..., "o": ...}
|
|
72
73
|
reasoning: str = ""
|
|
74
|
+
concept: str = ""
|
|
75
|
+
score: Optional[float] = None
|
|
73
76
|
|
|
74
77
|
|
|
75
78
|
@dataclass
|
|
@@ -209,7 +212,7 @@ class Exploration(ExplainEntity):
|
|
|
209
212
|
|
|
210
213
|
@dataclass
|
|
211
214
|
class Focus(ExplainEntity):
|
|
212
|
-
"""Focus entity - selected edges with
|
|
215
|
+
"""Focus entity - selected edges with cross-encoder scoring (GraphRAG only)."""
|
|
213
216
|
selected_edge_uris: List[str] = field(default_factory=list)
|
|
214
217
|
edge_selections: List[EdgeSelection] = field(default_factory=list)
|
|
215
218
|
|
|
@@ -418,14 +421,26 @@ def parse_edge_selection_triples(triples: List[Tuple[str, str, Any]]) -> EdgeSel
|
|
|
418
421
|
uri = triples[0][0] if triples else ""
|
|
419
422
|
edge = None
|
|
420
423
|
reasoning = ""
|
|
424
|
+
concept = ""
|
|
425
|
+
score = None
|
|
421
426
|
|
|
422
427
|
for s, p, o in triples:
|
|
423
428
|
if p == TG_EDGE and isinstance(o, dict):
|
|
424
429
|
edge = o
|
|
425
430
|
elif p == TG_REASONING:
|
|
426
431
|
reasoning = o
|
|
427
|
-
|
|
428
|
-
|
|
432
|
+
elif p == TG_CONCEPT:
|
|
433
|
+
concept = o
|
|
434
|
+
elif p == TG_SCORE:
|
|
435
|
+
try:
|
|
436
|
+
score = float(o)
|
|
437
|
+
except (ValueError, TypeError):
|
|
438
|
+
score = None
|
|
439
|
+
|
|
440
|
+
return EdgeSelection(
|
|
441
|
+
uri=uri, edge=edge, reasoning=reasoning,
|
|
442
|
+
concept=concept, score=score,
|
|
443
|
+
)
|
|
429
444
|
|
|
430
445
|
|
|
431
446
|
def extract_term_value(term: Dict[str, Any]) -> Any:
|
|
@@ -491,6 +491,19 @@ class FlowInstance:
|
|
|
491
491
|
input
|
|
492
492
|
)["vectors"]
|
|
493
493
|
|
|
494
|
+
def rerank(self, queries, documents, limit=10):
|
|
495
|
+
|
|
496
|
+
input = {
|
|
497
|
+
"queries": queries,
|
|
498
|
+
"documents": documents,
|
|
499
|
+
"limit": limit,
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
return self.request(
|
|
503
|
+
"service/reranker",
|
|
504
|
+
input
|
|
505
|
+
)
|
|
506
|
+
|
|
494
507
|
def graph_embeddings_query(self, text, collection, limit=10):
|
|
495
508
|
"""
|
|
496
509
|
Query knowledge graph entities using semantic similarity.
|
|
@@ -885,6 +885,19 @@ class SocketFlowInstance:
|
|
|
885
885
|
|
|
886
886
|
return self.client._send_request_sync("embeddings", self.flow_id, request, False)
|
|
887
887
|
|
|
888
|
+
def rerank(self, queries: list, documents: list, limit: int = 10,
|
|
889
|
+
**kwargs: Any) -> Dict[str, Any]:
|
|
890
|
+
request = {
|
|
891
|
+
"queries": queries,
|
|
892
|
+
"documents": documents,
|
|
893
|
+
"limit": limit,
|
|
894
|
+
}
|
|
895
|
+
request.update(kwargs)
|
|
896
|
+
|
|
897
|
+
return self.client._send_request_sync(
|
|
898
|
+
"reranker", self.flow_id, request, False,
|
|
899
|
+
)
|
|
900
|
+
|
|
888
901
|
def triples_query(
|
|
889
902
|
self,
|
|
890
903
|
s: Optional[Union[str, Dict[str, Any]]] = None,
|
|
@@ -42,6 +42,8 @@ from . dynamic_tool_service import DynamicToolService
|
|
|
42
42
|
from . tool_service_client import ToolServiceClientSpec
|
|
43
43
|
from . agent_client import AgentClientSpec
|
|
44
44
|
from . structured_query_client import StructuredQueryClientSpec
|
|
45
|
+
from . reranker_client import RerankerClientSpec
|
|
46
|
+
from . reranker_service import RerankerService
|
|
45
47
|
from . row_embeddings_query_client import RowEmbeddingsQueryClientSpec
|
|
46
48
|
from . collection_config_handler import CollectionConfigHandler
|
|
47
49
|
|
|
@@ -157,21 +157,6 @@ class PromptClient(RequestResponse):
|
|
|
157
157
|
timeout = timeout,
|
|
158
158
|
)
|
|
159
159
|
|
|
160
|
-
async def kg_prompt(self, query, kg, timeout=600, streaming=False, chunk_callback=None):
|
|
161
|
-
return await self.prompt(
|
|
162
|
-
id = "kg-prompt",
|
|
163
|
-
variables = {
|
|
164
|
-
"query": query,
|
|
165
|
-
"knowledge": [
|
|
166
|
-
{ "s": v[0], "p": v[1], "o": v[2] }
|
|
167
|
-
for v in kg
|
|
168
|
-
]
|
|
169
|
-
},
|
|
170
|
-
timeout = timeout,
|
|
171
|
-
streaming = streaming,
|
|
172
|
-
chunk_callback = chunk_callback,
|
|
173
|
-
)
|
|
174
|
-
|
|
175
160
|
async def document_prompt(self, query, documents, timeout=600, streaming=False, chunk_callback=None):
|
|
176
161
|
return await self.prompt(
|
|
177
162
|
id = "document-prompt",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
from . request_response_spec import RequestResponse, RequestResponseSpec
|
|
3
|
+
from .. schema import (
|
|
4
|
+
RerankerRequest, RerankerResponse,
|
|
5
|
+
RerankerQuery, RerankerDocument,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
class RerankerClient(RequestResponse):
|
|
9
|
+
async def rerank(self, queries, documents, limit=10, timeout=300):
|
|
10
|
+
|
|
11
|
+
resp = await self.request(
|
|
12
|
+
RerankerRequest(
|
|
13
|
+
queries=[
|
|
14
|
+
RerankerQuery(query_id=q["id"], query_text=q["text"])
|
|
15
|
+
for q in queries
|
|
16
|
+
],
|
|
17
|
+
documents=[
|
|
18
|
+
RerankerDocument(
|
|
19
|
+
document_id=d["id"], document_text=d["text"]
|
|
20
|
+
)
|
|
21
|
+
for d in documents
|
|
22
|
+
],
|
|
23
|
+
limit=limit,
|
|
24
|
+
),
|
|
25
|
+
timeout=timeout
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
if resp.error:
|
|
29
|
+
raise RuntimeError(resp.error.message)
|
|
30
|
+
|
|
31
|
+
return resp.results
|
|
32
|
+
|
|
33
|
+
class RerankerClientSpec(RequestResponseSpec):
|
|
34
|
+
def __init__(
|
|
35
|
+
self, request_name, response_name,
|
|
36
|
+
):
|
|
37
|
+
super(RerankerClientSpec, self).__init__(
|
|
38
|
+
request_name = request_name,
|
|
39
|
+
request_schema = RerankerRequest,
|
|
40
|
+
response_name = response_name,
|
|
41
|
+
response_schema = RerankerResponse,
|
|
42
|
+
impl = RerankerClient,
|
|
43
|
+
)
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from argparse import ArgumentParser
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
|
|
8
|
+
from .. schema import (
|
|
9
|
+
RerankerRequest, RerankerResponse, RerankerResult, Error,
|
|
10
|
+
)
|
|
11
|
+
from .. exceptions import TooManyRequests
|
|
12
|
+
from .. base import FlowProcessor, ConsumerSpec, ProducerSpec, ParameterSpec
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
default_ident = "reranker"
|
|
17
|
+
default_concurrency = 1
|
|
18
|
+
|
|
19
|
+
class RerankerService(FlowProcessor):
|
|
20
|
+
|
|
21
|
+
def __init__(self, **params):
|
|
22
|
+
|
|
23
|
+
id = params.get("id")
|
|
24
|
+
concurrency = params.get("concurrency", 1)
|
|
25
|
+
|
|
26
|
+
super(RerankerService, self).__init__(**params | {
|
|
27
|
+
"id": id,
|
|
28
|
+
"concurrency": concurrency,
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
self.register_specification(
|
|
32
|
+
ConsumerSpec(
|
|
33
|
+
name = "request",
|
|
34
|
+
schema = RerankerRequest,
|
|
35
|
+
handler = self.on_request,
|
|
36
|
+
concurrency = concurrency,
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
self.register_specification(
|
|
41
|
+
ProducerSpec(
|
|
42
|
+
name = "response",
|
|
43
|
+
schema = RerankerResponse
|
|
44
|
+
)
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
self.register_specification(
|
|
48
|
+
ParameterSpec(
|
|
49
|
+
name = "model",
|
|
50
|
+
)
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
async def on_request(self, msg, consumer, flow):
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
|
|
57
|
+
request = msg.value()
|
|
58
|
+
|
|
59
|
+
id = msg.properties()["id"]
|
|
60
|
+
|
|
61
|
+
logger.debug(f"Handling reranker request {id}...")
|
|
62
|
+
|
|
63
|
+
model = flow("model")
|
|
64
|
+
results = await self.on_rerank(
|
|
65
|
+
request.queries, request.documents,
|
|
66
|
+
request.limit, model=model,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
await flow("response").send(
|
|
70
|
+
RerankerResponse(
|
|
71
|
+
error = None,
|
|
72
|
+
results = results,
|
|
73
|
+
),
|
|
74
|
+
properties={"id": id}
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
logger.debug("Reranker request handled successfully")
|
|
78
|
+
|
|
79
|
+
except TooManyRequests as e:
|
|
80
|
+
raise e
|
|
81
|
+
|
|
82
|
+
except Exception as e:
|
|
83
|
+
|
|
84
|
+
logger.error(f"Exception in reranker service: {e}", exc_info=True)
|
|
85
|
+
|
|
86
|
+
logger.info("Sending error response...")
|
|
87
|
+
|
|
88
|
+
await flow.producer["response"].send(
|
|
89
|
+
RerankerResponse(
|
|
90
|
+
error=Error(
|
|
91
|
+
type = "reranker-error",
|
|
92
|
+
message = str(e),
|
|
93
|
+
),
|
|
94
|
+
results=[],
|
|
95
|
+
),
|
|
96
|
+
properties={"id": id}
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
@staticmethod
|
|
100
|
+
def add_args(parser: ArgumentParser) -> None:
|
|
101
|
+
|
|
102
|
+
parser.add_argument(
|
|
103
|
+
'-c', '--concurrency',
|
|
104
|
+
type=int,
|
|
105
|
+
default=default_concurrency,
|
|
106
|
+
help=f'Concurrent processing threads (default: {default_concurrency})'
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
FlowProcessor.add_args(parser)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.6.4"
|
|
@@ -140,20 +140,6 @@ class PromptClient(BaseClient):
|
|
|
140
140
|
timeout=timeout
|
|
141
141
|
)
|
|
142
142
|
|
|
143
|
-
def request_kg_prompt(self, query, kg, timeout=300):
|
|
144
|
-
|
|
145
|
-
return self.request(
|
|
146
|
-
id="kg-prompt",
|
|
147
|
-
variables={
|
|
148
|
-
"query": query,
|
|
149
|
-
"knowledge": [
|
|
150
|
-
{ "s": v[0], "p": v[1], "o": v[2] }
|
|
151
|
-
for v in kg
|
|
152
|
-
]
|
|
153
|
-
},
|
|
154
|
-
timeout=timeout
|
|
155
|
-
)
|
|
156
|
-
|
|
157
143
|
def request_document_prompt(self, query, documents, timeout=300):
|
|
158
144
|
|
|
159
145
|
return self.request(
|
|
@@ -27,6 +27,7 @@ from .translators.rows_query import RowsQueryRequestTranslator, RowsQueryRespons
|
|
|
27
27
|
from .translators.nlp_query import QuestionToStructuredQueryRequestTranslator, QuestionToStructuredQueryResponseTranslator
|
|
28
28
|
from .translators.structured_query import StructuredQueryRequestTranslator, StructuredQueryResponseTranslator
|
|
29
29
|
from .translators.diagnosis import StructuredDataDiagnosisRequestTranslator, StructuredDataDiagnosisResponseTranslator
|
|
30
|
+
from .translators.reranker import RerankerRequestTranslator, RerankerResponseTranslator
|
|
30
31
|
from .translators.collection import CollectionManagementRequestTranslator, CollectionManagementResponseTranslator
|
|
31
32
|
from .translators.sparql_query import SparqlQueryRequestTranslator, SparqlQueryResponseTranslator
|
|
32
33
|
|
|
@@ -163,6 +164,12 @@ TranslatorRegistry.register_service(
|
|
|
163
164
|
SparqlQueryResponseTranslator()
|
|
164
165
|
)
|
|
165
166
|
|
|
167
|
+
TranslatorRegistry.register_service(
|
|
168
|
+
"reranker",
|
|
169
|
+
RerankerRequestTranslator(),
|
|
170
|
+
RerankerResponseTranslator()
|
|
171
|
+
)
|
|
172
|
+
|
|
166
173
|
# Register single-direction translators for document loading
|
|
167
174
|
TranslatorRegistry.register_request("document", DocumentTranslator())
|
|
168
175
|
TranslatorRegistry.register_request("text-document", TextDocumentTranslator())
|
{trustgraph_base-2.6.2 → trustgraph_base-2.6.4}/trustgraph/messaging/translators/__init__.py
RENAMED
|
@@ -20,3 +20,4 @@ from .embeddings_query import (
|
|
|
20
20
|
)
|
|
21
21
|
from .rows_query import RowsQueryRequestTranslator, RowsQueryResponseTranslator
|
|
22
22
|
from .diagnosis import StructuredDataDiagnosisRequestTranslator, StructuredDataDiagnosisResponseTranslator
|
|
23
|
+
from .reranker import RerankerRequestTranslator, RerankerResponseTranslator
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from typing import Dict, Any, Tuple
|
|
2
|
+
from ...schema import (
|
|
3
|
+
RerankerRequest, RerankerResponse,
|
|
4
|
+
RerankerQuery, RerankerDocument, RerankerResult,
|
|
5
|
+
)
|
|
6
|
+
from .base import MessageTranslator
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class RerankerRequestTranslator(MessageTranslator):
|
|
10
|
+
|
|
11
|
+
def decode(self, data: Dict[str, Any]) -> RerankerRequest:
|
|
12
|
+
return RerankerRequest(
|
|
13
|
+
queries=[
|
|
14
|
+
RerankerQuery(
|
|
15
|
+
query_id=q["query_id"],
|
|
16
|
+
query_text=q["query_text"],
|
|
17
|
+
)
|
|
18
|
+
for q in data.get("queries", [])
|
|
19
|
+
],
|
|
20
|
+
documents=[
|
|
21
|
+
RerankerDocument(
|
|
22
|
+
document_id=d["document_id"],
|
|
23
|
+
document_text=d["document_text"],
|
|
24
|
+
)
|
|
25
|
+
for d in data.get("documents", [])
|
|
26
|
+
],
|
|
27
|
+
limit=data.get("limit", 10),
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
def encode(self, obj: RerankerRequest) -> Dict[str, Any]:
|
|
31
|
+
return {
|
|
32
|
+
"queries": [
|
|
33
|
+
{"query_id": q.query_id, "query_text": q.query_text}
|
|
34
|
+
for q in obj.queries
|
|
35
|
+
],
|
|
36
|
+
"documents": [
|
|
37
|
+
{"document_id": d.document_id, "document_text": d.document_text}
|
|
38
|
+
for d in obj.documents
|
|
39
|
+
],
|
|
40
|
+
"limit": obj.limit,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class RerankerResponseTranslator(MessageTranslator):
|
|
45
|
+
|
|
46
|
+
def decode(self, data: Dict[str, Any]) -> RerankerResponse:
|
|
47
|
+
return RerankerResponse(
|
|
48
|
+
results=[
|
|
49
|
+
RerankerResult(
|
|
50
|
+
document_id=r["document_id"],
|
|
51
|
+
query_id=r["query_id"],
|
|
52
|
+
score=r["score"],
|
|
53
|
+
)
|
|
54
|
+
for r in data.get("results", [])
|
|
55
|
+
],
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def encode(self, obj: RerankerResponse) -> Dict[str, Any]:
|
|
59
|
+
return {
|
|
60
|
+
"results": [
|
|
61
|
+
{
|
|
62
|
+
"document_id": r.document_id,
|
|
63
|
+
"query_id": r.query_id,
|
|
64
|
+
"score": r.score,
|
|
65
|
+
}
|
|
66
|
+
for r in obj.results
|
|
67
|
+
],
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
def encode_with_completion(
|
|
71
|
+
self, obj: RerankerResponse
|
|
72
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
73
|
+
return self.encode(obj), True
|
|
@@ -89,7 +89,9 @@ from . namespaces import (
|
|
|
89
89
|
TG_IMAGE_TYPE, TG_SUBGRAPH_TYPE,
|
|
90
90
|
# Query-time provenance predicates (GraphRAG)
|
|
91
91
|
TG_QUERY, TG_CONCEPT, TG_ENTITY,
|
|
92
|
-
TG_EDGE_COUNT, TG_SELECTED_EDGE, TG_REASONING,
|
|
92
|
+
TG_EDGE_COUNT, TG_SELECTED_EDGE, TG_REASONING, TG_SCORE,
|
|
93
|
+
# Edge selection entity type
|
|
94
|
+
TG_EDGE_SELECTION,
|
|
93
95
|
# Query-time provenance predicates (DocumentRAG)
|
|
94
96
|
TG_CHUNK_COUNT, TG_SELECTED_CHUNK,
|
|
95
97
|
# Explainability entity types
|
|
@@ -212,7 +214,9 @@ __all__ = [
|
|
|
212
214
|
"TG_CHUNK_TYPE", "TG_IMAGE_TYPE", "TG_SUBGRAPH_TYPE",
|
|
213
215
|
# Query-time provenance predicates (GraphRAG)
|
|
214
216
|
"TG_QUERY", "TG_CONCEPT", "TG_ENTITY",
|
|
215
|
-
"TG_EDGE_COUNT", "TG_SELECTED_EDGE", "TG_REASONING",
|
|
217
|
+
"TG_EDGE_COUNT", "TG_SELECTED_EDGE", "TG_REASONING", "TG_SCORE",
|
|
218
|
+
# Edge selection entity type
|
|
219
|
+
"TG_EDGE_SELECTION",
|
|
216
220
|
# Query-time provenance predicates (DocumentRAG)
|
|
217
221
|
"TG_CHUNK_COUNT", "TG_SELECTED_CHUNK",
|
|
218
222
|
# Explainability entity types
|
|
@@ -66,8 +66,12 @@ TG_EDGE_COUNT = TG + "edgeCount"
|
|
|
66
66
|
TG_SELECTED_EDGE = TG + "selectedEdge"
|
|
67
67
|
TG_EDGE = TG + "edge"
|
|
68
68
|
TG_REASONING = TG + "reasoning"
|
|
69
|
+
TG_SCORE = TG + "score"
|
|
69
70
|
TG_DOCUMENT = TG + "document" # Reference to document in librarian
|
|
70
71
|
|
|
72
|
+
# Edge selection entity type (cross-encoder scored edge in Focus)
|
|
73
|
+
TG_EDGE_SELECTION = TG + "EdgeSelection"
|
|
74
|
+
|
|
71
75
|
# Query-time provenance predicates (DocumentRAG)
|
|
72
76
|
TG_CHUNK_COUNT = TG + "chunkCount"
|
|
73
77
|
TG_SELECTED_CHUNK = TG + "selectedChunk"
|
|
@@ -24,8 +24,10 @@ from . namespaces import (
|
|
|
24
24
|
TG_ELEMENT_TYPES, TG_TABLE_COUNT, TG_IMAGE_COUNT,
|
|
25
25
|
# Query-time provenance predicates (GraphRAG)
|
|
26
26
|
TG_QUERY, TG_CONCEPT, TG_ENTITY,
|
|
27
|
-
TG_EDGE_COUNT, TG_SELECTED_EDGE, TG_EDGE, TG_REASONING,
|
|
27
|
+
TG_EDGE_COUNT, TG_SELECTED_EDGE, TG_EDGE, TG_REASONING, TG_SCORE,
|
|
28
28
|
TG_DOCUMENT,
|
|
29
|
+
# Edge selection entity type
|
|
30
|
+
TG_EDGE_SELECTION,
|
|
29
31
|
# Query-time provenance predicates (DocumentRAG)
|
|
30
32
|
TG_CHUNK_COUNT, TG_SELECTED_CHUNK,
|
|
31
33
|
# Explainability entity types
|
|
@@ -536,10 +538,9 @@ def focus_triples(
|
|
|
536
538
|
_triple(focus_uri, PROV_WAS_DERIVED_FROM, _iri(exploration_uri)),
|
|
537
539
|
]
|
|
538
540
|
|
|
539
|
-
# Add each selected edge with
|
|
541
|
+
# Add each selected edge with metadata via intermediate entity
|
|
540
542
|
for idx, edge_info in enumerate(selected_edges_with_reasoning):
|
|
541
543
|
edge = edge_info.get("edge")
|
|
542
|
-
reasoning = edge_info.get("reasoning", "")
|
|
543
544
|
|
|
544
545
|
if edge:
|
|
545
546
|
s, p, o = edge
|
|
@@ -552,13 +553,32 @@ def focus_triples(
|
|
|
552
553
|
_triple(focus_uri, TG_SELECTED_EDGE, _iri(edge_sel_uri))
|
|
553
554
|
)
|
|
554
555
|
|
|
556
|
+
# Type the edge selection entity
|
|
557
|
+
triples.append(
|
|
558
|
+
_triple(edge_sel_uri, RDF_TYPE, _iri(TG_EDGE_SELECTION))
|
|
559
|
+
)
|
|
560
|
+
|
|
555
561
|
# Attach quoted triple to edge selection entity
|
|
556
562
|
quoted = _quoted_triple(s, p, o)
|
|
557
563
|
triples.append(
|
|
558
564
|
Triple(s=_iri(edge_sel_uri), p=_iri(TG_EDGE), o=quoted)
|
|
559
565
|
)
|
|
560
566
|
|
|
561
|
-
#
|
|
567
|
+
# Structured cross-encoder metadata
|
|
568
|
+
concept = edge_info.get("concept")
|
|
569
|
+
if concept:
|
|
570
|
+
triples.append(
|
|
571
|
+
_triple(edge_sel_uri, TG_CONCEPT, _literal(concept))
|
|
572
|
+
)
|
|
573
|
+
|
|
574
|
+
score = edge_info.get("score")
|
|
575
|
+
if score is not None:
|
|
576
|
+
triples.append(
|
|
577
|
+
_triple(edge_sel_uri, TG_SCORE, _literal(str(score)))
|
|
578
|
+
)
|
|
579
|
+
|
|
580
|
+
# Legacy reasoning text (for non-cross-encoder callers)
|
|
581
|
+
reasoning = edge_info.get("reasoning", "")
|
|
562
582
|
if reasoning:
|
|
563
583
|
triples.append(
|
|
564
584
|
_triple(edge_sel_uri, TG_REASONING, _literal(reasoning))
|
|
@@ -29,6 +29,7 @@ from . namespaces import (
|
|
|
29
29
|
TG_ANSWER_TYPE, TG_REFLECTION_TYPE, TG_THOUGHT_TYPE, TG_OBSERVATION_TYPE,
|
|
30
30
|
TG_DECOMPOSITION, TG_FINDING, TG_PLAN_TYPE, TG_STEP_RESULT,
|
|
31
31
|
TG_SUBAGENT_GOAL, TG_PLAN_STEP,
|
|
32
|
+
TG_EDGE_SELECTION, TG_SCORE,
|
|
32
33
|
)
|
|
33
34
|
|
|
34
35
|
|
|
@@ -93,6 +94,7 @@ TG_CLASS_LABELS = [
|
|
|
93
94
|
_label_triple(TG_FINDING, "Finding"),
|
|
94
95
|
_label_triple(TG_PLAN_TYPE, "Plan"),
|
|
95
96
|
_label_triple(TG_STEP_RESULT, "Step Result"),
|
|
97
|
+
_label_triple(TG_EDGE_SELECTION, "Edge Selection"),
|
|
96
98
|
]
|
|
97
99
|
|
|
98
100
|
# TrustGraph predicate labels
|
|
@@ -117,6 +119,7 @@ TG_PREDICATE_LABELS = [
|
|
|
117
119
|
_label_triple(TG_ENTITY, "entity"),
|
|
118
120
|
_label_triple(TG_SUBAGENT_GOAL, "subagent goal"),
|
|
119
121
|
_label_triple(TG_PLAN_STEP, "plan step"),
|
|
122
|
+
_label_triple(TG_SCORE, "score"),
|
|
120
123
|
]
|
|
121
124
|
|
|
122
125
|
|
|
@@ -6,17 +6,6 @@ from ..core.primitives import Error
|
|
|
6
6
|
|
|
7
7
|
# Prompt services, abstract the prompt generation
|
|
8
8
|
|
|
9
|
-
# extract-definitions:
|
|
10
|
-
# chunk -> definitions
|
|
11
|
-
# extract-relationships:
|
|
12
|
-
# chunk -> relationships
|
|
13
|
-
# kg-prompt:
|
|
14
|
-
# query, triples -> answer
|
|
15
|
-
# document-prompt:
|
|
16
|
-
# query, documents -> answer
|
|
17
|
-
# extract-rows
|
|
18
|
-
# schema, chunk -> rows
|
|
19
|
-
|
|
20
9
|
@dataclass
|
|
21
10
|
class PromptRequest:
|
|
22
11
|
id: str = ""
|
|
@@ -46,4 +35,4 @@ class PromptResponse:
|
|
|
46
35
|
out_token: int | None = None
|
|
47
36
|
model: str | None = None
|
|
48
37
|
|
|
49
|
-
############################################################################
|
|
38
|
+
############################################################################
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
|
|
4
|
+
from ..core.primitives import Error
|
|
5
|
+
|
|
6
|
+
############################################################################
|
|
7
|
+
|
|
8
|
+
# Cross-encoder reranker
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class RerankerQuery:
|
|
12
|
+
query_id: str = ""
|
|
13
|
+
query_text: str = ""
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class RerankerDocument:
|
|
17
|
+
document_id: str = ""
|
|
18
|
+
document_text: str = ""
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class RerankerRequest:
|
|
22
|
+
queries: list[RerankerQuery] = field(default_factory=list)
|
|
23
|
+
documents: list[RerankerDocument] = field(default_factory=list)
|
|
24
|
+
limit: int = 10
|
|
25
|
+
|
|
26
|
+
@dataclass
|
|
27
|
+
class RerankerResult:
|
|
28
|
+
document_id: str = ""
|
|
29
|
+
query_id: str = ""
|
|
30
|
+
score: float = 0.0
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class RerankerResponse:
|
|
34
|
+
error: Error | None = None
|
|
35
|
+
results: list[RerankerResult] = field(default_factory=list)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trustgraph-base
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.4
|
|
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
|
Author-email: "trustgraph.ai" <security@trustgraph.ai>
|
|
6
6
|
Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
|