trustgraph-base 2.8.1__tar.gz → 2.8.3__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.1 → trustgraph_base-2.8.3}/PKG-INFO +1 -1
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/__init__.py +1 -7
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/agent_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/async_processor.py +3 -1
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/audit_publisher.py +1 -19
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/config_client.py +2 -5
- trustgraph_base-2.8.3/trustgraph/base/consumer_spec.py +36 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/document_embeddings_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/embeddings_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/graph_embeddings_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/graph_rag_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/iam_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/keyword_index_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/librarian_spec.py +0 -19
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/metrics.py +40 -27
- trustgraph_base-2.8.3/trustgraph/base/producer_spec.py +22 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/prompt_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/pubsub.py +0 -53
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/receiver_pool.py +45 -2
- trustgraph_base-2.8.3/trustgraph/base/request_response_spec.py +77 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/reranker_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/row_embeddings_query_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/sender_pool.py +15 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/structured_query_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/text_completion_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/tool_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/tool_service.py +2 -3
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/tool_service_client.py +2 -2
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/triples_client.py +2 -2
- trustgraph_base-2.8.3/trustgraph/base_version.py +1 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph_base.egg-info/PKG-INFO +1 -1
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph_base.egg-info/SOURCES.txt +0 -22
- trustgraph_base-2.8.1/trustgraph/base/consumer.py +0 -285
- trustgraph_base-2.8.1/trustgraph/base/consumer_spec.py +0 -68
- trustgraph_base-2.8.1/trustgraph/base/kafka_backend.py +0 -452
- trustgraph_base-2.8.1/trustgraph/base/librarian_client.py +0 -253
- trustgraph_base-2.8.1/trustgraph/base/producer.py +0 -82
- trustgraph_base-2.8.1/trustgraph/base/producer_spec.py +0 -40
- trustgraph_base-2.8.1/trustgraph/base/publisher.py +0 -120
- trustgraph_base-2.8.1/trustgraph/base/pulsar_backend.py +0 -410
- trustgraph_base-2.8.1/trustgraph/base/rabbitmq_backend.py +0 -523
- trustgraph_base-2.8.1/trustgraph/base/request_response_spec.py +0 -221
- trustgraph_base-2.8.1/trustgraph/base/subscriber.py +0 -389
- trustgraph_base-2.8.1/trustgraph/base/subscriber_spec.py +0 -33
- trustgraph_base-2.8.1/trustgraph/base_version.py +0 -1
- trustgraph_base-2.8.1/trustgraph/clients/agent_client.py +0 -94
- trustgraph_base-2.8.1/trustgraph/clients/base.py +0 -124
- trustgraph_base-2.8.1/trustgraph/clients/config_client.py +0 -174
- trustgraph_base-2.8.1/trustgraph/clients/document_embeddings_client.py +0 -45
- trustgraph_base-2.8.1/trustgraph/clients/document_rag_client.py +0 -78
- trustgraph_base-2.8.1/trustgraph/clients/embeddings_client.py +0 -31
- trustgraph_base-2.8.1/trustgraph/clients/graph_embeddings_client.py +0 -45
- trustgraph_base-2.8.1/trustgraph/clients/graph_rag_client.py +0 -83
- trustgraph_base-2.8.1/trustgraph/clients/llm_client.py +0 -99
- trustgraph_base-2.8.1/trustgraph/clients/prompt_client.py +0 -154
- trustgraph_base-2.8.1/trustgraph/clients/row_embeddings_client.py +0 -54
- trustgraph_base-2.8.1/trustgraph/clients/triples_query_client.py +0 -61
- trustgraph_base-2.8.1/trustgraph/objects/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/README.md +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/pyproject.toml +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/setup.cfg +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/api.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/async_bulk_client.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/async_flow.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/async_metrics.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/async_socket_client.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/bulk_client.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/collection.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/config.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/exceptions.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/explainability.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/flow.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/knowledge.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/library.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/metrics.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/socket_client.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/api/types.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/agent_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/async_backend.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/async_config_client.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/async_kafka_backend.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/async_librarian_client.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/async_pulsar_backend.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/async_rabbitmq_backend.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/async_rr_wrapper.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/backend.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/cassandra_config.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/chunking_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/collection_config_handler.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/document_embeddings_query_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/document_embeddings_store_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/dynamic_tool_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/embeddings_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/flow.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/flow_processor.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/graph_embeddings_query_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/graph_embeddings_store_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/image_to_text_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/keyword_index_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/llm_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/logging.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/parameter_spec.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/processor_group.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/qdrant_config.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/request_response_client.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/reranker_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/schema_compatibility.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/serialization.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/spec.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/triples_query_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/triples_store_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/base/workspace_processor.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/exceptions.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/ar.json +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/en.json +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/es.json +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/he.json +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/hi.json +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/pt.json +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/ru.json +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/sw.json +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/tr.json +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/i18n/packs/zh-cn.json +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/knowledge/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/knowledge/defs.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/knowledge/document.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/knowledge/identifier.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/knowledge/organization.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/knowledge/publication.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/log_level.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/registry.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/agent.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/base.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/collection.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/config.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/diagnosis.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/document_loading.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/embeddings.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/embeddings_query.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/flow.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/iam.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/image_to_text.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/knowledge.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/library.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/metadata.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/nlp_query.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/primitives.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/prompt.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/reranker.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/retrieval.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/rows_query.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/sparql_query.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/structured_query.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/text_completion.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/tool.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/messaging/translators/triples.py +0 -0
- {trustgraph_base-2.8.1/trustgraph/clients → trustgraph_base-2.8.3/trustgraph/objects}/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/objects/field.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/objects/object.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/provenance/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/provenance/agent.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/provenance/namespaces.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/provenance/triples.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/provenance/uris.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/provenance/vocabulary.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/rdf.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/core/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/core/metadata.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/core/primitives.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/core/topic.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/knowledge/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/knowledge/document.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/knowledge/embeddings.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/knowledge/graph.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/knowledge/knowledge.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/knowledge/nlp.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/knowledge/object.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/knowledge/rows.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/knowledge/structured.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/__init__.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/agent.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/audit.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/collection.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/config.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/diagnosis.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/flow.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/iam.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/image_to_text.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/library.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/llm.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/lookup.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/nlp_query.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/prompt.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/query.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/reranker.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/retrieval.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/rows_query.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/sparql_query.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/storage.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/structured_query.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph/schema/services/tool_service.py +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph_base.egg-info/dependency_links.txt +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph_base.egg-info/entry_points.txt +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/trustgraph_base.egg-info/requires.txt +0 -0
- {trustgraph_base-2.8.1 → trustgraph_base-2.8.3}/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.3
|
|
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
|
|
@@ -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):
|
|
@@ -15,7 +15,7 @@ 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
|
|
@@ -51,10 +51,12 @@ class AsyncProcessor:
|
|
|
51
51
|
self.receiver_pool = ReceiverPool(
|
|
52
52
|
backend=self.async_backend,
|
|
53
53
|
concurrency=self.concurrency,
|
|
54
|
+
processor_id=self.id,
|
|
54
55
|
)
|
|
55
56
|
|
|
56
57
|
self.sender_pool = SenderPool(
|
|
57
58
|
backend=self.async_backend,
|
|
59
|
+
processor_id=self.id,
|
|
58
60
|
)
|
|
59
61
|
|
|
60
62
|
self.config_push_queue = params.get(
|
|
@@ -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,26 +11,12 @@ logger = logging.getLogger(__name__)
|
|
|
13
11
|
|
|
14
12
|
class AuditPublisher:
|
|
15
13
|
|
|
16
|
-
def __init__(self, component_name,
|
|
17
|
-
async_backend=None):
|
|
14
|
+
def __init__(self, component_name, async_backend=None):
|
|
18
15
|
self.component_name = component_name
|
|
19
16
|
self._handle = None
|
|
20
17
|
self._async_producer = None
|
|
21
18
|
self._async_backend = async_backend
|
|
22
19
|
|
|
23
|
-
if backend is not None:
|
|
24
|
-
self._legacy_producer = Producer(
|
|
25
|
-
backend=backend,
|
|
26
|
-
topic=audit_events_queue,
|
|
27
|
-
schema=AuditEvent,
|
|
28
|
-
metrics=ProducerMetrics(
|
|
29
|
-
processor=processor_id or component_name,
|
|
30
|
-
producer="audit-events",
|
|
31
|
-
),
|
|
32
|
-
)
|
|
33
|
-
else:
|
|
34
|
-
self._legacy_producer = None
|
|
35
|
-
|
|
36
20
|
async def start(self, sender_pool=None):
|
|
37
21
|
if sender_pool is not None:
|
|
38
22
|
self._handle = await sender_pool.add_producer(
|
|
@@ -70,7 +54,5 @@ class AuditPublisher:
|
|
|
70
54
|
await self._handle.send(event)
|
|
71
55
|
elif self._async_producer:
|
|
72
56
|
await self._async_producer.send(event)
|
|
73
|
-
elif self._legacy_producer:
|
|
74
|
-
await self._legacy_producer.send(event)
|
|
75
57
|
except Exception as e:
|
|
76
58
|
logger.warning(f"Failed to emit audit event: {e}")
|
|
@@ -1,14 +1,11 @@
|
|
|
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
|
|
9
|
-
|
|
10
|
-
def __init__(self, timeout=CONFIG_TIMEOUT, **kwargs):
|
|
11
|
-
super(ConfigClient, self).__init__(default_timeout=timeout, **kwargs)
|
|
8
|
+
class ConfigClient:
|
|
12
9
|
|
|
13
10
|
async def _request(self, timeout=None, **kwargs):
|
|
14
11
|
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.1 → trustgraph_base-2.8.3}/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(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
from . request_response_spec import
|
|
2
|
+
from . request_response_spec import RequestResponseSpec
|
|
3
3
|
from .. schema import GraphRagQuery, GraphRagResponse
|
|
4
4
|
|
|
5
|
-
class GraphRagClient
|
|
5
|
+
class GraphRagClient:
|
|
6
6
|
async def rag(self, query, collection="default",
|
|
7
7
|
chunk_callback=None, explain_callback=None,
|
|
8
8
|
parent_uri="",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import json
|
|
3
3
|
|
|
4
|
-
from . request_response_spec import
|
|
4
|
+
from . request_response_spec import RequestResponseSpec
|
|
5
5
|
from .. schema import (
|
|
6
6
|
IamRequest, IamResponse,
|
|
7
7
|
UserInput, WorkspaceInput, ApiKeyInput,
|
|
@@ -10,7 +10,7 @@ from .. schema import (
|
|
|
10
10
|
IAM_TIMEOUT = 10
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class IamClient
|
|
13
|
+
class IamClient:
|
|
14
14
|
"""Client for the IAM service request/response pub/sub protocol.
|
|
15
15
|
|
|
16
16
|
Mirrors ``ConfigClient``: a thin wrapper around ``RequestResponse``
|
|
@@ -1,13 +1,13 @@
|
|
|
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 KeywordIndexRequest, KeywordIndexResponse
|
|
6
6
|
|
|
7
7
|
# Module logger
|
|
8
8
|
logger = logging.getLogger(__name__)
|
|
9
9
|
|
|
10
|
-
class KeywordIndexClient
|
|
10
|
+
class KeywordIndexClient:
|
|
11
11
|
async def query(self, query, limit=20, collection="default", timeout=30):
|
|
12
12
|
|
|
13
13
|
resp = await self.request(
|
|
@@ -4,7 +4,6 @@ import uuid
|
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
6
|
from . spec import Spec
|
|
7
|
-
from . librarian_client import LibrarianClient
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
class LibrarianSpec(Spec):
|
|
@@ -13,24 +12,6 @@ class LibrarianSpec(Spec):
|
|
|
13
12
|
self.request_name = request_name
|
|
14
13
|
self.response_name = response_name
|
|
15
14
|
|
|
16
|
-
def add(self, flow: Any, processor: Any, definition: dict[str, Any]) -> None:
|
|
17
|
-
|
|
18
|
-
client = LibrarianClient(
|
|
19
|
-
id=flow.id,
|
|
20
|
-
backend=processor.pubsub,
|
|
21
|
-
taskgroup=processor.taskgroup,
|
|
22
|
-
librarian_request_queue=definition["topics"][self.request_name],
|
|
23
|
-
librarian_response_queue=definition["topics"][self.response_name],
|
|
24
|
-
librarian_subscriber=(
|
|
25
|
-
processor.id + "--" + flow.workspace + "--" +
|
|
26
|
-
flow.name + "--librarian--" + str(uuid.uuid4())
|
|
27
|
-
),
|
|
28
|
-
workspace=flow.workspace,
|
|
29
|
-
flow_name=flow.name,
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
flow.librarian = client
|
|
33
|
-
|
|
34
15
|
async def register(self, flow: Any, processor: Any, definition: dict[str, Any]) -> Any:
|
|
35
16
|
|
|
36
17
|
from .async_librarian_client import AsyncLibrarianClient
|
|
@@ -13,13 +13,11 @@ class ConsumerMetrics:
|
|
|
13
13
|
|
|
14
14
|
self.processor = processor
|
|
15
15
|
self.consumer = consumer
|
|
16
|
-
self.workspace = workspace
|
|
17
|
-
self.flow = flow
|
|
18
16
|
|
|
19
17
|
if not hasattr(__class__, "state_metric"):
|
|
20
18
|
__class__.state_metric = Enum(
|
|
21
19
|
'consumer_state', 'Consumer state',
|
|
22
|
-
["processor", "
|
|
20
|
+
["processor", "consumer"],
|
|
23
21
|
states=['stopped', 'running']
|
|
24
22
|
)
|
|
25
23
|
|
|
@@ -32,31 +30,46 @@ class ConsumerMetrics:
|
|
|
32
30
|
if not hasattr(__class__, "processing_metric"):
|
|
33
31
|
__class__.processing_metric = Counter(
|
|
34
32
|
'processing_count', 'Processing count',
|
|
35
|
-
["processor", "
|
|
33
|
+
["processor", "consumer", "status"],
|
|
36
34
|
)
|
|
37
35
|
|
|
38
36
|
if not hasattr(__class__, "rate_limit_metric"):
|
|
39
37
|
__class__.rate_limit_metric = Counter(
|
|
40
38
|
'rate_limit_count', 'Rate limit event count',
|
|
41
|
-
["processor", "
|
|
39
|
+
["processor", "consumer"],
|
|
42
40
|
)
|
|
43
41
|
|
|
42
|
+
__class__.request_metric.labels(
|
|
43
|
+
processor=self.processor, consumer=self.consumer,
|
|
44
|
+
)
|
|
45
|
+
__class__.processing_metric.labels(
|
|
46
|
+
processor=self.processor, consumer=self.consumer,
|
|
47
|
+
status="ok",
|
|
48
|
+
)
|
|
49
|
+
__class__.processing_metric.labels(
|
|
50
|
+
processor=self.processor, consumer=self.consumer,
|
|
51
|
+
status="error",
|
|
52
|
+
)
|
|
53
|
+
__class__.rate_limit_metric.labels(
|
|
54
|
+
processor=self.processor, consumer=self.consumer,
|
|
55
|
+
)
|
|
56
|
+
|
|
44
57
|
def process(self, status: str) -> None:
|
|
45
58
|
__class__.processing_metric.labels(
|
|
46
|
-
processor=self.processor,
|
|
47
|
-
|
|
59
|
+
processor=self.processor,
|
|
60
|
+
consumer=self.consumer, status=status,
|
|
48
61
|
).inc()
|
|
49
62
|
|
|
50
63
|
def rate_limit(self) -> None:
|
|
51
64
|
__class__.rate_limit_metric.labels(
|
|
52
|
-
processor=self.processor,
|
|
53
|
-
|
|
65
|
+
processor=self.processor,
|
|
66
|
+
consumer=self.consumer,
|
|
54
67
|
).inc()
|
|
55
68
|
|
|
56
69
|
def state(self, state: str) -> None:
|
|
57
70
|
__class__.state_metric.labels(
|
|
58
|
-
processor=self.processor,
|
|
59
|
-
|
|
71
|
+
processor=self.processor,
|
|
72
|
+
consumer=self.consumer,
|
|
60
73
|
).state(state)
|
|
61
74
|
|
|
62
75
|
def record_time(self) -> Any:
|
|
@@ -72,19 +85,21 @@ class ProducerMetrics:
|
|
|
72
85
|
|
|
73
86
|
self.processor = processor
|
|
74
87
|
self.producer = producer
|
|
75
|
-
self.workspace = workspace
|
|
76
|
-
self.flow = flow
|
|
77
88
|
|
|
78
89
|
if not hasattr(__class__, "producer_metric"):
|
|
79
90
|
__class__.producer_metric = Counter(
|
|
80
91
|
'producer_count', 'Output items produced',
|
|
81
|
-
["processor", "
|
|
92
|
+
["processor", "producer"],
|
|
82
93
|
)
|
|
83
94
|
|
|
95
|
+
__class__.producer_metric.labels(
|
|
96
|
+
processor=self.processor, producer=self.producer,
|
|
97
|
+
)
|
|
98
|
+
|
|
84
99
|
def inc(self) -> None:
|
|
85
100
|
__class__.producer_metric.labels(
|
|
86
|
-
processor=self.processor,
|
|
87
|
-
|
|
101
|
+
processor=self.processor,
|
|
102
|
+
producer=self.producer,
|
|
88
103
|
).inc()
|
|
89
104
|
|
|
90
105
|
class ProcessorMetrics:
|
|
@@ -111,42 +126,40 @@ class SubscriberMetrics:
|
|
|
111
126
|
|
|
112
127
|
self.processor = processor
|
|
113
128
|
self.subscriber = subscriber
|
|
114
|
-
self.workspace = workspace
|
|
115
|
-
self.flow = flow
|
|
116
129
|
|
|
117
130
|
if not hasattr(__class__, "state_metric"):
|
|
118
131
|
__class__.state_metric = Enum(
|
|
119
132
|
'subscriber_state', 'Subscriber state',
|
|
120
|
-
["processor", "
|
|
133
|
+
["processor", "subscriber"],
|
|
121
134
|
states=['stopped', 'running']
|
|
122
135
|
)
|
|
123
136
|
|
|
124
137
|
if not hasattr(__class__, "received_metric"):
|
|
125
138
|
__class__.received_metric = Counter(
|
|
126
139
|
'received_count', 'Received count',
|
|
127
|
-
["processor", "
|
|
140
|
+
["processor", "subscriber"],
|
|
128
141
|
)
|
|
129
142
|
|
|
130
143
|
if not hasattr(__class__, "dropped_metric"):
|
|
131
144
|
__class__.dropped_metric = Counter(
|
|
132
145
|
'dropped_count', 'Dropped messages count',
|
|
133
|
-
["processor", "
|
|
146
|
+
["processor", "subscriber"],
|
|
134
147
|
)
|
|
135
148
|
|
|
136
149
|
def received(self) -> None:
|
|
137
150
|
__class__.received_metric.labels(
|
|
138
|
-
processor=self.processor,
|
|
139
|
-
|
|
151
|
+
processor=self.processor,
|
|
152
|
+
subscriber=self.subscriber,
|
|
140
153
|
).inc()
|
|
141
154
|
|
|
142
155
|
def state(self, state: str) -> None:
|
|
143
156
|
__class__.state_metric.labels(
|
|
144
|
-
processor=self.processor,
|
|
145
|
-
|
|
157
|
+
processor=self.processor,
|
|
158
|
+
subscriber=self.subscriber,
|
|
146
159
|
).state(state)
|
|
147
160
|
|
|
148
161
|
def dropped(self, state: str) -> None:
|
|
149
162
|
__class__.dropped_metric.labels(
|
|
150
|
-
processor=self.processor,
|
|
151
|
-
|
|
163
|
+
processor=self.processor,
|
|
164
|
+
subscriber=self.subscriber,
|
|
152
165
|
).inc()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from . spec import Spec
|
|
6
|
+
|
|
7
|
+
class ProducerSpec(Spec):
|
|
8
|
+
def __init__(self, name: str, schema: Any) -> None:
|
|
9
|
+
self.name = name
|
|
10
|
+
self.schema = schema
|
|
11
|
+
|
|
12
|
+
async def register(self, flow: Any, processor: Any, definition: dict[str, Any]) -> Any:
|
|
13
|
+
|
|
14
|
+
topic = definition["topics"][self.name]
|
|
15
|
+
|
|
16
|
+
handle = await processor.sender_pool.add_producer(
|
|
17
|
+
topic=topic,
|
|
18
|
+
schema=self.schema,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
flow.producer[self.name] = handle
|
|
22
|
+
return handle
|
|
@@ -5,7 +5,7 @@ import inspect
|
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
from typing import Optional, Any
|
|
7
7
|
|
|
8
|
-
from . request_response_spec import
|
|
8
|
+
from . request_response_spec import RequestResponseSpec
|
|
9
9
|
from .. schema import PromptRequest, PromptResponse
|
|
10
10
|
|
|
11
11
|
@dataclass
|
|
@@ -18,7 +18,7 @@ class PromptResult:
|
|
|
18
18
|
out_token: Optional[int] = None
|
|
19
19
|
model: Optional[str] = None
|
|
20
20
|
|
|
21
|
-
class PromptClient
|
|
21
|
+
class PromptClient:
|
|
22
22
|
|
|
23
23
|
async def prompt(self, id, variables, timeout=600, streaming=False, chunk_callback=None):
|
|
24
24
|
|
|
@@ -77,59 +77,6 @@ def get_async_pubsub(**config: Any) -> Any:
|
|
|
77
77
|
)
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
def get_pubsub(**config: Any) -> Any:
|
|
81
|
-
"""
|
|
82
|
-
Factory function to create a pub/sub backend based on configuration.
|
|
83
|
-
|
|
84
|
-
Args:
|
|
85
|
-
config: Configuration dictionary from command-line args.
|
|
86
|
-
Key 'pubsub_backend' selects the backend (default: 'pulsar').
|
|
87
|
-
|
|
88
|
-
Returns:
|
|
89
|
-
Backend instance implementing the PubSubBackend protocol.
|
|
90
|
-
"""
|
|
91
|
-
backend_type = config.get('pubsub_backend', 'pulsar')
|
|
92
|
-
|
|
93
|
-
if backend_type == 'pulsar':
|
|
94
|
-
from .pulsar_backend import PulsarBackend
|
|
95
|
-
return PulsarBackend(
|
|
96
|
-
host=config.get('pulsar_host', DEFAULT_PULSAR_HOST),
|
|
97
|
-
api_key=config.get('pulsar_api_key', DEFAULT_PULSAR_API_KEY),
|
|
98
|
-
listener=config.get('pulsar_listener'),
|
|
99
|
-
admin_url=config.get('pulsar_admin_url', DEFAULT_PULSAR_ADMIN_URL),
|
|
100
|
-
)
|
|
101
|
-
elif backend_type == 'rabbitmq':
|
|
102
|
-
from .rabbitmq_backend import RabbitMQBackend
|
|
103
|
-
return RabbitMQBackend(
|
|
104
|
-
host=config.get('rabbitmq_host', DEFAULT_RABBITMQ_HOST),
|
|
105
|
-
port=config.get('rabbitmq_port', DEFAULT_RABBITMQ_PORT),
|
|
106
|
-
username=config.get('rabbitmq_username', DEFAULT_RABBITMQ_USERNAME),
|
|
107
|
-
password=config.get('rabbitmq_password', DEFAULT_RABBITMQ_PASSWORD),
|
|
108
|
-
vhost=config.get('rabbitmq_vhost', DEFAULT_RABBITMQ_VHOST),
|
|
109
|
-
)
|
|
110
|
-
elif backend_type == 'kafka':
|
|
111
|
-
from .kafka_backend import KafkaBackend
|
|
112
|
-
return KafkaBackend(
|
|
113
|
-
bootstrap_servers=config.get(
|
|
114
|
-
'kafka_bootstrap_servers', DEFAULT_KAFKA_BOOTSTRAP,
|
|
115
|
-
),
|
|
116
|
-
security_protocol=config.get(
|
|
117
|
-
'kafka_security_protocol', DEFAULT_KAFKA_PROTOCOL,
|
|
118
|
-
),
|
|
119
|
-
sasl_mechanism=config.get(
|
|
120
|
-
'kafka_sasl_mechanism', DEFAULT_KAFKA_SASL_MECHANISM,
|
|
121
|
-
),
|
|
122
|
-
sasl_username=config.get(
|
|
123
|
-
'kafka_sasl_username', DEFAULT_KAFKA_SASL_USERNAME,
|
|
124
|
-
),
|
|
125
|
-
sasl_password=config.get(
|
|
126
|
-
'kafka_sasl_password', DEFAULT_KAFKA_SASL_PASSWORD,
|
|
127
|
-
),
|
|
128
|
-
)
|
|
129
|
-
else:
|
|
130
|
-
raise ValueError(f"Unknown pub/sub backend: {backend_type}")
|
|
131
|
-
|
|
132
|
-
|
|
133
80
|
STANDALONE_PULSAR_HOST = 'pulsar://localhost:6650'
|
|
134
81
|
STANDALONE_PULSAR_ADMIN_URL = 'http://localhost:8080'
|
|
135
82
|
|
|
@@ -26,6 +26,7 @@ class ConsumerRegistration:
|
|
|
26
26
|
backend_consumer: AsyncBackendConsumer
|
|
27
27
|
receiver_task: asyncio.Task
|
|
28
28
|
pool: 'ReceiverPool'
|
|
29
|
+
metrics: Any = None
|
|
29
30
|
|
|
30
31
|
async def unregister(self):
|
|
31
32
|
await self.pool.remove_consumer(self)
|
|
@@ -58,9 +59,13 @@ class ReceiverPool:
|
|
|
58
59
|
await pool.stop()
|
|
59
60
|
"""
|
|
60
61
|
|
|
61
|
-
def __init__(
|
|
62
|
+
def __init__(
|
|
63
|
+
self, backend: AsyncPubSubBackend, concurrency: int = 1,
|
|
64
|
+
processor_id: str | None = None,
|
|
65
|
+
):
|
|
62
66
|
self.backend = backend
|
|
63
67
|
self.concurrency = concurrency
|
|
68
|
+
self.processor_id = processor_id
|
|
64
69
|
self.work_queue = asyncio.Queue(maxsize=concurrency)
|
|
65
70
|
self.registrations: list[ConsumerRegistration] = []
|
|
66
71
|
self.worker_tasks: list[asyncio.Task] = []
|
|
@@ -93,6 +98,11 @@ class ReceiverPool:
|
|
|
93
98
|
await reg.receiver_task
|
|
94
99
|
except BaseException:
|
|
95
100
|
pass
|
|
101
|
+
|
|
102
|
+
for reg in self.registrations:
|
|
103
|
+
if reg.metrics:
|
|
104
|
+
reg.metrics.state("stopped")
|
|
105
|
+
|
|
96
106
|
self.registrations.clear()
|
|
97
107
|
|
|
98
108
|
if not self.work_queue.empty():
|
|
@@ -136,8 +146,18 @@ class ReceiverPool:
|
|
|
136
146
|
initial_position=initial_position,
|
|
137
147
|
)
|
|
138
148
|
|
|
149
|
+
metrics = None
|
|
150
|
+
if self.processor_id:
|
|
151
|
+
from .metrics import ConsumerMetrics
|
|
152
|
+
metrics = ConsumerMetrics(
|
|
153
|
+
processor=self.processor_id, consumer=topic,
|
|
154
|
+
)
|
|
155
|
+
metrics.state("running")
|
|
156
|
+
|
|
157
|
+
instrumented = self._instrumented_handler(handler, metrics)
|
|
158
|
+
|
|
139
159
|
receiver_task = asyncio.create_task(
|
|
140
|
-
self._receiver_loop(backend_consumer,
|
|
160
|
+
self._receiver_loop(backend_consumer, instrumented),
|
|
141
161
|
name=f"receiver-{topic}",
|
|
142
162
|
)
|
|
143
163
|
|
|
@@ -147,12 +167,32 @@ class ReceiverPool:
|
|
|
147
167
|
backend_consumer=backend_consumer,
|
|
148
168
|
receiver_task=receiver_task,
|
|
149
169
|
pool=self,
|
|
170
|
+
metrics=metrics,
|
|
150
171
|
)
|
|
151
172
|
self.registrations.append(reg)
|
|
152
173
|
|
|
153
174
|
logger.info(f"Added consumer: {topic}")
|
|
154
175
|
return reg
|
|
155
176
|
|
|
177
|
+
def _instrumented_handler(
|
|
178
|
+
self,
|
|
179
|
+
handler: Callable[..., Awaitable[None]],
|
|
180
|
+
metrics,
|
|
181
|
+
) -> Callable[..., Awaitable[None]]:
|
|
182
|
+
if metrics is None:
|
|
183
|
+
return handler
|
|
184
|
+
|
|
185
|
+
async def wrapper(message):
|
|
186
|
+
with metrics.record_time():
|
|
187
|
+
try:
|
|
188
|
+
await handler(message)
|
|
189
|
+
metrics.process("ok")
|
|
190
|
+
except Exception:
|
|
191
|
+
metrics.process("error")
|
|
192
|
+
raise
|
|
193
|
+
|
|
194
|
+
return wrapper
|
|
195
|
+
|
|
156
196
|
async def remove_consumer(self, reg: ConsumerRegistration):
|
|
157
197
|
try:
|
|
158
198
|
await reg.backend_consumer.close()
|
|
@@ -168,6 +208,9 @@ class ReceiverPool:
|
|
|
168
208
|
if reg in self.registrations:
|
|
169
209
|
self.registrations.remove(reg)
|
|
170
210
|
|
|
211
|
+
if reg.metrics:
|
|
212
|
+
reg.metrics.state("stopped")
|
|
213
|
+
|
|
171
214
|
logger.info(f"Removed consumer: {reg.topic}")
|
|
172
215
|
|
|
173
216
|
async def _receiver_loop(
|