> ## Documentation Index
> Fetch the complete documentation index at: https://docs.moorcheh.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Python client overview

> moorcheh-edge Python SDK and HTTP client.

## Install

```bash theme={null}
pip install moorcheh-edge
```

## Two ways to use the package

| Approach                    | When to use                                               |
| --------------------------- | --------------------------------------------------------- |
| **`MoorchehEdge` SDK**      | Start Docker + call API from Python (embeds text locally) |
| **`MoorchehEdgeApiClient`** | Talk to an already running server (raw HTTP)              |

## SDK example (text store)

```python theme={null}
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"])
```

## HTTP client example

```python theme={null}
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}))
```

## Errors

Failed API calls raise `MoorchehEdgeApiError` with:

* `status_code`
* `message`
* `body` - parsed JSON from the server when available

```python theme={null}
from moorcheh_edge import MoorchehEdgeApiError

try:
    client.upload({"store_mode": "vector", "items": [...]})
except MoorchehEdgeApiError as exc:
    if exc.is_item_limit_exceeded:
        print(exc.body)
```

## Related

* [Getting started](/python-client/getting-started)
* [answer\_text()](/python-client/answer)
* [answer\_stream()](/python-client/answer-stream)
* [CLI overview](/cli/introduction)
