unsloth/studio/backend/core/rag
Daniel Han 0ea727a0b2
Studio RAG: disable trust_env on loopback llama-server httpx clients (#6775)
* Studio RAG: disable trust_env on loopback llama-server httpx clients

The RAG embedder health probe (embed_llama_server.py), its pooled httpx.Client, and the vision captioner (captioner.py) call the local 127.0.0.1 llama-server with httpx's default trust_env=True, so an ambient HTTP(S)_PROXY that returns 503 for loopback breaks embedder startup and captioning. Set trust_env=False on these loopback clients, matching the existing fix on the main llama_cpp and inference clients. External provider calls are untouched.

Follow-up to the loopback trust_env fix; covers the remaining local llama-server clients in the RAG path.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Studio RAG tests: accept trust_env kwarg in captioner httpx.post mocks

The loopback captioner now passes trust_env=False; update the _vision_complete
fake_post stubs to accept it and assert it is False.

* Trim comments in Studio RAG trust_env fix (comment-only)

* RAG trust_env test: explicit UTF-8 read + scan all package .py files

Addresses review: utf-8 open avoids a Windows decode error, and scanning every
.py in core/rag catches any future file that adds an httpx call.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-07-01 03:58:08 -07:00
..
__init__.py Studio: clean-room compact RAG (knowledge bases, hybrid search, fast indexing) (#5910) 2026-06-09 21:17:04 -07:00
captioner.py Studio RAG: disable trust_env on loopback llama-server httpx clients (#6775) 2026-07-01 03:58:08 -07:00
chunking.py Studio: clean-room compact RAG (knowledge bases, hybrid search, fast indexing) (#5910) 2026-06-09 21:17:04 -07:00
config.py Whole-document context for RAG chat attachments (#6693) 2026-06-30 15:55:23 +02:00
embed_llama_server.py Studio RAG: disable trust_env on loopback llama-server httpx clients (#6775) 2026-07-01 03:58:08 -07:00
embeddings.py studio: tighten torchao Windows-ROCm comments and test docstrings (#6610) 2026-06-23 05:49:25 -07:00
ingestion.py Whole-document context for RAG chat attachments (#6693) 2026-06-30 15:55:23 +02:00
locators.py Whole-document context for RAG chat attachments (#6693) 2026-06-30 15:55:23 +02:00
parsers.py Whole-document context for RAG chat attachments (#6693) 2026-06-30 15:55:23 +02:00
retrieval.py Studio: project sources backed by RAG (#6205) 2026-06-12 15:42:51 +02:00
store.py Whole-document context for RAG chat attachments (#6693) 2026-06-30 15:55:23 +02:00
tool.py Whole-document context for RAG chat attachments (#6693) 2026-06-30 15:55:23 +02:00