Install & Compatibility
Where this runs
tested against v1.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
build_error
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 2.1s · import 0.000s · 38MB
36MB installed
● package 36MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
GraphLanguageModel
✓ import deepsearch_glm
✗ from deepsearch_glm import GraphLanguageModel
This quickstart demonstrates how to load a GraphLanguageModel and query it with a simple document. It highlights the main components and interactions within `deepsearch-glm`. Note that the first run will download a large language model.
import os
from deepsearch.glm.core.glm import GraphLanguageModel
from deepsearch.glm.queries import GlmQuery
from deepsearch.documents.core.models import Document
# Note: The deepsearch-glm-base model is large (~1.5GB) and will be downloaded on first run.
# This example requires deepsearch-toolkit to implicitly process documents into a graph.
try:
# 1. Initialize the GraphLanguageModel (this will download a model if not cached)
# This might take a while and uses significant memory/disk space.
print("Loading GraphLanguageModel... (first run may download ~1.5GB model)")
glm_model = GraphLanguageModel.from_pretrained("deepsearch-ai/deepsearch-glm-base")
print("GraphLanguageModel loaded.")
# 2. Prepare a dummy document. In a real scenario, this would be processed
# by deepsearch-toolkit to extract a knowledge graph before querying.
doc_content = "The DeepSearch AI platform helps enterprises extract insights from unstructured data using advanced AI."
dummy_document = Document(name="deepsearch_info.txt", content=doc_content)
# 3. Create a query
question = "What is the DeepSearch AI platform used for?"
query = GlmQuery(
model=glm_model,
documents=[dummy_document], # Provide documents directly for implicit graph creation
query_text=question
)
# 4. Run the query
print(f"\nQuerying: {question}")
result = query.run()
# 5. Print the result
print("\nQuery Result:")
print(result.answer)
except ImportError as e:
print(f"Error: {e}. Ensure all core and optional dependencies (like 'transformers', 'torch' or 'tensorflow') are installed.")
print("Try: pip install deepsearch-glm[all]")
except Exception as e:
print(f"An error occurred during execution: {e}")
print("Common issues include insufficient disk space, network problems during model download, or missing ML backend (torch/tensorflow).")
Upgrade
Version history
1.0.0latest on PyPI · released Dec 9, 2024
Audit
Dependencies
deepsearch-toolkitrequiredCore dependency for graph processing and document models.
transformersrequiredRequired for underlying Large Language Model functionality.
torchoptionalMachine learning backend for `transformers`. Either PyTorch or TensorFlow is typically required.
tensorflowoptionalMachine learning backend for `transformers`. Either PyTorch or TensorFlow is typically required.