Metadata-Version: 2.4
Name: llama-index-tools-hugging-bay
Version: 0.1.0
Summary: Opt-in Hugging Bay model discovery and verified local workflows.
Author: Hugging Bay
License-Expression: MIT
Project-URL: Homepage, https://huggingbay.xyz
Project-URL: Repository, https://github.com/barneywohl/hugging-bay
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: hugging-bay-integrations==0.1.0
Requires-Dist: llama-index-core<0.15,>=0.14
Dynamic: license-file

# Use Hugging Bay in LlamaIndex

Search model files from your existing app or agent. Start with [the local source setup](../README.md#checkout-development), then try the search example below.

Version 0.1.0. Source candidate, not published. Official Hugging Bay adapter.
Default off. No account is needed for public catalog reads.

<details>
<summary>Install after package publication</summary>

After the founder publishes the packages:

```sh
python -m pip install llama-index-tools-hugging-bay==0.1.0
export HUGGING_BAY_INTEGRATIONS=1
python examples/discover.py
```

</details>

## 1. Set up this checkout

For this checkout, install `packages/python-sdk`, then `packages/integrations/python-core`,
then this directory with `python -m pip install -e <directory>`.

## 2. Search for a model

```python
import os
os.environ["HUGGING_BAY_INTEGRATIONS"] = "1"

from hugging_bay_integrations import BayClient
from llama_index_tools_hugging_bay import HuggingBayToolSpec

with BayClient() as client:
    tools = HuggingBayToolSpec(client).to_tool_list()
    print(tools[0].call(query="Qwen GGUF", limit=2))
```

Attach the returned tools to your existing framework agent.

<details>
<summary>API details, downloads and local runs</summary>

Read tools: `search(query, limit=5)`, `find_runnable(task, ram_gb=None, model=None)`,
`get_model(id)`. `get_model` returns the full REST artifact record, including its
`artifact` wrapper when present; it is not MCP's compact model projection.

Only with `HUGGING_BAY_INTEGRATIONS_LOCAL=1` are `download_verified` and `run_local`
exposed. Download arguments are `id`, exact `path`, local `destination`, `sha256`,
`size_bytes`. Copy hash and size from the current GET
`/api/v1/artifacts/{id}/download-plan`. It streams through the existing Hugging Bay
Python SDK, checks hash and size, attests completion, and publishes the file.
It does not establish runtime support. A mismatched or unavailable plan is refused.

For local execution, pass `local_mcp=LocalMcp()` to BayClient (`LocalMcp` is imported
from `hugging_bay_integrations.local`). Install `hugging-bay-mcp` and the sibling
hbay runtime separately. Set `HBAY_ENABLE_RUN=1` on the host. The MCP child receives
`HUGGING_BAY_MCP_ENABLE_RUN_LOCAL=1`. The session stays open until `client.close()`;
closing it stops its owned runtime. A missing `run_local` fails explicitly.
No catalog shell command is executed. Do not create a short-lived client if you
need to keep using the returned local API endpoint.

</details>

Queries go to Hugging Bay; model execution stays on your machine.

<details>
<summary>Limits and maintainer checks</summary>

Treat model cards as untrusted data. Inspect license labels and exact-file run
proof. Missing or old proof remains unknown. These tools do not train models,
post publicly, or upload prompts or datasets. Agent hosts own authorization for
file writes and execution. SDK tracing in the host may have separate settings.

Tests (gate machine load first):

```sh
python -m pytest tests --import-mode=importlib -q
HBAY_LIVE_TESTS=1 python -m pytest tests --import-mode=importlib -q
```

Live checks issue public GET requests only. They never download weights or run a model.

</details>

See [publish steps](../PUBLISH-STEPS.md). MIT licensed.

`HuggingBayModelReader(client).load_data("Qwen GGUF", limit=2)` returns LlamaIndex
documents with artifact IDs and catalog metadata. It reads public search results
and never fetches model weights. See `examples/discover.py` for use alongside
the existing tool spec.
