Install
Two ways to use the package
SDK example (text store)
HTTP client example
Errors
Failed API calls raiseMoorchehEdgeApiError with:
status_codemessagebody- parsed JSON from the server when available
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
moorcheh-edge Python SDK and HTTP client.
pip install moorcheh-edge
| Approach | When to use |
|---|---|
MoorchehEdge SDK | Start Docker + call API from Python (embeds text locally) |
MoorchehEdgeApiClient | Talk to an already running server (raw HTTP) |
from moorcheh_edge import MoorchehEdge
with MoorchehEdge(port=8080) as edge:
print(edge.health())
edge.upload_documents([{"id": "doc-1", "text": "Hello world"}])
for hit in edge.search_text("Hello world", top_k=5):
print(hit["id"], hit["score"])
result = edge.answer_text("Who won the football match?", top_k=5)
print(result["answer"])
from moorcheh_edge import MoorchehEdgeApiClient
client = MoorchehEdgeApiClient("http://localhost:8080")
print(client.health())
client.upload({
"store_mode": "vector",
"items": [{"id": "a", "vector": [...]}],
})
print(client.search({"query": [...], "top_k": 5}))
MoorchehEdgeApiError with:
status_codemessagebody - parsed JSON from the server when availablefrom moorcheh_edge import MoorchehEdgeApiError
try:
client.upload({"store_mode": "vector", "items": [...]})
except MoorchehEdgeApiError as exc:
if exc.is_item_limit_exceeded:
print(exc.body)
Was this page helpful?