trustgraph-base 2.11.6__tar.gz → 3.0.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.
Potentially problematic release.
This version of trustgraph-base might be problematic. Click here for more details.
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/PKG-INFO +1 -1
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/__init__.py +11 -0
- trustgraph_base-3.0.0/trustgraph/base/action_service.py +124 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/async_kafka_backend.py +50 -8
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/async_processor.py +20 -2
- trustgraph_base-3.0.0/trustgraph/base/cloze_client.py +34 -0
- trustgraph_base-3.0.0/trustgraph/base/concept_extraction_client.py +30 -0
- trustgraph_base-3.0.0/trustgraph/base/concept_extraction_service.py +121 -0
- trustgraph_base-3.0.0/trustgraph/base/decision_scoring_client.py +33 -0
- trustgraph_base-3.0.0/trustgraph/base/field_extraction_client.py +33 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/graph_rag_client.py +13 -0
- trustgraph_base-3.0.0/trustgraph/base/knowledge_retrieval_client.py +49 -0
- trustgraph_base-3.0.0/trustgraph/base/knowledge_retrieval_service.py +132 -0
- trustgraph_base-3.0.0/trustgraph/base/planner_service.py +119 -0
- trustgraph_base-3.0.0/trustgraph/base/policy_engine_service.py +120 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/prompt_client.py +10 -0
- trustgraph_base-3.0.0/trustgraph/base/verification_service.py +129 -0
- trustgraph_base-3.0.0/trustgraph/base_version.py +1 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/__init__.py +42 -0
- trustgraph_base-3.0.0/trustgraph/messaging/translators/action.py +53 -0
- trustgraph_base-3.0.0/trustgraph/messaging/translators/concept_extraction.py +42 -0
- trustgraph_base-3.0.0/trustgraph/messaging/translators/knowledge_retrieval.py +86 -0
- trustgraph_base-3.0.0/trustgraph/messaging/translators/planner.py +63 -0
- trustgraph_base-3.0.0/trustgraph/messaging/translators/policy_engine.py +68 -0
- trustgraph_base-3.0.0/trustgraph/messaging/translators/verification.py +64 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/__init__.py +6 -0
- trustgraph_base-3.0.0/trustgraph/schema/action.py +30 -0
- trustgraph_base-3.0.0/trustgraph/schema/concept_extraction.py +23 -0
- trustgraph_base-3.0.0/trustgraph/schema/knowledge_retrieval.py +53 -0
- trustgraph_base-3.0.0/trustgraph/schema/planner.py +40 -0
- trustgraph_base-3.0.0/trustgraph/schema/policy_engine.py +45 -0
- trustgraph_base-3.0.0/trustgraph/schema/verification.py +41 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph_base.egg-info/PKG-INFO +1 -1
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph_base.egg-info/SOURCES.txt +23 -0
- trustgraph_base-2.11.6/trustgraph/base_version.py +0 -1
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/README.md +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/pyproject.toml +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/setup.cfg +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/__init__.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/api.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/async_bulk_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/async_flow.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/async_metrics.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/async_socket_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/bulk_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/collection.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/config.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/exceptions.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/explainability.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/flow.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/knowledge.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/library.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/metrics.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/socket_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/api/types.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/agent_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/agent_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/async_backend.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/async_config_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/async_librarian_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/async_pulsar_backend.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/async_rabbitmq_backend.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/async_rr_wrapper.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/audit_publisher.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/backend.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/cassandra_config.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/chunking_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/collection_config_handler.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/config_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/consumer_spec.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/document_embeddings_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/document_embeddings_query_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/document_embeddings_store_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/dynamic_tool_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/embeddings_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/embeddings_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/flow.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/flow_processor.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/graph_embeddings_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/graph_embeddings_query_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/graph_embeddings_store_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/iam_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/image_to_text_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/keyword_index_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/keyword_index_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/librarian_spec.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/llm_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/logging.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/metrics.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/parameter_spec.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/policy_event_publisher.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/processor_group.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/producer_spec.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/pubsub.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/qdrant_config.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/receiver_pool.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/request_response_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/request_response_spec.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/reranker_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/reranker_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/row_embeddings_query_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/schema_compatibility.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/sender_pool.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/serialization.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/sparql_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/spec.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/structured_query_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/text_completion_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/tool_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/tool_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/tool_service_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/triples_client.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/triples_query_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/triples_store_service.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/base/workspace_processor.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/exceptions.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/__init__.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/__init__.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/ar.json +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/en.json +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/es.json +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/he.json +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/hi.json +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/pt.json +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/ru.json +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/sw.json +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/tr.json +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/i18n/packs/zh-cn.json +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/knowledge/__init__.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/knowledge/defs.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/knowledge/document.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/knowledge/identifier.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/knowledge/organization.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/knowledge/publication.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/log_level.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/registry.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/__init__.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/agent.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/base.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/cloze.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/collection.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/config.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/decision_scoring.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/diagnosis.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/document_loading.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/embeddings.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/embeddings_query.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/field_extraction.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/flow.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/iam.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/image_to_text.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/knowledge.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/library.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/metadata.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/nl_sparql.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/nlp_query.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/ontology.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/primitives.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/prompt.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/reranker.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/retrieval.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/rows_query.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/sparql_nl_query.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/sparql_query.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/structured_query.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/text_completion.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/tool.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/messaging/translators/triples.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/objects/__init__.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/objects/field.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/objects/object.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/provenance/__init__.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/provenance/agent.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/provenance/namespaces.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/provenance/triples.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/provenance/uris.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/provenance/vocabulary.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/rdf.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/agent.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/audit.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/cloze.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/config.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/core/__init__.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/core/metadata.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/core/primitives.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/core/topic.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/decision_scoring.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/documents.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/embeddings.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/field_extraction.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/iam.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/llm.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/nl_sparql.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/ontology.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/policy_event.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/retrieval.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/structured.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/triples.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph/schema/user_context.py +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph_base.egg-info/dependency_links.txt +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph_base.egg-info/entry_points.txt +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/trustgraph_base.egg-info/requires.txt +0 -0
- {trustgraph_base-2.11.6 → trustgraph_base-3.0.0}/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:
|
|
3
|
+
Version: 3.0.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
|
Author-email: "trustgraph.ai" <security@trustgraph.ai>
|
|
6
6
|
Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
|
|
@@ -55,4 +55,15 @@ from . receiver_pool import ReceiverPool, ConsumerRegistration
|
|
|
55
55
|
from . sender_pool import SenderPool, ProducerHandle
|
|
56
56
|
from . request_response_client import RequestResponseClient
|
|
57
57
|
from . async_librarian_client import AsyncLibrarianClient
|
|
58
|
+
from . concept_extraction_service import ConceptExtractionService
|
|
59
|
+
from . concept_extraction_client import ConceptExtractionClientSpec
|
|
60
|
+
from . knowledge_retrieval_service import KnowledgeRetrievalService
|
|
61
|
+
from . knowledge_retrieval_client import KnowledgeRetrievalClientSpec
|
|
62
|
+
from . planner_service import PlannerService
|
|
63
|
+
from . verification_service import VerificationService
|
|
64
|
+
from . policy_engine_service import PolicyEngineService
|
|
65
|
+
from . action_service import ActionService
|
|
66
|
+
from . cloze_client import ClozeClientSpec
|
|
67
|
+
from . decision_scoring_client import DecisionScoringClientSpec
|
|
68
|
+
from . field_extraction_client import FieldExtractionClientSpec
|
|
58
69
|
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Action worker service. Dispatches step execution to capability
|
|
3
|
+
handlers. Single service handles all capabilities via a pluggable
|
|
4
|
+
handler registry.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from argparse import ArgumentParser
|
|
10
|
+
|
|
11
|
+
import time
|
|
12
|
+
import logging
|
|
13
|
+
from prometheus_client import Histogram, Counter
|
|
14
|
+
|
|
15
|
+
from .. schema import ActionRequest, ActionResponse, Error
|
|
16
|
+
|
|
17
|
+
from . flow_processor import FlowProcessor
|
|
18
|
+
from . consumer_spec import ConsumerSpec
|
|
19
|
+
from . producer_spec import ProducerSpec
|
|
20
|
+
|
|
21
|
+
logger = logging.getLogger(__name__)
|
|
22
|
+
|
|
23
|
+
default_ident = "action"
|
|
24
|
+
default_concurrency = 10
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ActionService(FlowProcessor):
|
|
28
|
+
|
|
29
|
+
def __init__(self, **params):
|
|
30
|
+
|
|
31
|
+
id = params.get("id")
|
|
32
|
+
concurrency = params.get("concurrency", default_concurrency)
|
|
33
|
+
|
|
34
|
+
super(ActionService, self).__init__(**params | { "id": id })
|
|
35
|
+
|
|
36
|
+
self.register_specification(
|
|
37
|
+
ConsumerSpec(
|
|
38
|
+
name = "request",
|
|
39
|
+
schema = ActionRequest,
|
|
40
|
+
handler = self.on_message,
|
|
41
|
+
concurrency = concurrency,
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
self.register_specification(
|
|
46
|
+
ProducerSpec(
|
|
47
|
+
name = "response",
|
|
48
|
+
schema = ActionResponse,
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
if not hasattr(__class__, "action_duration_metric"):
|
|
53
|
+
from . metrics import BUCKETS_LLM
|
|
54
|
+
__class__.action_duration_metric = Histogram(
|
|
55
|
+
'tg_action_duration_seconds',
|
|
56
|
+
'Action worker execution latency (seconds)',
|
|
57
|
+
["processor", "capability"],
|
|
58
|
+
buckets=BUCKETS_LLM,
|
|
59
|
+
)
|
|
60
|
+
__class__.action_count_metric = Counter(
|
|
61
|
+
'tg_action_total',
|
|
62
|
+
'Action worker executions by capability',
|
|
63
|
+
["processor", "capability"],
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
async def on_message(self, msg, consumer, flow):
|
|
67
|
+
|
|
68
|
+
try:
|
|
69
|
+
|
|
70
|
+
request = msg.value()
|
|
71
|
+
|
|
72
|
+
id = msg.properties()["id"]
|
|
73
|
+
|
|
74
|
+
logger.debug(
|
|
75
|
+
f"Handling action request {id} "
|
|
76
|
+
f"({request.capability})..."
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
workspace = flow.workspace
|
|
80
|
+
|
|
81
|
+
t0 = time.monotonic()
|
|
82
|
+
response = await self.execute(workspace, request, flow)
|
|
83
|
+
__class__.action_duration_metric.labels(
|
|
84
|
+
processor=self.id,
|
|
85
|
+
capability=request.capability,
|
|
86
|
+
).observe(time.monotonic() - t0)
|
|
87
|
+
__class__.action_count_metric.labels(
|
|
88
|
+
processor=self.id,
|
|
89
|
+
capability=request.capability,
|
|
90
|
+
).inc()
|
|
91
|
+
|
|
92
|
+
logger.debug("Sending action response...")
|
|
93
|
+
await flow("response").send(response, properties={"id": id})
|
|
94
|
+
logger.debug("Action request completed")
|
|
95
|
+
|
|
96
|
+
except Exception as e:
|
|
97
|
+
|
|
98
|
+
logger.error(
|
|
99
|
+
f"Exception in action service: {e}", exc_info=True
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
logger.info("Sending error response...")
|
|
103
|
+
|
|
104
|
+
r = ActionResponse(
|
|
105
|
+
error = Error(
|
|
106
|
+
type = "action-error",
|
|
107
|
+
message = str(e),
|
|
108
|
+
),
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
await flow("response").send(r, properties={"id": id})
|
|
112
|
+
|
|
113
|
+
async def execute(self, workspace, request, flow):
|
|
114
|
+
raise NotImplementedError("Subclasses must implement execute")
|
|
115
|
+
|
|
116
|
+
@staticmethod
|
|
117
|
+
def add_args(parser: ArgumentParser) -> None:
|
|
118
|
+
|
|
119
|
+
FlowProcessor.add_args(parser)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def run() -> None:
|
|
123
|
+
|
|
124
|
+
Processor.launch(default_ident, __doc__)
|
|
@@ -23,6 +23,7 @@ from typing import Any
|
|
|
23
23
|
from aiokafka import AIOKafkaProducer, AIOKafkaConsumer
|
|
24
24
|
from aiokafka.admin import AIOKafkaAdminClient, NewTopic
|
|
25
25
|
from aiokafka.errors import TopicAlreadyExistsError, UnknownTopicOrPartitionError
|
|
26
|
+
from aiokafka.structs import OffsetAndMetadata, TopicPartition
|
|
26
27
|
|
|
27
28
|
from .async_backend import AsyncPubSubBackend, AsyncBackendProducer
|
|
28
29
|
from .async_backend import AsyncBackendConsumer, Message
|
|
@@ -98,10 +99,31 @@ class AsyncKafkaConsumer:
|
|
|
98
99
|
|
|
99
100
|
async def acknowledge(self, message: Message) -> None:
|
|
100
101
|
if isinstance(message, AsyncKafkaMessage):
|
|
101
|
-
|
|
102
|
+
msg = message._msg
|
|
103
|
+
if (
|
|
104
|
+
hasattr(msg, 'topic')
|
|
105
|
+
and hasattr(msg, 'partition')
|
|
106
|
+
and hasattr(msg, 'offset')
|
|
107
|
+
):
|
|
108
|
+
tp = TopicPartition(msg.topic, msg.partition)
|
|
109
|
+
await self._consumer.commit(
|
|
110
|
+
{tp: OffsetAndMetadata(msg.offset + 1, "")}
|
|
111
|
+
)
|
|
112
|
+
else:
|
|
113
|
+
await self._consumer.commit()
|
|
102
114
|
|
|
103
115
|
async def negative_acknowledge(self, message: Message) -> None:
|
|
104
|
-
|
|
116
|
+
if isinstance(message, AsyncKafkaMessage):
|
|
117
|
+
msg = message._msg
|
|
118
|
+
if (
|
|
119
|
+
hasattr(msg, 'topic')
|
|
120
|
+
and hasattr(msg, 'partition')
|
|
121
|
+
and hasattr(msg, 'offset')
|
|
122
|
+
):
|
|
123
|
+
tp = TopicPartition(msg.topic, msg.partition)
|
|
124
|
+
res = self._consumer.seek(tp, msg.offset)
|
|
125
|
+
if asyncio.iscoroutine(res):
|
|
126
|
+
await res
|
|
105
127
|
|
|
106
128
|
async def close(self) -> None:
|
|
107
129
|
try:
|
|
@@ -192,6 +214,8 @@ class AsyncKafkaBackend:
|
|
|
192
214
|
) -> AsyncBackendProducer:
|
|
193
215
|
topic_name, cls, durable = self._parse_topic(topic)
|
|
194
216
|
|
|
217
|
+
await self.ensure_topic(topic)
|
|
218
|
+
|
|
195
219
|
producer = AIOKafkaProducer(
|
|
196
220
|
**self._client_kwargs(),
|
|
197
221
|
acks='all' if durable else 1,
|
|
@@ -209,15 +233,20 @@ class AsyncKafkaBackend:
|
|
|
209
233
|
) -> AsyncBackendConsumer:
|
|
210
234
|
topic_name, cls, durable = self._parse_topic(topic)
|
|
211
235
|
|
|
212
|
-
|
|
236
|
+
await self.ensure_topic(topic)
|
|
237
|
+
|
|
238
|
+
if cls == 'response':
|
|
213
239
|
group_id = f"{subscription}-{uuid.uuid4()}"
|
|
214
240
|
auto_offset_reset = 'earliest'
|
|
215
|
-
|
|
216
|
-
group_id = subscription
|
|
241
|
+
elif cls == 'notify':
|
|
242
|
+
group_id = f"{subscription}-{uuid.uuid4()}"
|
|
217
243
|
auto_offset_reset = (
|
|
218
244
|
'earliest' if initial_position == 'earliest'
|
|
219
245
|
else 'latest'
|
|
220
246
|
)
|
|
247
|
+
else:
|
|
248
|
+
group_id = subscription
|
|
249
|
+
auto_offset_reset = 'earliest'
|
|
221
250
|
|
|
222
251
|
consumer = AIOKafkaConsumer(
|
|
223
252
|
topic_name,
|
|
@@ -226,11 +255,19 @@ class AsyncKafkaBackend:
|
|
|
226
255
|
auto_offset_reset=auto_offset_reset,
|
|
227
256
|
enable_auto_commit=False,
|
|
228
257
|
max_partition_fetch_bytes=10485760,
|
|
229
|
-
session_timeout_ms=
|
|
230
|
-
heartbeat_interval_ms=
|
|
258
|
+
session_timeout_ms=10000,
|
|
259
|
+
heartbeat_interval_ms=3000,
|
|
231
260
|
)
|
|
232
261
|
await consumer.start()
|
|
233
262
|
|
|
263
|
+
assignment_fn = getattr(consumer, 'assignment', None)
|
|
264
|
+
if callable(assignment_fn):
|
|
265
|
+
for _ in range(100):
|
|
266
|
+
assigned = assignment_fn()
|
|
267
|
+
if not isinstance(assigned, (set, frozenset, list, tuple)) or len(assigned) > 0:
|
|
268
|
+
break
|
|
269
|
+
await asyncio.sleep(0.05)
|
|
270
|
+
|
|
234
271
|
logger.debug(
|
|
235
272
|
f"Created async consumer: topic={topic_name}, "
|
|
236
273
|
f"group={group_id}, cls={cls}"
|
|
@@ -285,7 +322,12 @@ class AsyncKafkaBackend:
|
|
|
285
322
|
try:
|
|
286
323
|
await admin.start()
|
|
287
324
|
metadata = await admin.describe_topics([topic_name])
|
|
288
|
-
|
|
325
|
+
if not metadata:
|
|
326
|
+
return False
|
|
327
|
+
return all(
|
|
328
|
+
not isinstance(t, dict) or t.get("error_code", 0) == 0
|
|
329
|
+
for t in metadata
|
|
330
|
+
)
|
|
289
331
|
except UnknownTopicOrPartitionError:
|
|
290
332
|
return False
|
|
291
333
|
except BaseException:
|
|
@@ -62,6 +62,12 @@ class AsyncProcessor:
|
|
|
62
62
|
self.config_push_queue = params.get(
|
|
63
63
|
"config_push_queue", default_config_queue
|
|
64
64
|
)
|
|
65
|
+
self.config_request_queue = params.get(
|
|
66
|
+
"config_request_queue", config_request_queue
|
|
67
|
+
)
|
|
68
|
+
self.config_response_queue = params.get(
|
|
69
|
+
"config_response_queue", config_response_queue
|
|
70
|
+
)
|
|
65
71
|
|
|
66
72
|
self.config_timeout = int(params.get(
|
|
67
73
|
"config_timeout", default_config_timeout
|
|
@@ -86,8 +92,8 @@ class AsyncProcessor:
|
|
|
86
92
|
async def _create_config_client(self):
|
|
87
93
|
return await RequestResponseClient.create(
|
|
88
94
|
backend=self.async_backend,
|
|
89
|
-
request_topic=config_request_queue,
|
|
90
|
-
response_topic=config_response_queue,
|
|
95
|
+
request_topic=self.config_request_queue,
|
|
96
|
+
response_topic=self.config_response_queue,
|
|
91
97
|
request_schema=ConfigRequest,
|
|
92
98
|
response_schema=ConfigResponse,
|
|
93
99
|
default_timeout=self.config_timeout,
|
|
@@ -446,6 +452,18 @@ class AsyncProcessor:
|
|
|
446
452
|
help=f'Config push queue (default: {default_config_queue})',
|
|
447
453
|
)
|
|
448
454
|
|
|
455
|
+
parser.add_argument(
|
|
456
|
+
'--config-request-queue',
|
|
457
|
+
default=config_request_queue,
|
|
458
|
+
help=f'Config request queue (default: {config_request_queue})',
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
parser.add_argument(
|
|
462
|
+
'--config-response-queue',
|
|
463
|
+
default=config_response_queue,
|
|
464
|
+
help=f'Config response queue (default: {config_response_queue})',
|
|
465
|
+
)
|
|
466
|
+
|
|
449
467
|
parser.add_argument(
|
|
450
468
|
'--concurrency',
|
|
451
469
|
type=int,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
from . request_response_spec import RequestResponseSpec
|
|
3
|
+
from .. schema import ClozeRequest, ClozeResponse
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ClozeClient:
|
|
7
|
+
async def predict(self, model, query, timeout=300):
|
|
8
|
+
|
|
9
|
+
resp = await self.request(
|
|
10
|
+
ClozeRequest(
|
|
11
|
+
operation="predict",
|
|
12
|
+
model=model,
|
|
13
|
+
query=query,
|
|
14
|
+
),
|
|
15
|
+
timeout=timeout,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
if resp.error:
|
|
19
|
+
raise RuntimeError(resp.error.message)
|
|
20
|
+
|
|
21
|
+
return resp
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ClozeClientSpec(RequestResponseSpec):
|
|
25
|
+
def __init__(
|
|
26
|
+
self, request_name, response_name,
|
|
27
|
+
):
|
|
28
|
+
super(ClozeClientSpec, self).__init__(
|
|
29
|
+
request_name=request_name,
|
|
30
|
+
request_schema=ClozeRequest,
|
|
31
|
+
response_name=response_name,
|
|
32
|
+
response_schema=ClozeResponse,
|
|
33
|
+
impl=ClozeClient,
|
|
34
|
+
)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
from . request_response_spec import RequestResponseSpec
|
|
3
|
+
from .. schema import ConceptExtractionRequest, ConceptExtractionResponse
|
|
4
|
+
|
|
5
|
+
class ConceptExtractionClient:
|
|
6
|
+
async def extract(self, query, timeout=300):
|
|
7
|
+
|
|
8
|
+
resp = await self.request(
|
|
9
|
+
ConceptExtractionRequest(
|
|
10
|
+
query=query,
|
|
11
|
+
),
|
|
12
|
+
timeout=timeout,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
if resp.error:
|
|
16
|
+
raise RuntimeError(resp.error.message)
|
|
17
|
+
|
|
18
|
+
return resp.concepts
|
|
19
|
+
|
|
20
|
+
class ConceptExtractionClientSpec(RequestResponseSpec):
|
|
21
|
+
def __init__(
|
|
22
|
+
self, request_name, response_name,
|
|
23
|
+
):
|
|
24
|
+
super(ConceptExtractionClientSpec, self).__init__(
|
|
25
|
+
request_name = request_name,
|
|
26
|
+
request_schema = ConceptExtractionRequest,
|
|
27
|
+
response_name = response_name,
|
|
28
|
+
response_schema = ConceptExtractionResponse,
|
|
29
|
+
impl = ConceptExtractionClient,
|
|
30
|
+
)
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Concept extraction service. Input is a natural-language query.
|
|
3
|
+
Output is a list of key concepts extracted from the query.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from argparse import ArgumentParser
|
|
9
|
+
|
|
10
|
+
import time
|
|
11
|
+
import logging
|
|
12
|
+
from prometheus_client import Histogram, Counter
|
|
13
|
+
|
|
14
|
+
from .. schema import (
|
|
15
|
+
ConceptExtractionRequest, ConceptExtractionResponse, Error,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
from . flow_processor import FlowProcessor
|
|
19
|
+
from . consumer_spec import ConsumerSpec
|
|
20
|
+
from . producer_spec import ProducerSpec
|
|
21
|
+
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
24
|
+
default_ident = "concept-extraction"
|
|
25
|
+
default_concurrency = 10
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ConceptExtractionService(FlowProcessor):
|
|
29
|
+
|
|
30
|
+
def __init__(self, **params):
|
|
31
|
+
|
|
32
|
+
id = params.get("id")
|
|
33
|
+
concurrency = params.get("concurrency", default_concurrency)
|
|
34
|
+
|
|
35
|
+
super(ConceptExtractionService, self).__init__(**params | { "id": id })
|
|
36
|
+
|
|
37
|
+
self.register_specification(
|
|
38
|
+
ConsumerSpec(
|
|
39
|
+
name = "request",
|
|
40
|
+
schema = ConceptExtractionRequest,
|
|
41
|
+
handler = self.on_message,
|
|
42
|
+
concurrency = concurrency,
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
self.register_specification(
|
|
47
|
+
ProducerSpec(
|
|
48
|
+
name = "response",
|
|
49
|
+
schema = ConceptExtractionResponse,
|
|
50
|
+
)
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
if not hasattr(__class__, "extract_duration_metric"):
|
|
54
|
+
from . metrics import BUCKETS_LLM
|
|
55
|
+
__class__.extract_duration_metric = Histogram(
|
|
56
|
+
'tg_concept_extraction_duration_seconds',
|
|
57
|
+
'Concept extraction latency (seconds)',
|
|
58
|
+
["processor"],
|
|
59
|
+
buckets=BUCKETS_LLM,
|
|
60
|
+
)
|
|
61
|
+
__class__.extract_count_metric = Counter(
|
|
62
|
+
'tg_concept_extraction_total',
|
|
63
|
+
'Number of concept extraction requests',
|
|
64
|
+
["processor"],
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
async def on_message(self, msg, consumer, flow):
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
|
|
71
|
+
request = msg.value()
|
|
72
|
+
|
|
73
|
+
id = msg.properties()["id"]
|
|
74
|
+
|
|
75
|
+
logger.debug(f"Handling concept extraction request {id}...")
|
|
76
|
+
|
|
77
|
+
workspace = flow.workspace
|
|
78
|
+
|
|
79
|
+
t0 = time.monotonic()
|
|
80
|
+
response = await self.extract(workspace, request, flow)
|
|
81
|
+
__class__.extract_duration_metric.labels(
|
|
82
|
+
processor=self.id,
|
|
83
|
+
).observe(time.monotonic() - t0)
|
|
84
|
+
__class__.extract_count_metric.labels(
|
|
85
|
+
processor=self.id,
|
|
86
|
+
).inc()
|
|
87
|
+
|
|
88
|
+
logger.debug("Sending concept extraction response...")
|
|
89
|
+
await flow("response").send(response, properties={"id": id})
|
|
90
|
+
logger.debug("Concept extraction request completed")
|
|
91
|
+
|
|
92
|
+
except Exception as e:
|
|
93
|
+
|
|
94
|
+
logger.error(
|
|
95
|
+
f"Exception in concept extraction service: {e}",
|
|
96
|
+
exc_info=True,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
logger.info("Sending error response...")
|
|
100
|
+
|
|
101
|
+
r = ConceptExtractionResponse(
|
|
102
|
+
error = Error(
|
|
103
|
+
type = "concept-extraction-error",
|
|
104
|
+
message = str(e),
|
|
105
|
+
),
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
await flow("response").send(r, properties={"id": id})
|
|
109
|
+
|
|
110
|
+
async def extract(self, workspace, request, flow):
|
|
111
|
+
raise NotImplementedError("Subclasses must implement extract")
|
|
112
|
+
|
|
113
|
+
@staticmethod
|
|
114
|
+
def add_args(parser: ArgumentParser) -> None:
|
|
115
|
+
|
|
116
|
+
FlowProcessor.add_args(parser)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def run() -> None:
|
|
120
|
+
|
|
121
|
+
Processor.launch(default_ident, __doc__)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
from . request_response_spec import RequestResponseSpec
|
|
3
|
+
from .. schema import DecisionScoringRequest, DecisionScoringResponse
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class DecisionScoringClient:
|
|
7
|
+
async def score(self, state, questions, timeout=300):
|
|
8
|
+
|
|
9
|
+
resp = await self.request(
|
|
10
|
+
DecisionScoringRequest(
|
|
11
|
+
state=state,
|
|
12
|
+
questions=questions,
|
|
13
|
+
),
|
|
14
|
+
timeout=timeout,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
if resp.error:
|
|
18
|
+
raise RuntimeError(resp.error.message)
|
|
19
|
+
|
|
20
|
+
return resp
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class DecisionScoringClientSpec(RequestResponseSpec):
|
|
24
|
+
def __init__(
|
|
25
|
+
self, request_name, response_name,
|
|
26
|
+
):
|
|
27
|
+
super(DecisionScoringClientSpec, self).__init__(
|
|
28
|
+
request_name=request_name,
|
|
29
|
+
request_schema=DecisionScoringRequest,
|
|
30
|
+
response_name=response_name,
|
|
31
|
+
response_schema=DecisionScoringResponse,
|
|
32
|
+
impl=DecisionScoringClient,
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
from . request_response_spec import RequestResponseSpec
|
|
3
|
+
from .. schema import FieldExtractionRequest, FieldExtractionResponse
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FieldExtractionClient:
|
|
7
|
+
async def extract(self, state, fields, timeout=300):
|
|
8
|
+
|
|
9
|
+
resp = await self.request(
|
|
10
|
+
FieldExtractionRequest(
|
|
11
|
+
state=state,
|
|
12
|
+
fields=fields,
|
|
13
|
+
),
|
|
14
|
+
timeout=timeout,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
if resp.error:
|
|
18
|
+
raise RuntimeError(resp.error.message)
|
|
19
|
+
|
|
20
|
+
return resp
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class FieldExtractionClientSpec(RequestResponseSpec):
|
|
24
|
+
def __init__(
|
|
25
|
+
self, request_name, response_name,
|
|
26
|
+
):
|
|
27
|
+
super(FieldExtractionClientSpec, self).__init__(
|
|
28
|
+
request_name=request_name,
|
|
29
|
+
request_schema=FieldExtractionRequest,
|
|
30
|
+
response_name=response_name,
|
|
31
|
+
response_schema=FieldExtractionResponse,
|
|
32
|
+
impl=FieldExtractionClient,
|
|
33
|
+
)
|
|
@@ -4,12 +4,17 @@ from .. schema import GraphRagQuery, GraphRagResponse
|
|
|
4
4
|
|
|
5
5
|
class GraphRagClient:
|
|
6
6
|
async def rag(self, query, collection="default",
|
|
7
|
+
entity_limit=0, triple_limit=0,
|
|
8
|
+
max_subgraph_size=0, max_path_length=0,
|
|
9
|
+
edge_score_limit=0, edge_limit=0,
|
|
10
|
+
max_reranker_input=0,
|
|
7
11
|
chunk_callback=None, explain_callback=None,
|
|
8
12
|
parent_uri="",
|
|
9
13
|
grounding_seeds=None,
|
|
10
14
|
graph_seeds=None,
|
|
11
15
|
languages=None,
|
|
12
16
|
traversal_instructions=None,
|
|
17
|
+
graph=None,
|
|
13
18
|
timeout=600):
|
|
14
19
|
"""
|
|
15
20
|
Execute a graph RAG query with optional streaming callbacks.
|
|
@@ -53,11 +58,19 @@ class GraphRagClient:
|
|
|
53
58
|
GraphRagQuery(
|
|
54
59
|
query = query,
|
|
55
60
|
collection = collection,
|
|
61
|
+
entity_limit = entity_limit,
|
|
62
|
+
triple_limit = triple_limit,
|
|
63
|
+
max_subgraph_size = max_subgraph_size,
|
|
64
|
+
max_path_length = max_path_length,
|
|
65
|
+
edge_score_limit = edge_score_limit,
|
|
66
|
+
edge_limit = edge_limit,
|
|
67
|
+
max_reranker_input = max_reranker_input,
|
|
56
68
|
parent_uri = parent_uri,
|
|
57
69
|
grounding_seeds = grounding_seeds or [],
|
|
58
70
|
graph_seeds = graph_seeds or [],
|
|
59
71
|
languages = languages or [],
|
|
60
72
|
traversal_instructions = traversal_instructions or [],
|
|
73
|
+
graph = graph,
|
|
61
74
|
),
|
|
62
75
|
timeout=timeout,
|
|
63
76
|
recipient=recipient,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
from . request_response_spec import RequestResponseSpec
|
|
3
|
+
from .. schema import (
|
|
4
|
+
KnowledgeRetrievalRequest, KnowledgeRetrievalResponse,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
class KnowledgeRetrievalClient:
|
|
8
|
+
async def retrieve(
|
|
9
|
+
self, concepts=None, entities=None,
|
|
10
|
+
collection="default",
|
|
11
|
+
entity_limit=50, triple_limit=30,
|
|
12
|
+
max_path_length=2, edge_limit=25,
|
|
13
|
+
max_reranker_input=350,
|
|
14
|
+
languages=None, graph="",
|
|
15
|
+
timeout=300,
|
|
16
|
+
):
|
|
17
|
+
|
|
18
|
+
resp = await self.request(
|
|
19
|
+
KnowledgeRetrievalRequest(
|
|
20
|
+
concepts=concepts or [],
|
|
21
|
+
entities=entities or [],
|
|
22
|
+
collection=collection,
|
|
23
|
+
entity_limit=entity_limit,
|
|
24
|
+
triple_limit=triple_limit,
|
|
25
|
+
max_path_length=max_path_length,
|
|
26
|
+
edge_limit=edge_limit,
|
|
27
|
+
max_reranker_input=max_reranker_input,
|
|
28
|
+
languages=languages or [],
|
|
29
|
+
graph=graph,
|
|
30
|
+
),
|
|
31
|
+
timeout=timeout,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
if resp.error:
|
|
35
|
+
raise RuntimeError(resp.error.message)
|
|
36
|
+
|
|
37
|
+
return resp
|
|
38
|
+
|
|
39
|
+
class KnowledgeRetrievalClientSpec(RequestResponseSpec):
|
|
40
|
+
def __init__(
|
|
41
|
+
self, request_name, response_name,
|
|
42
|
+
):
|
|
43
|
+
super(KnowledgeRetrievalClientSpec, self).__init__(
|
|
44
|
+
request_name = request_name,
|
|
45
|
+
request_schema = KnowledgeRetrievalRequest,
|
|
46
|
+
response_name = response_name,
|
|
47
|
+
response_schema = KnowledgeRetrievalResponse,
|
|
48
|
+
impl = KnowledgeRetrievalClient,
|
|
49
|
+
)
|