trustgraph-base 2.8.0__tar.gz → 2.8.2__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.8.0 → trustgraph_base-2.8.2}/PKG-INFO +2 -1
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/pyproject.toml +1 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/__init__.py +1 -7
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/agent_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/async_config_client.py +2 -1
- trustgraph_base-2.8.2/trustgraph/base/async_kafka_backend.py +304 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/async_processor.py +15 -3
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/audit_publisher.py +16 -18
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/config_client.py +11 -11
- trustgraph_base-2.8.2/trustgraph/base/consumer_spec.py +36 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/document_embeddings_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/embeddings_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/graph_embeddings_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/graph_rag_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/iam_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/keyword_index_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/librarian_spec.py +0 -19
- trustgraph_base-2.8.2/trustgraph/base/producer_spec.py +22 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/prompt_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/pubsub.py +8 -42
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/request_response_client.py +12 -4
- trustgraph_base-2.8.2/trustgraph/base/request_response_spec.py +77 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/reranker_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/row_embeddings_query_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/structured_query_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/text_completion_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/tool_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/tool_service_client.py +2 -2
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/triples_client.py +2 -2
- trustgraph_base-2.8.2/trustgraph/base_version.py +1 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph_base.egg-info/PKG-INFO +2 -1
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph_base.egg-info/SOURCES.txt +1 -22
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph_base.egg-info/requires.txt +1 -0
- trustgraph_base-2.8.0/trustgraph/base/consumer.py +0 -285
- trustgraph_base-2.8.0/trustgraph/base/consumer_spec.py +0 -68
- trustgraph_base-2.8.0/trustgraph/base/kafka_backend.py +0 -452
- trustgraph_base-2.8.0/trustgraph/base/librarian_client.py +0 -253
- trustgraph_base-2.8.0/trustgraph/base/producer.py +0 -82
- trustgraph_base-2.8.0/trustgraph/base/producer_spec.py +0 -40
- trustgraph_base-2.8.0/trustgraph/base/publisher.py +0 -120
- trustgraph_base-2.8.0/trustgraph/base/pulsar_backend.py +0 -410
- trustgraph_base-2.8.0/trustgraph/base/rabbitmq_backend.py +0 -523
- trustgraph_base-2.8.0/trustgraph/base/request_response_spec.py +0 -215
- trustgraph_base-2.8.0/trustgraph/base/subscriber.py +0 -389
- trustgraph_base-2.8.0/trustgraph/base/subscriber_spec.py +0 -33
- trustgraph_base-2.8.0/trustgraph/base_version.py +0 -1
- trustgraph_base-2.8.0/trustgraph/clients/agent_client.py +0 -94
- trustgraph_base-2.8.0/trustgraph/clients/base.py +0 -124
- trustgraph_base-2.8.0/trustgraph/clients/config_client.py +0 -174
- trustgraph_base-2.8.0/trustgraph/clients/document_embeddings_client.py +0 -45
- trustgraph_base-2.8.0/trustgraph/clients/document_rag_client.py +0 -78
- trustgraph_base-2.8.0/trustgraph/clients/embeddings_client.py +0 -31
- trustgraph_base-2.8.0/trustgraph/clients/graph_embeddings_client.py +0 -45
- trustgraph_base-2.8.0/trustgraph/clients/graph_rag_client.py +0 -83
- trustgraph_base-2.8.0/trustgraph/clients/llm_client.py +0 -99
- trustgraph_base-2.8.0/trustgraph/clients/prompt_client.py +0 -154
- trustgraph_base-2.8.0/trustgraph/clients/row_embeddings_client.py +0 -54
- trustgraph_base-2.8.0/trustgraph/clients/triples_query_client.py +0 -61
- trustgraph_base-2.8.0/trustgraph/objects/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/README.md +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/setup.cfg +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/api.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/async_bulk_client.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/async_flow.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/async_metrics.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/async_socket_client.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/bulk_client.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/collection.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/config.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/exceptions.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/explainability.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/flow.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/knowledge.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/library.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/metrics.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/socket_client.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/api/types.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/agent_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/async_backend.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/async_librarian_client.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/async_pulsar_backend.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/async_rabbitmq_backend.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/async_rr_wrapper.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/backend.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/cassandra_config.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/chunking_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/collection_config_handler.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/document_embeddings_query_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/document_embeddings_store_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/dynamic_tool_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/embeddings_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/flow.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/flow_processor.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/graph_embeddings_query_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/graph_embeddings_store_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/image_to_text_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/keyword_index_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/llm_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/logging.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/metrics.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/parameter_spec.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/processor_group.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/qdrant_config.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/receiver_pool.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/reranker_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/schema_compatibility.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/sender_pool.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/serialization.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/spec.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/tool_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/triples_query_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/triples_store_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/workspace_processor.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/exceptions.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/ar.json +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/en.json +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/es.json +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/he.json +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/hi.json +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/pt.json +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/ru.json +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/sw.json +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/tr.json +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/i18n/packs/zh-cn.json +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/knowledge/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/knowledge/defs.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/knowledge/document.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/knowledge/identifier.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/knowledge/organization.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/knowledge/publication.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/log_level.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/registry.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/agent.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/base.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/collection.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/config.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/diagnosis.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/document_loading.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/embeddings.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/embeddings_query.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/flow.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/iam.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/image_to_text.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/knowledge.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/library.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/metadata.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/nlp_query.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/primitives.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/prompt.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/reranker.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/retrieval.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/rows_query.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/sparql_query.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/structured_query.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/text_completion.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/tool.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/messaging/translators/triples.py +0 -0
- {trustgraph_base-2.8.0/trustgraph/clients → trustgraph_base-2.8.2/trustgraph/objects}/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/objects/field.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/objects/object.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/provenance/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/provenance/agent.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/provenance/namespaces.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/provenance/triples.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/provenance/uris.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/provenance/vocabulary.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/rdf.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/core/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/core/metadata.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/core/primitives.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/core/topic.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/knowledge/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/knowledge/document.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/knowledge/embeddings.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/knowledge/graph.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/knowledge/knowledge.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/knowledge/nlp.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/knowledge/object.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/knowledge/rows.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/knowledge/structured.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/__init__.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/agent.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/audit.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/collection.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/config.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/diagnosis.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/flow.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/iam.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/image_to_text.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/library.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/llm.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/lookup.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/nlp_query.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/prompt.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/query.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/reranker.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/retrieval.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/rows_query.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/sparql_query.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/storage.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/structured_query.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/schema/services/tool_service.py +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph_base.egg-info/dependency_links.txt +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph_base.egg-info/entry_points.txt +0 -0
- {trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/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.8.
|
|
3
|
+
Version: 2.8.2
|
|
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
|
|
@@ -15,6 +15,7 @@ Requires-Dist: python-logging-loki
|
|
|
15
15
|
Requires-Dist: pika
|
|
16
16
|
Requires-Dist: aio-pika
|
|
17
17
|
Requires-Dist: confluent-kafka
|
|
18
|
+
Requires-Dist: aiokafka
|
|
18
19
|
Requires-Dist: pyyaml
|
|
19
20
|
Requires-Dist: websockets
|
|
20
21
|
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
from . pubsub import
|
|
2
|
+
from . pubsub import get_async_pubsub, add_pubsub_args
|
|
3
3
|
from . async_processor import AsyncProcessor
|
|
4
|
-
from . consumer import Consumer
|
|
5
|
-
from . producer import Producer
|
|
6
|
-
from . publisher import Publisher
|
|
7
|
-
from . subscriber import Subscriber
|
|
8
4
|
from . metrics import ProcessorMetrics, ConsumerMetrics, ProducerMetrics, SubscriberMetrics
|
|
9
5
|
from . logging import add_logging_args, setup_logging
|
|
10
6
|
from . workspace_processor import WorkspaceProcessor
|
|
@@ -12,10 +8,8 @@ from . flow_processor import FlowProcessor
|
|
|
12
8
|
from . consumer_spec import ConsumerSpec
|
|
13
9
|
from . parameter_spec import ParameterSpec
|
|
14
10
|
from . producer_spec import ProducerSpec
|
|
15
|
-
from . subscriber_spec import SubscriberSpec
|
|
16
11
|
from . request_response_spec import RequestResponseSpec
|
|
17
12
|
from . llm_service import LlmService, LlmResult, LlmChunk
|
|
18
|
-
from . librarian_client import LibrarianClient
|
|
19
13
|
from . librarian_spec import LibrarianSpec
|
|
20
14
|
from . chunking_service import ChunkingService
|
|
21
15
|
from . embeddings_service import EmbeddingsService
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
from . request_response_spec import
|
|
2
|
+
from . request_response_spec import RequestResponseSpec
|
|
3
3
|
from .. schema import AgentRequest, AgentResponse
|
|
4
4
|
from .. knowledge import Uri, Literal
|
|
5
5
|
|
|
6
|
-
class AgentClient
|
|
6
|
+
class AgentClient:
|
|
7
7
|
async def invoke(self, question, plan=None, state=None,
|
|
8
8
|
history=[], think=None, observe=None, answer_callback=None,
|
|
9
9
|
timeout=300):
|
|
@@ -12,7 +12,7 @@ class AsyncConfigClient:
|
|
|
12
12
|
|
|
13
13
|
@classmethod
|
|
14
14
|
async def create(cls, backend, request_topic, response_topic,
|
|
15
|
-
subscription=None):
|
|
15
|
+
subscription=None, timeout=CONFIG_TIMEOUT):
|
|
16
16
|
client = await RequestResponseClient.create(
|
|
17
17
|
backend=backend,
|
|
18
18
|
request_topic=request_topic,
|
|
@@ -20,6 +20,7 @@ class AsyncConfigClient:
|
|
|
20
20
|
request_schema=ConfigRequest,
|
|
21
21
|
response_schema=ConfigResponse,
|
|
22
22
|
subscription=subscription,
|
|
23
|
+
default_timeout=timeout,
|
|
23
24
|
)
|
|
24
25
|
return cls(client)
|
|
25
26
|
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Async Kafka backend implementation.
|
|
3
|
+
|
|
4
|
+
Uses aiokafka for fully async Kafka operations. Each logical topic
|
|
5
|
+
maps to a Kafka topic, matching the sync Kafka backend's topology:
|
|
6
|
+
|
|
7
|
+
class:topicspace:topic → topicspace.class.topic
|
|
8
|
+
|
|
9
|
+
Producers publish to the topic directly.
|
|
10
|
+
Consumers use consumer groups for competing-consumer semantics:
|
|
11
|
+
|
|
12
|
+
- flow / request: named consumer group (competing consumers)
|
|
13
|
+
- response / notify: unique consumer group per instance, filtering
|
|
14
|
+
messages by correlation ID (all subscribers see all messages)
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import asyncio
|
|
18
|
+
import json
|
|
19
|
+
import logging
|
|
20
|
+
import uuid
|
|
21
|
+
from typing import Any
|
|
22
|
+
|
|
23
|
+
from aiokafka import AIOKafkaProducer, AIOKafkaConsumer
|
|
24
|
+
from aiokafka.admin import AIOKafkaAdminClient, NewTopic
|
|
25
|
+
from aiokafka.errors import TopicAlreadyExistsError, UnknownTopicOrPartitionError
|
|
26
|
+
|
|
27
|
+
from .async_backend import AsyncPubSubBackend, AsyncBackendProducer
|
|
28
|
+
from .async_backend import AsyncBackendConsumer, Message
|
|
29
|
+
from .serialization import dataclass_to_dict, dict_to_dataclass
|
|
30
|
+
|
|
31
|
+
logger = logging.getLogger(__name__)
|
|
32
|
+
|
|
33
|
+
LONG_RETENTION_MS = 7 * 24 * 60 * 60 * 1000 # 7 days
|
|
34
|
+
SHORT_RETENTION_MS = 300 * 1000 # 5 minutes
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class AsyncKafkaMessage:
|
|
38
|
+
"""Wrapper for aiokafka messages to match Message protocol."""
|
|
39
|
+
|
|
40
|
+
def __init__(self, msg, schema_cls):
|
|
41
|
+
self._msg = msg
|
|
42
|
+
self._schema_cls = schema_cls
|
|
43
|
+
self._value = None
|
|
44
|
+
|
|
45
|
+
def value(self) -> Any:
|
|
46
|
+
if self._value is None:
|
|
47
|
+
data_dict = json.loads(self._msg.value.decode('utf-8'))
|
|
48
|
+
self._value = dict_to_dataclass(data_dict, self._schema_cls)
|
|
49
|
+
return self._value
|
|
50
|
+
|
|
51
|
+
def properties(self) -> dict:
|
|
52
|
+
headers = self._msg.headers or []
|
|
53
|
+
return {
|
|
54
|
+
k: v.decode('utf-8') if isinstance(v, bytes) else v
|
|
55
|
+
for k, v in headers
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class AsyncKafkaProducer:
|
|
60
|
+
"""Async Kafka producer using aiokafka."""
|
|
61
|
+
|
|
62
|
+
def __init__(self, producer, topic_name):
|
|
63
|
+
self._producer = producer
|
|
64
|
+
self._topic_name = topic_name
|
|
65
|
+
|
|
66
|
+
async def send(self, message: Any, properties: dict = {}) -> None:
|
|
67
|
+
data_dict = dataclass_to_dict(message)
|
|
68
|
+
json_data = json.dumps(data_dict).encode('utf-8')
|
|
69
|
+
|
|
70
|
+
headers = [
|
|
71
|
+
(k, str(v).encode('utf-8'))
|
|
72
|
+
for k, v in properties.items()
|
|
73
|
+
] if properties else None
|
|
74
|
+
|
|
75
|
+
await self._producer.send_and_wait(
|
|
76
|
+
self._topic_name,
|
|
77
|
+
value=json_data,
|
|
78
|
+
headers=headers,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
async def close(self) -> None:
|
|
82
|
+
try:
|
|
83
|
+
await self._producer.stop()
|
|
84
|
+
except BaseException:
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class AsyncKafkaConsumer:
|
|
89
|
+
"""Async Kafka consumer using aiokafka."""
|
|
90
|
+
|
|
91
|
+
def __init__(self, consumer, schema_cls):
|
|
92
|
+
self._consumer = consumer
|
|
93
|
+
self._schema_cls = schema_cls
|
|
94
|
+
|
|
95
|
+
async def receive(self) -> Message:
|
|
96
|
+
msg = await self._consumer.__anext__()
|
|
97
|
+
return AsyncKafkaMessage(msg, self._schema_cls)
|
|
98
|
+
|
|
99
|
+
async def acknowledge(self, message: Message) -> None:
|
|
100
|
+
if isinstance(message, AsyncKafkaMessage):
|
|
101
|
+
await self._consumer.commit()
|
|
102
|
+
|
|
103
|
+
async def negative_acknowledge(self, message: Message) -> None:
|
|
104
|
+
pass
|
|
105
|
+
|
|
106
|
+
async def close(self) -> None:
|
|
107
|
+
try:
|
|
108
|
+
await self._consumer.stop()
|
|
109
|
+
except BaseException:
|
|
110
|
+
pass
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class AsyncKafkaBackend:
|
|
114
|
+
"""Async Kafka pub/sub backend using aiokafka.
|
|
115
|
+
|
|
116
|
+
Fully async — zero OS threads for receiving, sending, and
|
|
117
|
+
consumer/producer lifecycle.
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
def __init__(
|
|
121
|
+
self, bootstrap_servers='localhost:9092',
|
|
122
|
+
security_protocol='PLAINTEXT',
|
|
123
|
+
sasl_mechanism=None,
|
|
124
|
+
sasl_username=None,
|
|
125
|
+
sasl_password=None,
|
|
126
|
+
):
|
|
127
|
+
self._bootstrap_servers = bootstrap_servers
|
|
128
|
+
self._security_protocol = security_protocol
|
|
129
|
+
self._sasl_mechanism = sasl_mechanism
|
|
130
|
+
self._sasl_username = sasl_username
|
|
131
|
+
self._sasl_password = sasl_password
|
|
132
|
+
|
|
133
|
+
self.max_consumer_concurrency = 1
|
|
134
|
+
|
|
135
|
+
logger.info(
|
|
136
|
+
f"Async Kafka backend: {bootstrap_servers} "
|
|
137
|
+
f"protocol={security_protocol}"
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
def _client_kwargs(self):
|
|
141
|
+
kwargs = {
|
|
142
|
+
'bootstrap_servers': self._bootstrap_servers,
|
|
143
|
+
'security_protocol': self._security_protocol,
|
|
144
|
+
}
|
|
145
|
+
if self._sasl_mechanism:
|
|
146
|
+
kwargs['sasl_mechanism'] = self._sasl_mechanism
|
|
147
|
+
if self._sasl_username:
|
|
148
|
+
kwargs['sasl_plain_username'] = self._sasl_username
|
|
149
|
+
if self._sasl_password:
|
|
150
|
+
kwargs['sasl_plain_password'] = self._sasl_password
|
|
151
|
+
return kwargs
|
|
152
|
+
|
|
153
|
+
def _parse_topic(self, topic_id: str) -> tuple[str, str, bool]:
|
|
154
|
+
"""Parse topic identifier into Kafka topic name, class, durability.
|
|
155
|
+
|
|
156
|
+
Format: class:topicspace:topic
|
|
157
|
+
Returns: (topic_name, class, durable)
|
|
158
|
+
"""
|
|
159
|
+
if ':' not in topic_id:
|
|
160
|
+
return f'tg.flow.{topic_id}', 'flow', True
|
|
161
|
+
|
|
162
|
+
parts = topic_id.split(':', 2)
|
|
163
|
+
if len(parts) != 3:
|
|
164
|
+
raise ValueError(
|
|
165
|
+
f"Invalid topic format: {topic_id}, "
|
|
166
|
+
f"expected class:topicspace:topic"
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
cls, topicspace, topic = parts
|
|
170
|
+
|
|
171
|
+
if cls == 'flow':
|
|
172
|
+
durable = True
|
|
173
|
+
elif cls in ('request', 'response', 'notify'):
|
|
174
|
+
durable = False
|
|
175
|
+
else:
|
|
176
|
+
raise ValueError(
|
|
177
|
+
f"Invalid topic class: {cls}, "
|
|
178
|
+
f"expected flow, request, response, or notify"
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
topic_name = f"{topicspace}.{cls}.{topic}".replace(':', '.')
|
|
182
|
+
|
|
183
|
+
return topic_name, cls, durable
|
|
184
|
+
|
|
185
|
+
def _retention_ms(self, cls):
|
|
186
|
+
if cls == 'flow':
|
|
187
|
+
return LONG_RETENTION_MS
|
|
188
|
+
return SHORT_RETENTION_MS
|
|
189
|
+
|
|
190
|
+
async def create_producer(
|
|
191
|
+
self, topic: str, schema: type, **options,
|
|
192
|
+
) -> AsyncBackendProducer:
|
|
193
|
+
topic_name, cls, durable = self._parse_topic(topic)
|
|
194
|
+
|
|
195
|
+
producer = AIOKafkaProducer(
|
|
196
|
+
**self._client_kwargs(),
|
|
197
|
+
acks='all' if durable else 1,
|
|
198
|
+
max_request_size=10485760,
|
|
199
|
+
)
|
|
200
|
+
await producer.start()
|
|
201
|
+
|
|
202
|
+
logger.debug(f"Created async producer: topic={topic_name}")
|
|
203
|
+
|
|
204
|
+
return AsyncKafkaProducer(producer, topic_name)
|
|
205
|
+
|
|
206
|
+
async def create_consumer(
|
|
207
|
+
self, topic: str, subscription: str, schema: type,
|
|
208
|
+
initial_position: str = 'latest', **options,
|
|
209
|
+
) -> AsyncBackendConsumer:
|
|
210
|
+
topic_name, cls, durable = self._parse_topic(topic)
|
|
211
|
+
|
|
212
|
+
if cls in ('response', 'notify'):
|
|
213
|
+
group_id = f"{subscription}-{uuid.uuid4()}"
|
|
214
|
+
auto_offset_reset = 'earliest'
|
|
215
|
+
else:
|
|
216
|
+
group_id = subscription
|
|
217
|
+
auto_offset_reset = (
|
|
218
|
+
'earliest' if initial_position == 'earliest'
|
|
219
|
+
else 'latest'
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
consumer = AIOKafkaConsumer(
|
|
223
|
+
topic_name,
|
|
224
|
+
**self._client_kwargs(),
|
|
225
|
+
group_id=group_id,
|
|
226
|
+
auto_offset_reset=auto_offset_reset,
|
|
227
|
+
enable_auto_commit=False,
|
|
228
|
+
max_partition_fetch_bytes=10485760,
|
|
229
|
+
session_timeout_ms=6000,
|
|
230
|
+
heartbeat_interval_ms=1000,
|
|
231
|
+
)
|
|
232
|
+
await consumer.start()
|
|
233
|
+
|
|
234
|
+
logger.debug(
|
|
235
|
+
f"Created async consumer: topic={topic_name}, "
|
|
236
|
+
f"group={group_id}, cls={cls}"
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
return AsyncKafkaConsumer(consumer, schema)
|
|
240
|
+
|
|
241
|
+
async def create_topic(self, topic: str) -> None:
|
|
242
|
+
topic_name, cls, durable = self._parse_topic(topic)
|
|
243
|
+
retention_ms = self._retention_ms(cls)
|
|
244
|
+
|
|
245
|
+
admin = AIOKafkaAdminClient(**self._client_kwargs())
|
|
246
|
+
try:
|
|
247
|
+
await admin.start()
|
|
248
|
+
new_topic = NewTopic(
|
|
249
|
+
topic_name,
|
|
250
|
+
num_partitions=1,
|
|
251
|
+
replication_factor=1,
|
|
252
|
+
topic_configs={
|
|
253
|
+
'retention.ms': str(retention_ms),
|
|
254
|
+
},
|
|
255
|
+
)
|
|
256
|
+
await admin.create_topics([new_topic])
|
|
257
|
+
logger.info(f"Created topic: {topic_name}")
|
|
258
|
+
except TopicAlreadyExistsError:
|
|
259
|
+
logger.debug(f"Topic already exists: {topic_name}")
|
|
260
|
+
finally:
|
|
261
|
+
await admin.close()
|
|
262
|
+
|
|
263
|
+
async def delete_topic(self, topic: str) -> None:
|
|
264
|
+
topic_name, cls, durable = self._parse_topic(topic)
|
|
265
|
+
|
|
266
|
+
admin = AIOKafkaAdminClient(**self._client_kwargs())
|
|
267
|
+
try:
|
|
268
|
+
await admin.start()
|
|
269
|
+
await admin.delete_topics([topic_name])
|
|
270
|
+
logger.info(f"Deleted topic: {topic_name}")
|
|
271
|
+
except UnknownTopicOrPartitionError:
|
|
272
|
+
logger.debug(f"Topic not found: {topic_name}")
|
|
273
|
+
except BaseException as e:
|
|
274
|
+
logger.debug(f"Topic delete for {topic_name}: {e}")
|
|
275
|
+
finally:
|
|
276
|
+
try:
|
|
277
|
+
await admin.close()
|
|
278
|
+
except BaseException:
|
|
279
|
+
pass
|
|
280
|
+
|
|
281
|
+
async def topic_exists(self, topic: str) -> bool:
|
|
282
|
+
topic_name, cls, durable = self._parse_topic(topic)
|
|
283
|
+
|
|
284
|
+
admin = AIOKafkaAdminClient(**self._client_kwargs())
|
|
285
|
+
try:
|
|
286
|
+
await admin.start()
|
|
287
|
+
metadata = await admin.describe_topics([topic_name])
|
|
288
|
+
return len(metadata) > 0
|
|
289
|
+
except UnknownTopicOrPartitionError:
|
|
290
|
+
return False
|
|
291
|
+
except BaseException:
|
|
292
|
+
return False
|
|
293
|
+
finally:
|
|
294
|
+
try:
|
|
295
|
+
await admin.close()
|
|
296
|
+
except BaseException:
|
|
297
|
+
pass
|
|
298
|
+
|
|
299
|
+
async def ensure_topic(self, topic: str) -> None:
|
|
300
|
+
if not await self.topic_exists(topic):
|
|
301
|
+
await self.create_topic(topic)
|
|
302
|
+
|
|
303
|
+
async def close(self) -> None:
|
|
304
|
+
logger.info("Async Kafka backend closed")
|
|
@@ -15,13 +15,14 @@ from .. schema import ConfigPush, ConfigRequest, ConfigResponse
|
|
|
15
15
|
from .. schema import config_push_queue, config_request_queue
|
|
16
16
|
from .. schema import config_response_queue
|
|
17
17
|
from .. log_level import LogLevel
|
|
18
|
-
from . pubsub import get_async_pubsub,
|
|
18
|
+
from . pubsub import get_async_pubsub, add_pubsub_args
|
|
19
19
|
from . receiver_pool import ReceiverPool
|
|
20
20
|
from . sender_pool import SenderPool
|
|
21
21
|
from . request_response_client import RequestResponseClient
|
|
22
22
|
from . logging import add_logging_args, setup_logging
|
|
23
23
|
|
|
24
24
|
default_config_queue = config_push_queue
|
|
25
|
+
default_config_timeout = 60
|
|
25
26
|
|
|
26
27
|
logger = logging.getLogger(__name__)
|
|
27
28
|
|
|
@@ -60,6 +61,10 @@ class AsyncProcessor:
|
|
|
60
61
|
"config_push_queue", default_config_queue
|
|
61
62
|
)
|
|
62
63
|
|
|
64
|
+
self.config_timeout = int(params.get(
|
|
65
|
+
"config_timeout", default_config_timeout
|
|
66
|
+
))
|
|
67
|
+
|
|
63
68
|
self.config_handlers = []
|
|
64
69
|
self.workspace_handlers = []
|
|
65
70
|
self.config_version = 0
|
|
@@ -83,6 +88,7 @@ class AsyncProcessor:
|
|
|
83
88
|
response_topic=config_response_queue,
|
|
84
89
|
request_schema=ConfigRequest,
|
|
85
90
|
response_schema=ConfigResponse,
|
|
91
|
+
default_timeout=self.config_timeout,
|
|
86
92
|
)
|
|
87
93
|
|
|
88
94
|
async def _fetch_type_workspace(self, client, workspace, config_type):
|
|
@@ -92,7 +98,6 @@ class AsyncProcessor:
|
|
|
92
98
|
workspace=workspace,
|
|
93
99
|
type=config_type,
|
|
94
100
|
),
|
|
95
|
-
timeout=60,
|
|
96
101
|
)
|
|
97
102
|
if resp.error:
|
|
98
103
|
raise RuntimeError(f"Config error: {resp.error.message}")
|
|
@@ -104,7 +109,6 @@ class AsyncProcessor:
|
|
|
104
109
|
operation="getkeys-all-ws",
|
|
105
110
|
type=config_type,
|
|
106
111
|
),
|
|
107
|
-
timeout=60,
|
|
108
112
|
)
|
|
109
113
|
if resp.error:
|
|
110
114
|
raise RuntimeError(f"Config error: {resp.error.message}")
|
|
@@ -433,6 +437,14 @@ class AsyncProcessor:
|
|
|
433
437
|
help='Number of concurrent workers (default: 1)',
|
|
434
438
|
)
|
|
435
439
|
|
|
440
|
+
parser.add_argument(
|
|
441
|
+
'--config-timeout',
|
|
442
|
+
type=int,
|
|
443
|
+
default=default_config_timeout,
|
|
444
|
+
help=f'Config request timeout in seconds '
|
|
445
|
+
f'(default: {default_config_timeout})',
|
|
446
|
+
)
|
|
447
|
+
|
|
436
448
|
parser.add_argument(
|
|
437
449
|
'--metrics',
|
|
438
450
|
action=argparse.BooleanOptionalAction,
|
|
@@ -4,8 +4,6 @@ import logging
|
|
|
4
4
|
from datetime import datetime, timezone
|
|
5
5
|
from uuid import uuid4
|
|
6
6
|
|
|
7
|
-
from . producer import Producer
|
|
8
|
-
from . metrics import ProducerMetrics
|
|
9
7
|
from trustgraph.schema import AuditEvent, audit_events_queue
|
|
10
8
|
|
|
11
9
|
logger = logging.getLogger(__name__)
|
|
@@ -13,22 +11,11 @@ logger = logging.getLogger(__name__)
|
|
|
13
11
|
|
|
14
12
|
class AuditPublisher:
|
|
15
13
|
|
|
16
|
-
def __init__(self, component_name,
|
|
14
|
+
def __init__(self, component_name, async_backend=None):
|
|
17
15
|
self.component_name = component_name
|
|
18
16
|
self._handle = None
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
self._legacy_producer = Producer(
|
|
22
|
-
backend=backend,
|
|
23
|
-
topic=audit_events_queue,
|
|
24
|
-
schema=AuditEvent,
|
|
25
|
-
metrics=ProducerMetrics(
|
|
26
|
-
processor=processor_id or component_name,
|
|
27
|
-
producer="audit-events",
|
|
28
|
-
),
|
|
29
|
-
)
|
|
30
|
-
else:
|
|
31
|
-
self._legacy_producer = None
|
|
17
|
+
self._async_producer = None
|
|
18
|
+
self._async_backend = async_backend
|
|
32
19
|
|
|
33
20
|
async def start(self, sender_pool=None):
|
|
34
21
|
if sender_pool is not None:
|
|
@@ -36,8 +23,19 @@ class AuditPublisher:
|
|
|
36
23
|
topic=audit_events_queue,
|
|
37
24
|
schema=AuditEvent,
|
|
38
25
|
)
|
|
26
|
+
elif self._async_backend is not None:
|
|
27
|
+
self._async_producer = await self._async_backend.create_producer(
|
|
28
|
+
topic=audit_events_queue,
|
|
29
|
+
schema=AuditEvent,
|
|
30
|
+
)
|
|
39
31
|
|
|
40
32
|
async def stop(self):
|
|
33
|
+
if self._async_producer:
|
|
34
|
+
try:
|
|
35
|
+
await self._async_producer.close()
|
|
36
|
+
except BaseException:
|
|
37
|
+
pass
|
|
38
|
+
self._async_producer = None
|
|
41
39
|
if self._handle:
|
|
42
40
|
await self._handle.unregister()
|
|
43
41
|
|
|
@@ -54,7 +52,7 @@ class AuditPublisher:
|
|
|
54
52
|
try:
|
|
55
53
|
if self._handle:
|
|
56
54
|
await self._handle.send(event)
|
|
57
|
-
elif self.
|
|
58
|
-
await self.
|
|
55
|
+
elif self._async_producer:
|
|
56
|
+
await self._async_producer.send(event)
|
|
59
57
|
except Exception as e:
|
|
60
58
|
logger.warning(f"Failed to emit audit event: {e}")
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
from . request_response_spec import
|
|
2
|
+
from . request_response_spec import RequestResponseSpec
|
|
3
3
|
from .. schema import ConfigRequest, ConfigResponse, ConfigKey, ConfigValue
|
|
4
4
|
|
|
5
5
|
CONFIG_TIMEOUT = 10
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class ConfigClient
|
|
8
|
+
class ConfigClient:
|
|
9
9
|
|
|
10
|
-
async def _request(self, timeout=
|
|
10
|
+
async def _request(self, timeout=None, **kwargs):
|
|
11
11
|
resp = await self.request(
|
|
12
12
|
ConfigRequest(**kwargs),
|
|
13
13
|
timeout=timeout,
|
|
@@ -18,7 +18,7 @@ class ConfigClient(RequestResponse):
|
|
|
18
18
|
)
|
|
19
19
|
return resp
|
|
20
20
|
|
|
21
|
-
async def get(self, workspace, type, key, timeout=
|
|
21
|
+
async def get(self, workspace, type, key, timeout=None):
|
|
22
22
|
"""Get a single config value. Returns the value string or None."""
|
|
23
23
|
resp = await self._request(
|
|
24
24
|
operation="get",
|
|
@@ -30,7 +30,7 @@ class ConfigClient(RequestResponse):
|
|
|
30
30
|
return resp.values[0].value
|
|
31
31
|
return None
|
|
32
32
|
|
|
33
|
-
async def put(self, workspace, type, key, value, timeout=
|
|
33
|
+
async def put(self, workspace, type, key, value, timeout=None):
|
|
34
34
|
"""Put a single config value."""
|
|
35
35
|
await self._request(
|
|
36
36
|
operation="put",
|
|
@@ -39,7 +39,7 @@ class ConfigClient(RequestResponse):
|
|
|
39
39
|
timeout=timeout,
|
|
40
40
|
)
|
|
41
41
|
|
|
42
|
-
async def put_many(self, workspace, values, timeout=
|
|
42
|
+
async def put_many(self, workspace, values, timeout=None):
|
|
43
43
|
"""Put multiple config values in a single request within a
|
|
44
44
|
single workspace. values is a list of (type, key, value) tuples."""
|
|
45
45
|
await self._request(
|
|
@@ -52,7 +52,7 @@ class ConfigClient(RequestResponse):
|
|
|
52
52
|
timeout=timeout,
|
|
53
53
|
)
|
|
54
54
|
|
|
55
|
-
async def delete(self, workspace, type, key, timeout=
|
|
55
|
+
async def delete(self, workspace, type, key, timeout=None):
|
|
56
56
|
"""Delete a single config key."""
|
|
57
57
|
await self._request(
|
|
58
58
|
operation="delete",
|
|
@@ -61,7 +61,7 @@ class ConfigClient(RequestResponse):
|
|
|
61
61
|
timeout=timeout,
|
|
62
62
|
)
|
|
63
63
|
|
|
64
|
-
async def delete_many(self, workspace, keys, timeout=
|
|
64
|
+
async def delete_many(self, workspace, keys, timeout=None):
|
|
65
65
|
"""Delete multiple config keys in a single request within a
|
|
66
66
|
single workspace. keys is a list of (type, key) tuples."""
|
|
67
67
|
await self._request(
|
|
@@ -74,7 +74,7 @@ class ConfigClient(RequestResponse):
|
|
|
74
74
|
timeout=timeout,
|
|
75
75
|
)
|
|
76
76
|
|
|
77
|
-
async def keys(self, workspace, type, timeout=
|
|
77
|
+
async def keys(self, workspace, type, timeout=None):
|
|
78
78
|
"""List all keys for a config type within a workspace."""
|
|
79
79
|
resp = await self._request(
|
|
80
80
|
operation="list",
|
|
@@ -84,7 +84,7 @@ class ConfigClient(RequestResponse):
|
|
|
84
84
|
)
|
|
85
85
|
return resp.directory
|
|
86
86
|
|
|
87
|
-
async def get_all(self, workspace, timeout=
|
|
87
|
+
async def get_all(self, workspace, timeout=None):
|
|
88
88
|
"""Return every config entry in ``workspace`` as a nested dict
|
|
89
89
|
``{type: {key: value}}``. Values are returned as the raw
|
|
90
90
|
strings stored by config-svc (typically JSON); callers parse
|
|
@@ -96,7 +96,7 @@ class ConfigClient(RequestResponse):
|
|
|
96
96
|
)
|
|
97
97
|
return resp.config
|
|
98
98
|
|
|
99
|
-
async def workspaces_for_type(self, type, timeout=
|
|
99
|
+
async def workspaces_for_type(self, type, timeout=None):
|
|
100
100
|
"""Return the set of distinct workspaces with any config of
|
|
101
101
|
the given type."""
|
|
102
102
|
resp = await self._request(
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from . spec import Spec
|
|
6
|
+
|
|
7
|
+
class ConsumerSpec(Spec):
|
|
8
|
+
def __init__(self, name: str, schema: Any, handler: Any, concurrency: int = 1) -> None:
|
|
9
|
+
self.name = name
|
|
10
|
+
self.schema = schema
|
|
11
|
+
self.handler = handler
|
|
12
|
+
self.concurrency = concurrency
|
|
13
|
+
|
|
14
|
+
async def register(self, flow: Any, processor: Any, definition: dict[str, Any]) -> Any:
|
|
15
|
+
|
|
16
|
+
topic = definition["topics"][self.name]
|
|
17
|
+
subscription = (
|
|
18
|
+
processor.id + "--" + flow.workspace + "--" +
|
|
19
|
+
flow.name + "--" + self.name
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
handler = self.handler
|
|
23
|
+
|
|
24
|
+
async def pool_handler(message):
|
|
25
|
+
await handler(message, None, flow)
|
|
26
|
+
|
|
27
|
+
reg = await processor.receiver_pool.add_consumer(
|
|
28
|
+
topic=topic,
|
|
29
|
+
subscription=subscription,
|
|
30
|
+
schema=self.schema,
|
|
31
|
+
handler=pool_handler,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
flow.consumer[self.name] = reg
|
|
35
|
+
return reg
|
|
36
|
+
|
{trustgraph_base-2.8.0 → trustgraph_base-2.8.2}/trustgraph/base/document_embeddings_client.py
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
2
|
import logging
|
|
3
3
|
|
|
4
|
-
from . request_response_spec import
|
|
4
|
+
from . request_response_spec import RequestResponseSpec
|
|
5
5
|
from .. schema import DocumentEmbeddingsRequest, DocumentEmbeddingsResponse
|
|
6
6
|
from .. knowledge import Uri, Literal
|
|
7
7
|
|
|
8
8
|
# Module logger
|
|
9
9
|
logger = logging.getLogger(__name__)
|
|
10
10
|
|
|
11
|
-
class DocumentEmbeddingsClient
|
|
11
|
+
class DocumentEmbeddingsClient:
|
|
12
12
|
async def query(self, vector, limit=20, collection="default", timeout=30):
|
|
13
13
|
|
|
14
14
|
resp = await self.request(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
from . request_response_spec import
|
|
2
|
+
from . request_response_spec import RequestResponseSpec
|
|
3
3
|
from .. schema import EmbeddingsRequest, EmbeddingsResponse
|
|
4
4
|
|
|
5
|
-
class EmbeddingsClient
|
|
5
|
+
class EmbeddingsClient:
|
|
6
6
|
async def embed(self, texts, timeout=300):
|
|
7
7
|
|
|
8
8
|
resp = await self.request(
|
|
@@ -4,7 +4,7 @@ from typing import Any
|
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
6
|
|
|
7
|
-
from . request_response_spec import
|
|
7
|
+
from . request_response_spec import RequestResponseSpec
|
|
8
8
|
from .. schema import GraphEmbeddingsRequest, GraphEmbeddingsResponse, IRI, LITERAL
|
|
9
9
|
from .. knowledge import Uri, Literal
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ def to_value(x: Any) -> Any:
|
|
|
21
21
|
# Fallback
|
|
22
22
|
return Literal(x.value or x.iri)
|
|
23
23
|
|
|
24
|
-
class GraphEmbeddingsClient
|
|
24
|
+
class GraphEmbeddingsClient:
|
|
25
25
|
async def query(self, vector, limit=20, collection="default", timeout=30):
|
|
26
26
|
|
|
27
27
|
resp = await self.request(
|