docs_catalog
¶
Finding things in the docs that ship with the package, for the docs agent SensAI answers "how do I use Mojo" with.
The pages are every .md file under docs/ of the docs source that ships in the package (DOCS_SOURCE_DIR): the user guides, the command line reference, the changelog and the rest. Each is known by its path under docs/, and is read as plain markdown (utils/docs_text.py removes the site's markup). This splits each at its headings into sections, and ranks sections against a question by word (BM25, with the words of a heading counting for more). There are no embeddings and nothing is downloaded, so it works offline and gives the same ranking every time.
SITE_URL
module-attribute
¶
Where the docs site is, which the docs links are built on.
STOP_WORDS
module-attribute
¶
Words too common to say what a question is about, which a search leaves out.
Section
¶
Bases: BaseModel
The part of a page under one heading, up to the next heading of any level.
DocsPage
¶
Bases: BaseModel
One bundled page of the docs.
-
Reference
mujoco_mojoutilslayersdojosensaidocs_catalogdocs_pages
Hit
¶
Bases: BaseModel
A section that matched a search, with the line that matched best.
-
Reference
mujoco_mojoutilslayersdojosensaidocs_catalogsearch_docs
slugify
¶
The anchor the docs site gives a heading: lowercase words joined by hyphens.
Source code in src/mujoco_mojo/utils/layers/dojo/sensai/docs_catalog.py
| Python | |
|---|---|
docs_url
¶
The docs site address of the page at path (under docs/): user-guides/workflow/x.md is at user-guides/workflow/x/, and an index.md is the address of its folder.
Source code in src/mujoco_mojo/utils/layers/dojo/sensai/docs_catalog.py
docs_pages
cached
¶
docs_pages(
directory: Path = DOCS_SOURCE_DIR,
) -> tuple[DocsPage, ...]
Every page of the docs source in directory, in path order.
Source code in src/mujoco_mojo/utils/layers/dojo/sensai/docs_catalog.py
table_of_contents
¶
table_of_contents(directory: Path = DOCS_SOURCE_DIR) -> str
One line per page, its path and title, for the agent's instructions.
Source code in src/mujoco_mojo/utils/layers/dojo/sensai/docs_catalog.py
search_docs
¶
The sections that best answer query, best first, at most two from any one page. Empty when no word of the query is in the docs.
Source code in src/mujoco_mojo/utils/layers/dojo/sensai/docs_catalog.py
read_docs
¶
read_docs(
path: str,
section: str = "",
limit: int = _READ_LIMIT,
directory: Path = DOCS_SOURCE_DIR,
) -> str
A page, or one section of it, with its title and docs site link on top.
A page longer than limit characters is cut there with a note listing its sections, so a reader can ask for one. A path or section that is not there is answered with what is, not an error.