trustgraph-base 2.3.18__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/PKG-INFO +1 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/__init__.py +1 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/api.py +21 -12
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/async_flow.py +15 -45
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/async_socket_client.py +14 -16
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/bulk_client.py +6 -6
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/collection.py +14 -87
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/config.py +50 -8
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/explainability.py +27 -62
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/flow.py +46 -196
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/knowledge.py +10 -82
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/library.py +66 -102
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/socket_client.py +8 -29
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/types.py +9 -8
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/async_processor.py +126 -58
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/chunking_service.py +3 -2
- trustgraph_base-2.4.0/trustgraph/base/collection_config_handler.py +153 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/config_client.py +27 -11
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/consumer_spec.py +4 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/document_embeddings_client.py +1 -3
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/document_embeddings_query_service.py +3 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/document_embeddings_store_service.py +2 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/dynamic_tool_service.py +4 -7
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/flow.py +4 -3
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/flow_processor.py +41 -32
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/graph_embeddings_client.py +1 -3
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/graph_embeddings_query_service.py +3 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/graph_embeddings_store_service.py +2 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/graph_rag_client.py +1 -3
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/librarian_client.py +12 -12
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/request_response_spec.py +3 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/row_embeddings_query_client.py +1 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/structured_query_client.py +1 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/subscriber_spec.py +1 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/tool_service.py +1 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/tool_service_client.py +2 -6
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/triples_client.py +2 -5
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/triples_query_service.py +8 -4
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/triples_store_service.py +4 -1
- trustgraph_base-2.4.0/trustgraph/base_version.py +1 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/config_client.py +29 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/document_embeddings_client.py +2 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/document_rag_client.py +2 -3
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/graph_embeddings_client.py +2 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/graph_rag_client.py +2 -3
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/row_embeddings_client.py +2 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/triples_query_client.py +2 -3
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/agent.py +0 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/collection.py +3 -5
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/config.py +13 -6
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/document_loading.py +0 -12
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/embeddings_query.py +0 -6
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/flow.py +4 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/knowledge.py +3 -9
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/library.py +3 -3
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/metadata.py +6 -6
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/retrieval.py +0 -4
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/rows_query.py +0 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/sparql_query.py +0 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/structured_query.py +2 -4
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/triples.py +1 -3
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/core/metadata.py +3 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/knowledge/knowledge.py +3 -3
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/agent.py +0 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/collection.py +9 -4
- trustgraph_base-2.4.0/trustgraph/schema/services/config.py +88 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/flow.py +3 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/library.py +7 -7
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/query.py +0 -4
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/retrieval.py +0 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/rows_query.py +0 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/sparql_query.py +0 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/structured_query.py +0 -1
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/tool_service.py +0 -2
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph_base.egg-info/PKG-INFO +1 -1
- trustgraph_base-2.3.18/trustgraph/base/collection_config_handler.py +0 -128
- trustgraph_base-2.3.18/trustgraph/base_version.py +0 -1
- trustgraph_base-2.3.18/trustgraph/schema/services/config.py +0 -68
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/README.md +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/pyproject.toml +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/setup.cfg +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/async_bulk_client.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/async_metrics.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/exceptions.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/api/metrics.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/agent_client.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/agent_service.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/backend.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/cassandra_config.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/consumer.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/embeddings_client.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/embeddings_service.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/kafka_backend.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/llm_service.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/logging.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/metrics.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/parameter_spec.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/processor_group.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/producer.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/producer_spec.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/prompt_client.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/publisher.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/pubsub.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/pulsar_backend.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/rabbitmq_backend.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/serialization.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/spec.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/subscriber.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/text_completion_client.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/base/tool_client.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/agent_client.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/base.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/embeddings_client.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/llm_client.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/clients/prompt_client.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/exceptions.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/ar.json +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/en.json +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/es.json +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/he.json +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/hi.json +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/pt.json +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/ru.json +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/sw.json +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/tr.json +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/i18n/packs/zh-cn.json +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/knowledge/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/knowledge/defs.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/knowledge/document.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/knowledge/identifier.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/knowledge/organization.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/knowledge/publication.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/log_level.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/registry.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/base.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/diagnosis.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/embeddings.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/nlp_query.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/primitives.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/prompt.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/text_completion.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/messaging/translators/tool.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/objects/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/objects/field.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/objects/object.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/provenance/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/provenance/agent.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/provenance/namespaces.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/provenance/triples.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/provenance/uris.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/provenance/vocabulary.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/rdf.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/core/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/core/primitives.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/core/topic.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/knowledge/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/knowledge/document.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/knowledge/embeddings.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/knowledge/graph.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/knowledge/nlp.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/knowledge/object.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/knowledge/rows.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/knowledge/structured.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/__init__.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/diagnosis.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/llm.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/lookup.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/nlp_query.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/prompt.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph/schema/services/storage.py +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph_base.egg-info/SOURCES.txt +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph_base.egg-info/dependency_links.txt +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph_base.egg-info/entry_points.txt +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.0}/trustgraph_base.egg-info/requires.txt +0 -0
- {trustgraph_base-2.3.18 → trustgraph_base-2.4.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: 2.
|
|
3
|
+
Version: 2.4.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
|
|
@@ -27,7 +27,6 @@ Quick Start:
|
|
|
27
27
|
# Execute a graph RAG query
|
|
28
28
|
response = flow.graph_rag(
|
|
29
29
|
query="What are the main topics?",
|
|
30
|
-
user="trustgraph",
|
|
31
30
|
collection="default"
|
|
32
31
|
)
|
|
33
32
|
```
|
|
@@ -38,7 +37,7 @@ For streaming and async operations:
|
|
|
38
37
|
socket = api.socket()
|
|
39
38
|
flow = socket.flow("default")
|
|
40
39
|
|
|
41
|
-
for chunk in flow.agent(question="Hello"
|
|
40
|
+
for chunk in flow.agent(question="Hello"):
|
|
42
41
|
print(chunk.content)
|
|
43
42
|
|
|
44
43
|
# Async operations
|
|
@@ -50,7 +50,7 @@ class Api:
|
|
|
50
50
|
token: Optional bearer token for authentication
|
|
51
51
|
"""
|
|
52
52
|
|
|
53
|
-
def __init__(self, url="http://localhost:8088/", timeout=60, token: Optional[str] = None):
|
|
53
|
+
def __init__(self, url="http://localhost:8088/", timeout=60, token: Optional[str] = None, workspace: str = "default"):
|
|
54
54
|
"""
|
|
55
55
|
Initialize the TrustGraph API client.
|
|
56
56
|
|
|
@@ -82,6 +82,7 @@ class Api:
|
|
|
82
82
|
|
|
83
83
|
self.timeout = timeout
|
|
84
84
|
self.token = token
|
|
85
|
+
self.workspace = workspace
|
|
85
86
|
|
|
86
87
|
# Lazy initialization for new clients
|
|
87
88
|
self._socket_client = None
|
|
@@ -137,7 +138,7 @@ class Api:
|
|
|
137
138
|
config.put([ConfigValue(type="llm", key="model", value="gpt-4")])
|
|
138
139
|
```
|
|
139
140
|
"""
|
|
140
|
-
return Config(api=self)
|
|
141
|
+
return Config(api=self, workspace=self.workspace)
|
|
141
142
|
|
|
142
143
|
def knowledge(self):
|
|
143
144
|
"""
|
|
@@ -151,10 +152,10 @@ class Api:
|
|
|
151
152
|
knowledge = api.knowledge()
|
|
152
153
|
|
|
153
154
|
# List available KG cores
|
|
154
|
-
cores = knowledge.list_kg_cores(
|
|
155
|
+
cores = knowledge.list_kg_cores()
|
|
155
156
|
|
|
156
157
|
# Load a KG core
|
|
157
|
-
knowledge.load_kg_core(id="core-123"
|
|
158
|
+
knowledge.load_kg_core(id="core-123")
|
|
158
159
|
```
|
|
159
160
|
"""
|
|
160
161
|
return Knowledge(api=self)
|
|
@@ -191,6 +192,12 @@ class Api:
|
|
|
191
192
|
if self.token:
|
|
192
193
|
headers["Authorization"] = f"Bearer {self.token}"
|
|
193
194
|
|
|
195
|
+
# Ensure every REST request carries the workspace so services can
|
|
196
|
+
# scope their behaviour. Callers that already set workspace in the
|
|
197
|
+
# payload (e.g. Library client) take precedence.
|
|
198
|
+
if isinstance(request, dict) and "workspace" not in request:
|
|
199
|
+
request = {**request, "workspace": self.workspace}
|
|
200
|
+
|
|
194
201
|
# Invoke the API, input is passed as JSON
|
|
195
202
|
resp = requests.post(url, json=request, timeout=self.timeout, headers=headers)
|
|
196
203
|
|
|
@@ -227,13 +234,12 @@ class Api:
|
|
|
227
234
|
document=b"Document content",
|
|
228
235
|
id="doc-123",
|
|
229
236
|
metadata=[],
|
|
230
|
-
user="trustgraph",
|
|
231
237
|
title="My Document",
|
|
232
238
|
comments="Test document"
|
|
233
239
|
)
|
|
234
240
|
|
|
235
241
|
# List documents
|
|
236
|
-
docs = library.get_documents(
|
|
242
|
+
docs = library.get_documents()
|
|
237
243
|
```
|
|
238
244
|
"""
|
|
239
245
|
return Library(self)
|
|
@@ -253,11 +259,10 @@ class Api:
|
|
|
253
259
|
collection = api.collection()
|
|
254
260
|
|
|
255
261
|
# List collections
|
|
256
|
-
colls = collection.list_collections(
|
|
262
|
+
colls = collection.list_collections()
|
|
257
263
|
|
|
258
264
|
# Update collection metadata
|
|
259
265
|
collection.update_collection(
|
|
260
|
-
user="trustgraph",
|
|
261
266
|
collection="default",
|
|
262
267
|
name="Default Collection",
|
|
263
268
|
description="Main data collection"
|
|
@@ -286,7 +291,6 @@ class Api:
|
|
|
286
291
|
# Stream agent responses
|
|
287
292
|
for chunk in flow.agent(
|
|
288
293
|
question="Explain quantum computing",
|
|
289
|
-
user="trustgraph",
|
|
290
294
|
streaming=True
|
|
291
295
|
):
|
|
292
296
|
if hasattr(chunk, 'content'):
|
|
@@ -297,7 +301,10 @@ class Api:
|
|
|
297
301
|
from . socket_client import SocketClient
|
|
298
302
|
# Extract base URL (remove api/v1/ suffix)
|
|
299
303
|
base_url = self.url.rsplit("api/v1/", 1)[0].rstrip("/")
|
|
300
|
-
self._socket_client = SocketClient(
|
|
304
|
+
self._socket_client = SocketClient(
|
|
305
|
+
base_url, self.timeout, self.token,
|
|
306
|
+
workspace=self.workspace,
|
|
307
|
+
)
|
|
301
308
|
return self._socket_client
|
|
302
309
|
|
|
303
310
|
def bulk(self):
|
|
@@ -406,7 +413,6 @@ class Api:
|
|
|
406
413
|
# Stream agent responses
|
|
407
414
|
async for chunk in flow.agent(
|
|
408
415
|
question="Explain quantum computing",
|
|
409
|
-
user="trustgraph",
|
|
410
416
|
streaming=True
|
|
411
417
|
):
|
|
412
418
|
if hasattr(chunk, 'content'):
|
|
@@ -417,7 +423,10 @@ class Api:
|
|
|
417
423
|
from . async_socket_client import AsyncSocketClient
|
|
418
424
|
# Extract base URL (remove api/v1/ suffix)
|
|
419
425
|
base_url = self.url.rsplit("api/v1/", 1)[0].rstrip("/")
|
|
420
|
-
self._async_socket_client = AsyncSocketClient(
|
|
426
|
+
self._async_socket_client = AsyncSocketClient(
|
|
427
|
+
base_url, self.timeout, self.token,
|
|
428
|
+
workspace=self.workspace,
|
|
429
|
+
)
|
|
421
430
|
return self._async_socket_client
|
|
422
431
|
|
|
423
432
|
def async_bulk(self):
|
|
@@ -326,9 +326,7 @@ class AsyncFlow:
|
|
|
326
326
|
|
|
327
327
|
# Use flow services
|
|
328
328
|
result = await flow.graph_rag(
|
|
329
|
-
query="What is TrustGraph?",
|
|
330
|
-
user="trustgraph",
|
|
331
|
-
collection="default"
|
|
329
|
+
query="What is TrustGraph?",collection="default"
|
|
332
330
|
)
|
|
333
331
|
```
|
|
334
332
|
"""
|
|
@@ -385,7 +383,7 @@ class AsyncFlowInstance:
|
|
|
385
383
|
"""
|
|
386
384
|
return await self.flow.request(f"flow/{self.flow_id}/service/{service}", request_data)
|
|
387
385
|
|
|
388
|
-
async def agent(self, question: str,
|
|
386
|
+
async def agent(self, question: str, state: Optional[Dict] = None,
|
|
389
387
|
group: Optional[str] = None, history: Optional[List] = None, **kwargs: Any) -> Dict[str, Any]:
|
|
390
388
|
"""
|
|
391
389
|
Execute an agent operation (non-streaming).
|
|
@@ -399,7 +397,6 @@ class AsyncFlowInstance:
|
|
|
399
397
|
|
|
400
398
|
Args:
|
|
401
399
|
question: User question or instruction
|
|
402
|
-
user: User identifier
|
|
403
400
|
state: Optional state dictionary for conversation context
|
|
404
401
|
group: Optional group identifier for session management
|
|
405
402
|
history: Optional conversation history list
|
|
@@ -416,14 +413,12 @@ class AsyncFlowInstance:
|
|
|
416
413
|
# Execute agent
|
|
417
414
|
result = await flow.agent(
|
|
418
415
|
question="What is the capital of France?",
|
|
419
|
-
|
|
420
|
-
)
|
|
416
|
+
)
|
|
421
417
|
print(f"Answer: {result.get('response')}")
|
|
422
418
|
```
|
|
423
419
|
"""
|
|
424
420
|
request_data = {
|
|
425
421
|
"question": question,
|
|
426
|
-
"user": user,
|
|
427
422
|
"streaming": False # REST doesn't support streaming
|
|
428
423
|
}
|
|
429
424
|
if state is not None:
|
|
@@ -481,7 +476,7 @@ class AsyncFlowInstance:
|
|
|
481
476
|
model=result.get("model"),
|
|
482
477
|
)
|
|
483
478
|
|
|
484
|
-
async def graph_rag(self, query: str,
|
|
479
|
+
async def graph_rag(self, query: str, collection: str,
|
|
485
480
|
max_subgraph_size: int = 1000, max_subgraph_count: int = 5,
|
|
486
481
|
max_entity_distance: int = 3, **kwargs: Any) -> str:
|
|
487
482
|
"""
|
|
@@ -496,7 +491,6 @@ class AsyncFlowInstance:
|
|
|
496
491
|
|
|
497
492
|
Args:
|
|
498
493
|
query: User query text
|
|
499
|
-
user: User identifier
|
|
500
494
|
collection: Collection identifier containing the knowledge graph
|
|
501
495
|
max_subgraph_size: Maximum number of triples per subgraph (default: 1000)
|
|
502
496
|
max_subgraph_count: Maximum number of subgraphs to retrieve (default: 5)
|
|
@@ -513,9 +507,7 @@ class AsyncFlowInstance:
|
|
|
513
507
|
|
|
514
508
|
# Query knowledge graph
|
|
515
509
|
response = await flow.graph_rag(
|
|
516
|
-
query="What are the relationships between these entities?",
|
|
517
|
-
user="trustgraph",
|
|
518
|
-
collection="medical-kb",
|
|
510
|
+
query="What are the relationships between these entities?",collection="medical-kb",
|
|
519
511
|
max_subgraph_count=3
|
|
520
512
|
)
|
|
521
513
|
print(response)
|
|
@@ -523,7 +515,6 @@ class AsyncFlowInstance:
|
|
|
523
515
|
"""
|
|
524
516
|
request_data = {
|
|
525
517
|
"query": query,
|
|
526
|
-
"user": user,
|
|
527
518
|
"collection": collection,
|
|
528
519
|
"max-subgraph-size": max_subgraph_size,
|
|
529
520
|
"max-subgraph-count": max_subgraph_count,
|
|
@@ -535,7 +526,7 @@ class AsyncFlowInstance:
|
|
|
535
526
|
result = await self.request("graph-rag", request_data)
|
|
536
527
|
return result.get("response", "")
|
|
537
528
|
|
|
538
|
-
async def document_rag(self, query: str,
|
|
529
|
+
async def document_rag(self, query: str, collection: str,
|
|
539
530
|
doc_limit: int = 10, **kwargs: Any) -> str:
|
|
540
531
|
"""
|
|
541
532
|
Execute document-based RAG query (non-streaming).
|
|
@@ -549,7 +540,6 @@ class AsyncFlowInstance:
|
|
|
549
540
|
|
|
550
541
|
Args:
|
|
551
542
|
query: User query text
|
|
552
|
-
user: User identifier
|
|
553
543
|
collection: Collection identifier containing documents
|
|
554
544
|
doc_limit: Maximum number of document chunks to retrieve (default: 10)
|
|
555
545
|
**kwargs: Additional service-specific parameters
|
|
@@ -564,9 +554,7 @@ class AsyncFlowInstance:
|
|
|
564
554
|
|
|
565
555
|
# Query documents
|
|
566
556
|
response = await flow.document_rag(
|
|
567
|
-
query="What does the documentation say about authentication?",
|
|
568
|
-
user="trustgraph",
|
|
569
|
-
collection="docs",
|
|
557
|
+
query="What does the documentation say about authentication?",collection="docs",
|
|
570
558
|
doc_limit=5
|
|
571
559
|
)
|
|
572
560
|
print(response)
|
|
@@ -574,7 +562,6 @@ class AsyncFlowInstance:
|
|
|
574
562
|
"""
|
|
575
563
|
request_data = {
|
|
576
564
|
"query": query,
|
|
577
|
-
"user": user,
|
|
578
565
|
"collection": collection,
|
|
579
566
|
"doc-limit": doc_limit,
|
|
580
567
|
"streaming": False
|
|
@@ -584,7 +571,7 @@ class AsyncFlowInstance:
|
|
|
584
571
|
result = await self.request("document-rag", request_data)
|
|
585
572
|
return result.get("response", "")
|
|
586
573
|
|
|
587
|
-
async def graph_embeddings_query(self, text: str,
|
|
574
|
+
async def graph_embeddings_query(self, text: str, collection: str, limit: int = 10, **kwargs: Any):
|
|
588
575
|
"""
|
|
589
576
|
Query graph embeddings for semantic entity search.
|
|
590
577
|
|
|
@@ -593,7 +580,6 @@ class AsyncFlowInstance:
|
|
|
593
580
|
|
|
594
581
|
Args:
|
|
595
582
|
text: Query text for semantic search
|
|
596
|
-
user: User identifier
|
|
597
583
|
collection: Collection identifier containing graph embeddings
|
|
598
584
|
limit: Maximum number of results to return (default: 10)
|
|
599
585
|
**kwargs: Additional service-specific parameters
|
|
@@ -608,9 +594,7 @@ class AsyncFlowInstance:
|
|
|
608
594
|
|
|
609
595
|
# Find related entities
|
|
610
596
|
results = await flow.graph_embeddings_query(
|
|
611
|
-
text="machine learning algorithms",
|
|
612
|
-
user="trustgraph",
|
|
613
|
-
collection="tech-kb",
|
|
597
|
+
text="machine learning algorithms",collection="tech-kb",
|
|
614
598
|
limit=5
|
|
615
599
|
)
|
|
616
600
|
|
|
@@ -624,7 +608,6 @@ class AsyncFlowInstance:
|
|
|
624
608
|
|
|
625
609
|
request_data = {
|
|
626
610
|
"vector": vector,
|
|
627
|
-
"user": user,
|
|
628
611
|
"collection": collection,
|
|
629
612
|
"limit": limit
|
|
630
613
|
}
|
|
@@ -663,7 +646,7 @@ class AsyncFlowInstance:
|
|
|
663
646
|
|
|
664
647
|
return await self.request("embeddings", request_data)
|
|
665
648
|
|
|
666
|
-
async def triples_query(self, s=None, p=None, o=None,
|
|
649
|
+
async def triples_query(self, s=None, p=None, o=None, collection=None, limit=100, **kwargs: Any):
|
|
667
650
|
"""
|
|
668
651
|
Query RDF triples using pattern matching.
|
|
669
652
|
|
|
@@ -674,7 +657,6 @@ class AsyncFlowInstance:
|
|
|
674
657
|
s: Subject pattern (None for wildcard)
|
|
675
658
|
p: Predicate pattern (None for wildcard)
|
|
676
659
|
o: Object pattern (None for wildcard)
|
|
677
|
-
user: User identifier (None for all users)
|
|
678
660
|
collection: Collection identifier (None for all collections)
|
|
679
661
|
limit: Maximum number of triples to return (default: 100)
|
|
680
662
|
**kwargs: Additional service-specific parameters
|
|
@@ -689,9 +671,7 @@ class AsyncFlowInstance:
|
|
|
689
671
|
|
|
690
672
|
# Find all triples with a specific predicate
|
|
691
673
|
results = await flow.triples_query(
|
|
692
|
-
p="knows",
|
|
693
|
-
user="trustgraph",
|
|
694
|
-
collection="social",
|
|
674
|
+
p="knows",collection="social",
|
|
695
675
|
limit=50
|
|
696
676
|
)
|
|
697
677
|
|
|
@@ -706,15 +686,13 @@ class AsyncFlowInstance:
|
|
|
706
686
|
request_data["p"] = str(p)
|
|
707
687
|
if o is not None:
|
|
708
688
|
request_data["o"] = str(o)
|
|
709
|
-
if user is not None:
|
|
710
|
-
request_data["user"] = user
|
|
711
689
|
if collection is not None:
|
|
712
690
|
request_data["collection"] = collection
|
|
713
691
|
request_data.update(kwargs)
|
|
714
692
|
|
|
715
693
|
return await self.request("triples", request_data)
|
|
716
694
|
|
|
717
|
-
async def rows_query(self, query: str,
|
|
695
|
+
async def rows_query(self, query: str, collection: str, variables: Optional[Dict] = None,
|
|
718
696
|
operation_name: Optional[str] = None, **kwargs: Any):
|
|
719
697
|
"""
|
|
720
698
|
Execute a GraphQL query on stored rows.
|
|
@@ -724,7 +702,6 @@ class AsyncFlowInstance:
|
|
|
724
702
|
|
|
725
703
|
Args:
|
|
726
704
|
query: GraphQL query string
|
|
727
|
-
user: User identifier
|
|
728
705
|
collection: Collection identifier containing rows
|
|
729
706
|
variables: Optional GraphQL query variables
|
|
730
707
|
operation_name: Optional operation name for multi-operation queries
|
|
@@ -750,9 +727,7 @@ class AsyncFlowInstance:
|
|
|
750
727
|
'''
|
|
751
728
|
|
|
752
729
|
result = await flow.rows_query(
|
|
753
|
-
query=query,
|
|
754
|
-
user="trustgraph",
|
|
755
|
-
collection="users",
|
|
730
|
+
query=query,collection="users",
|
|
756
731
|
variables={"status": "active"}
|
|
757
732
|
)
|
|
758
733
|
|
|
@@ -762,7 +737,6 @@ class AsyncFlowInstance:
|
|
|
762
737
|
"""
|
|
763
738
|
request_data = {
|
|
764
739
|
"query": query,
|
|
765
|
-
"user": user,
|
|
766
740
|
"collection": collection
|
|
767
741
|
}
|
|
768
742
|
if variables:
|
|
@@ -774,7 +748,7 @@ class AsyncFlowInstance:
|
|
|
774
748
|
return await self.request("rows", request_data)
|
|
775
749
|
|
|
776
750
|
async def row_embeddings_query(
|
|
777
|
-
self, text: str, schema_name: str,
|
|
751
|
+
self, text: str, schema_name: str,
|
|
778
752
|
collection: str = "default", index_name: Optional[str] = None,
|
|
779
753
|
limit: int = 10, **kwargs: Any
|
|
780
754
|
):
|
|
@@ -788,7 +762,6 @@ class AsyncFlowInstance:
|
|
|
788
762
|
Args:
|
|
789
763
|
text: Query text for semantic search
|
|
790
764
|
schema_name: Schema name to search within
|
|
791
|
-
user: User identifier (default: "trustgraph")
|
|
792
765
|
collection: Collection identifier (default: "default")
|
|
793
766
|
index_name: Optional index name to filter search to specific index
|
|
794
767
|
limit: Maximum number of results to return (default: 10)
|
|
@@ -806,9 +779,7 @@ class AsyncFlowInstance:
|
|
|
806
779
|
# Search for customers by name similarity
|
|
807
780
|
results = await flow.row_embeddings_query(
|
|
808
781
|
text="John Smith",
|
|
809
|
-
schema_name="customers",
|
|
810
|
-
user="trustgraph",
|
|
811
|
-
collection="sales",
|
|
782
|
+
schema_name="customers",collection="sales",
|
|
812
783
|
limit=5
|
|
813
784
|
)
|
|
814
785
|
|
|
@@ -823,7 +794,6 @@ class AsyncFlowInstance:
|
|
|
823
794
|
request_data = {
|
|
824
795
|
"vector": vector,
|
|
825
796
|
"schema_name": schema_name,
|
|
826
|
-
"user": user,
|
|
827
797
|
"collection": collection,
|
|
828
798
|
"limit": limit
|
|
829
799
|
}
|
|
@@ -22,10 +22,14 @@ class AsyncSocketClient:
|
|
|
22
22
|
Or call connect()/aclose() manually.
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
|
-
def __init__(
|
|
25
|
+
def __init__(
|
|
26
|
+
self, url: str, timeout: int, token: Optional[str],
|
|
27
|
+
workspace: str = "default",
|
|
28
|
+
):
|
|
26
29
|
self.url = self._convert_to_ws_url(url)
|
|
27
30
|
self.timeout = timeout
|
|
28
31
|
self.token = token
|
|
32
|
+
self.workspace = workspace
|
|
29
33
|
self._request_counter = 0
|
|
30
34
|
self._socket = None
|
|
31
35
|
self._connect_cm = None
|
|
@@ -117,6 +121,7 @@ class AsyncSocketClient:
|
|
|
117
121
|
try:
|
|
118
122
|
message = {
|
|
119
123
|
"id": request_id,
|
|
124
|
+
"workspace": self.workspace,
|
|
120
125
|
"service": service,
|
|
121
126
|
"request": request
|
|
122
127
|
}
|
|
@@ -149,6 +154,7 @@ class AsyncSocketClient:
|
|
|
149
154
|
try:
|
|
150
155
|
message = {
|
|
151
156
|
"id": request_id,
|
|
157
|
+
"workspace": self.workspace,
|
|
152
158
|
"service": service,
|
|
153
159
|
"request": request
|
|
154
160
|
}
|
|
@@ -251,13 +257,12 @@ class AsyncSocketFlowInstance:
|
|
|
251
257
|
self.client = client
|
|
252
258
|
self.flow_id = flow_id
|
|
253
259
|
|
|
254
|
-
async def agent(self, question: str,
|
|
260
|
+
async def agent(self, question: str, state: Optional[Dict[str, Any]] = None,
|
|
255
261
|
group: Optional[str] = None, history: Optional[list] = None,
|
|
256
262
|
streaming: bool = False, **kwargs) -> Union[Dict[str, Any], AsyncIterator]:
|
|
257
263
|
"""Agent with optional streaming"""
|
|
258
264
|
request = {
|
|
259
265
|
"question": question,
|
|
260
|
-
"user": user,
|
|
261
266
|
"streaming": streaming
|
|
262
267
|
}
|
|
263
268
|
if state is not None:
|
|
@@ -303,13 +308,12 @@ class AsyncSocketFlowInstance:
|
|
|
303
308
|
if isinstance(chunk, RAGChunk):
|
|
304
309
|
yield chunk
|
|
305
310
|
|
|
306
|
-
async def graph_rag(self, query: str,
|
|
311
|
+
async def graph_rag(self, query: str, collection: str,
|
|
307
312
|
max_subgraph_size: int = 1000, max_subgraph_count: int = 5,
|
|
308
313
|
max_entity_distance: int = 3, streaming: bool = False, **kwargs):
|
|
309
314
|
"""Graph RAG with optional streaming"""
|
|
310
315
|
request = {
|
|
311
316
|
"query": query,
|
|
312
|
-
"user": user,
|
|
313
317
|
"collection": collection,
|
|
314
318
|
"max-subgraph-size": max_subgraph_size,
|
|
315
319
|
"max-subgraph-count": max_subgraph_count,
|
|
@@ -330,12 +334,11 @@ class AsyncSocketFlowInstance:
|
|
|
330
334
|
if hasattr(chunk, 'content'):
|
|
331
335
|
yield chunk.content
|
|
332
336
|
|
|
333
|
-
async def document_rag(self, query: str,
|
|
337
|
+
async def document_rag(self, query: str, collection: str,
|
|
334
338
|
doc_limit: int = 10, streaming: bool = False, **kwargs):
|
|
335
339
|
"""Document RAG with optional streaming"""
|
|
336
340
|
request = {
|
|
337
341
|
"query": query,
|
|
338
|
-
"user": user,
|
|
339
342
|
"collection": collection,
|
|
340
343
|
"doc-limit": doc_limit,
|
|
341
344
|
"streaming": streaming
|
|
@@ -375,14 +378,13 @@ class AsyncSocketFlowInstance:
|
|
|
375
378
|
if hasattr(chunk, 'content'):
|
|
376
379
|
yield chunk.content
|
|
377
380
|
|
|
378
|
-
async def graph_embeddings_query(self, text: str,
|
|
381
|
+
async def graph_embeddings_query(self, text: str, collection: str, limit: int = 10, **kwargs):
|
|
379
382
|
"""Query graph embeddings for semantic search"""
|
|
380
383
|
emb_result = await self.embeddings(texts=[text])
|
|
381
384
|
vector = emb_result.get("vectors", [[]])[0]
|
|
382
385
|
|
|
383
386
|
request = {
|
|
384
387
|
"vector": vector,
|
|
385
|
-
"user": user,
|
|
386
388
|
"collection": collection,
|
|
387
389
|
"limit": limit
|
|
388
390
|
}
|
|
@@ -397,7 +399,7 @@ class AsyncSocketFlowInstance:
|
|
|
397
399
|
|
|
398
400
|
return await self.client._send_request("embeddings", self.flow_id, request)
|
|
399
401
|
|
|
400
|
-
async def triples_query(self, s=None, p=None, o=None,
|
|
402
|
+
async def triples_query(self, s=None, p=None, o=None, collection=None, limit=100, **kwargs):
|
|
401
403
|
"""Triple pattern query"""
|
|
402
404
|
request = {"limit": limit}
|
|
403
405
|
if s is not None:
|
|
@@ -406,20 +408,17 @@ class AsyncSocketFlowInstance:
|
|
|
406
408
|
request["p"] = str(p)
|
|
407
409
|
if o is not None:
|
|
408
410
|
request["o"] = str(o)
|
|
409
|
-
if user is not None:
|
|
410
|
-
request["user"] = user
|
|
411
411
|
if collection is not None:
|
|
412
412
|
request["collection"] = collection
|
|
413
413
|
request.update(kwargs)
|
|
414
414
|
|
|
415
415
|
return await self.client._send_request("triples", self.flow_id, request)
|
|
416
416
|
|
|
417
|
-
async def rows_query(self, query: str,
|
|
417
|
+
async def rows_query(self, query: str, collection: str, variables: Optional[Dict] = None,
|
|
418
418
|
operation_name: Optional[str] = None, **kwargs):
|
|
419
419
|
"""GraphQL query against structured rows"""
|
|
420
420
|
request = {
|
|
421
421
|
"query": query,
|
|
422
|
-
"user": user,
|
|
423
422
|
"collection": collection
|
|
424
423
|
}
|
|
425
424
|
if variables:
|
|
@@ -441,7 +440,7 @@ class AsyncSocketFlowInstance:
|
|
|
441
440
|
return await self.client._send_request("mcp-tool", self.flow_id, request)
|
|
442
441
|
|
|
443
442
|
async def row_embeddings_query(
|
|
444
|
-
self, text: str, schema_name: str,
|
|
443
|
+
self, text: str, schema_name: str,
|
|
445
444
|
collection: str = "default", index_name: Optional[str] = None,
|
|
446
445
|
limit: int = 10, **kwargs
|
|
447
446
|
):
|
|
@@ -452,7 +451,6 @@ class AsyncSocketFlowInstance:
|
|
|
452
451
|
request = {
|
|
453
452
|
"vector": vector,
|
|
454
453
|
"schema_name": schema_name,
|
|
455
|
-
"user": user,
|
|
456
454
|
"collection": collection,
|
|
457
455
|
"limit": limit
|
|
458
456
|
}
|
|
@@ -85,7 +85,7 @@ class BulkClient:
|
|
|
85
85
|
Args:
|
|
86
86
|
flow: Flow identifier
|
|
87
87
|
triples: Iterator yielding Triple objects
|
|
88
|
-
metadata: Metadata dict with id, metadata,
|
|
88
|
+
metadata: Metadata dict with id, metadata, collection
|
|
89
89
|
batch_size: Number of triples per batch (default 100)
|
|
90
90
|
**kwargs: Additional parameters (reserved for future use)
|
|
91
91
|
|
|
@@ -105,7 +105,7 @@ class BulkClient:
|
|
|
105
105
|
bulk.import_triples(
|
|
106
106
|
flow="default",
|
|
107
107
|
triples=triple_generator(),
|
|
108
|
-
metadata={"id": "doc1", "metadata": [], "
|
|
108
|
+
metadata={"id": "doc1", "metadata": [], "collection": "default"}
|
|
109
109
|
)
|
|
110
110
|
```
|
|
111
111
|
"""
|
|
@@ -121,7 +121,7 @@ class BulkClient:
|
|
|
121
121
|
ws_url = f"{ws_url}?token={self.token}"
|
|
122
122
|
|
|
123
123
|
if metadata is None:
|
|
124
|
-
metadata = {"id": "", "metadata": [], "
|
|
124
|
+
metadata = {"id": "", "metadata": [], "collection": "default"}
|
|
125
125
|
|
|
126
126
|
async with websockets.connect(ws_url, ping_interval=20, ping_timeout=self.timeout) as websocket:
|
|
127
127
|
batch = []
|
|
@@ -418,7 +418,7 @@ class BulkClient:
|
|
|
418
418
|
Args:
|
|
419
419
|
flow: Flow identifier
|
|
420
420
|
contexts: Iterator yielding context dictionaries
|
|
421
|
-
metadata: Metadata dict with id, metadata,
|
|
421
|
+
metadata: Metadata dict with id, metadata, collection
|
|
422
422
|
batch_size: Number of contexts per batch (default 100)
|
|
423
423
|
**kwargs: Additional parameters (reserved for future use)
|
|
424
424
|
|
|
@@ -435,7 +435,7 @@ class BulkClient:
|
|
|
435
435
|
bulk.import_entity_contexts(
|
|
436
436
|
flow="default",
|
|
437
437
|
contexts=context_generator(),
|
|
438
|
-
metadata={"id": "doc1", "metadata": [], "
|
|
438
|
+
metadata={"id": "doc1", "metadata": [], "collection": "default"}
|
|
439
439
|
)
|
|
440
440
|
```
|
|
441
441
|
"""
|
|
@@ -451,7 +451,7 @@ class BulkClient:
|
|
|
451
451
|
ws_url = f"{ws_url}?token={self.token}"
|
|
452
452
|
|
|
453
453
|
if metadata is None:
|
|
454
|
-
metadata = {"id": "", "metadata": [], "
|
|
454
|
+
metadata = {"id": "", "metadata": [], "collection": "default"}
|
|
455
455
|
|
|
456
456
|
async with websockets.connect(ws_url, ping_interval=20, ping_timeout=self.timeout) as websocket:
|
|
457
457
|
batch = []
|