revit-api-docs 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- revit_api_docs-0.2.0/CHANGELOG.md +152 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/PKG-INFO +71 -6
- revit_api_docs-0.2.0/README.md +170 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pyproject.toml +1 -1
- revit_api_docs-0.2.0/revit_api_docs/bm25.py +239 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/config.py +26 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/data.py +36 -5
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/default_config.yaml +14 -2
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/embedder/providers/google.py +2 -1
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/embedder/providers/openai.py +4 -1
- revit_api_docs-0.2.0/revit_api_docs/environment.py +277 -0
- revit_api_docs-0.2.0/revit_api_docs/environment.yaml +306 -0
- revit_api_docs-0.2.0/revit_api_docs/reranker.py +558 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/retriever.py +229 -38
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/server.py +167 -13
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/tests/conftest.py +75 -0
- revit_api_docs-0.2.0/tests/fixtures/retrieval_queries.yaml +614 -0
- revit_api_docs-0.2.0/tests/fixtures/retrieval_queries_v2.yaml +633 -0
- revit_api_docs-0.2.0/tests/test_bm25_index.py +283 -0
- revit_api_docs-0.2.0/tests/test_bm25_recall.py +136 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/tests/test_data.py +50 -0
- revit_api_docs-0.2.0/tests/test_environment.py +177 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/tests/test_package.py +1 -0
- revit_api_docs-0.2.0/tests/test_rerank.py +567 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/tests/test_retriever.py +56 -6
- revit_api_docs-0.2.0/tests/test_server.py +338 -0
- revit_api_docs-0.2.0/tests/test_shipped_db.py +82 -0
- revit_api_docs-0.1.0/CHANGELOG.md +0 -32
- revit_api_docs-0.1.0/README.md +0 -105
- revit_api_docs-0.1.0/revit_api_docs/reranker.py +0 -177
- revit_api_docs-0.1.0/tests/test_server.py +0 -151
- revit_api_docs-0.1.0/tests/test_shipped_db.py +0 -75
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/.gitignore +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/LICENSE +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/__init__.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/api_parser/__init__.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/api_parser/parse_chm.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/api_parser/quality_agent.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/demo_dual_store.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/demo_production_real.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/demo_real_golden.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/demo_real_scoring.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/demo_scoring.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/demo_sdk_cleaning.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/embedder/__init__.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/embedder/embed.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/knowledge_builder/__init__.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/run_all.ipynb +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/sdk_parser/__init__.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/sdk_parser/extract.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/pipeline/sdk_parser/quality_agent.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/__init__.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/__main__.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/embedder/__init__.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/embedder/providers/__init__.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/embedder/providers/base.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/llm_client.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/__init__.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/loader.py +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.api_quality_stage1_no_html.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.api_quality_stage1_system.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.api_quality_stage1_with_html.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.api_quality_stage2.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.api_quality_stage2_system.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.rewrite_query.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.rewrite_query_system.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.sdk_extract_readme_system.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.sdk_extract_readme_user.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.sdk_golden_code.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.sdk_golden_code_system.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.sdk_quality_file_batch.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.sdk_quality_file_system.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.sdk_quality_project.md +0 -0
- {revit_api_docs-0.1.0 → revit_api_docs-0.2.0}/revit_api_docs/prompts/pipeline.sdk_quality_project_system.md +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
|
|
5
|
+
[Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.2.0] - 2026-10-26
|
|
10
|
+
|
|
11
|
+
Better candidates without any key, and an opt-in relevance check: BM25 keyword
|
|
12
|
+
search over an SQLite FTS5 index, optional Jev reranking with a calibrated
|
|
13
|
+
relevance per entry and abstention, a streamable HTTP transport, and curated
|
|
14
|
+
development-environment notes.
|
|
15
|
+
|
|
16
|
+
**Upgrading from 0.1.0** (`uvx --refresh revit-api-docs`): the first search
|
|
17
|
+
builds `sqlite/revit_api_fts.db` (an FTS5 index, 11.8 MB) next to the data set
|
|
18
|
+
in under a second. `search_revit_api` output starts with `Rerank: <reranker>;
|
|
19
|
+
data set: Revit 2026`. Abstention is new and opt-in:
|
|
20
|
+
`REVIT_API_DOCS_MIN_RELEVANCE` (Jev only) only decides whether to abstain and
|
|
21
|
+
drops no entry; the abstention line does not claim that the member is missing.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Jev rerank provider (TypeSafe System One, `POST https://api.typesafe.ai/v1/systemone`,
|
|
26
|
+
one `noul` question per candidate): `REVIT_API_DOCS_RERANK_PROVIDER=jev` with
|
|
27
|
+
`TYPESAFE_API_KEY`. Up to 30 candidates per request, 2 requests in flight,
|
|
28
|
+
2 retries with backoff on 429/529/5xx/timeouts, 20 s timeout. A failed or
|
|
29
|
+
unconfigured Jev call falls back to Cohere (when `COHERE_API_KEY` is set) or
|
|
30
|
+
to no reranking.
|
|
31
|
+
- `search_revit_api` output starts with the reranker that ran
|
|
32
|
+
(`Rerank: jev | cohere | none`, plus `(unavailable: jev)` after a fallback);
|
|
33
|
+
Jev-ranked entries carry `Relevance: 0.00-1.00`.
|
|
34
|
+
- Abstention: with Jev and `REVIT_API_DOCS_MIN_RELEVANCE`, when no entry
|
|
35
|
+
reaches the threshold the output starts with "No entry in the Revit 2026
|
|
36
|
+
data set scored high enough for this query (best relevance x < y)" followed
|
|
37
|
+
by the low-scoring candidates. Other providers never abstain.
|
|
38
|
+
- Streamable HTTP transport: `revit-api-docs serve --transport http --host
|
|
39
|
+
127.0.0.1 --port 8765` (endpoint `/mcp`); stdio remains the default. A
|
|
40
|
+
non-loopback `--host` logs a warning: there is no built-in authentication.
|
|
41
|
+
- Development-environment notes: a curated English corpus shipped with the
|
|
42
|
+
package (`environment.yaml`: target framework, SDK, manifest, reference
|
|
43
|
+
packages for Revit 2024-2027, each with a release range and a source URL),
|
|
44
|
+
matched by keywords. `search_revit_api` appends up to five matching notes,
|
|
45
|
+
also while the data set is still downloading and without any key;
|
|
46
|
+
`revit-api-docs environment [query] [--revit 2027]` prints them. The
|
|
47
|
+
`jev-data-handling` note points at TypeSafe's data processing terms.
|
|
48
|
+
- Retrieval regression fixture `tests/fixtures/retrieval_queries.yaml`: 60
|
|
49
|
+
English queries with verified gold rows in the v1.0-data reference (50
|
|
50
|
+
answerable, 10 not). `tests/test_bm25_recall.py` runs them against the
|
|
51
|
+
shipped data set when it is installed: gold in the BM25 top 30 for at least
|
|
52
|
+
44 of 50 (measured 45), hit@5 at least 36 of 50 (measured 38), and a
|
|
53
|
+
non-empty candidate list for every unanswerable query. No network.
|
|
54
|
+
- A second regression fixture, `tests/fixtures/retrieval_queries_v2.yaml`: 60
|
|
55
|
+
more English queries (40 answerable, 20 not, 9 of those next to a real API,
|
|
56
|
+
such as a class name used as a member or a misspelling), none shared with
|
|
57
|
+
the first set. `tests/test_bm25_recall.py` runs both sets;
|
|
58
|
+
for this one: gold in the BM25 top 30 for at least 33 of 40 (measured 34),
|
|
59
|
+
hit@5 at least 25 of 40 (measured 27), and candidates for at least 19 of the
|
|
60
|
+
20 unanswerable queries (measured 19).
|
|
61
|
+
- `close()` on the rerank providers releases their HTTP client.
|
|
62
|
+
- README: when to turn on Jev (`REVIT_API_DOCS_RERANK_PROVIDER=jev` with a
|
|
63
|
+
TypeSafe key; nDCG@5 0.675 -> 0.871 on the test queries, about $0.23 per
|
|
64
|
+
1,000 queries), what a `REVIT_API_DOCS_MIN_RELEVANCE` of 0.15 filters and
|
|
65
|
+
what it does not, and why not 0.5. Defaults are unchanged.
|
|
66
|
+
|
|
67
|
+
### Changed
|
|
68
|
+
|
|
69
|
+
- The `Rerank:` line also names the data set the entries come from: `Rerank:
|
|
70
|
+
<provider>[ (unavailable: ...)]; data set: Revit <version>`, the version
|
|
71
|
+
taken from the configuration (`revit_version`, 2026 for the v1.0-data
|
|
72
|
+
release). It stays the first line, or the second after an abstention line,
|
|
73
|
+
so an answer can cite the data set version next to a result; the tool
|
|
74
|
+
description and the server instructions say so. The `Rerank:` prefix is
|
|
75
|
+
unchanged.
|
|
76
|
+
- `REVIT_API_DOCS_MIN_RELEVANCE` only decides whether to abstain. When at
|
|
77
|
+
least one entry reaches it, the entries below it are no longer dropped:
|
|
78
|
+
every reranked entry comes back (up to `top_k`) with its `Relevance`, so a
|
|
79
|
+
correct entry scored just under the threshold stays in the list. Abstention
|
|
80
|
+
itself, and the output format, are unchanged.
|
|
81
|
+
- README and the `jev-rerank-provider` environment note describe the
|
|
82
|
+
threshold as a relevance filter: at 0.15 it filters out clearly unrelated
|
|
83
|
+
queries (not about Revit, types the data set does not have) and abstains
|
|
84
|
+
on about 2.5% of the queries that have an answer, but it cannot spot a
|
|
85
|
+
misspelt or misplaced member name, for which the closest real API usually
|
|
86
|
+
comes first and a compile check decides. "No entry scored high enough" is
|
|
87
|
+
described as "nothing relevant, or worded differently", not as "the member
|
|
88
|
+
does not exist"; the README no longer says the value is being validated.
|
|
89
|
+
- The rerank HTTP clients (Jev and Cohere) keep idle connections open for 5
|
|
90
|
+
minutes (`keepalive_expiry=300`; httpx closes them after 5 s), so a query
|
|
91
|
+
after a pause can reuse the connection instead of setting up TLS again.
|
|
92
|
+
The other connection limits stay at httpx's defaults.
|
|
93
|
+
- Keyword search over the API reference ranks with BM25 on an SQLite FTS5
|
|
94
|
+
index instead of LIKE substring scoring. The index is a separate file,
|
|
95
|
+
`sqlite/revit_api_fts.db` next to `revit_api.db` (which is never written),
|
|
96
|
+
built on first use in under a second and rebuilt when the source database's
|
|
97
|
+
SHA-256 or the index format changes; the installer neither downloads nor
|
|
98
|
+
flags it. Identifiers also match by their camel-case parts, so misspelt or
|
|
99
|
+
unknown names (`FiltredElementColector`) get candidates instead of "No API
|
|
100
|
+
entries found". Without vector search the keyword search now hands the
|
|
101
|
+
reranker `retrieval.api.top_k` (30) candidates instead of the requested
|
|
102
|
+
count; with vector search it adds the requested count, as before. A Python
|
|
103
|
+
whose sqlite3 lacks FTS5 keeps the LIKE scorer and logs one warning.
|
|
104
|
+
- The Jev and Cohere rerank providers keep one HTTP client per instance, and
|
|
105
|
+
with it the open connection, instead of building one per call. Against the
|
|
106
|
+
hosted Jev API a Jev-reranked `search_revit_api` call took about 2.1 s
|
|
107
|
+
before (10 candidates); now the first call of a process takes about 2.3 s
|
|
108
|
+
and later ones about 0.4 s (30 candidates).
|
|
109
|
+
- The abstention line no longer claims the class or member may not exist: it
|
|
110
|
+
says that no entry scored high enough and that either the member is absent
|
|
111
|
+
from this version or the data set has it under a different name or wording.
|
|
112
|
+
The tool description and server instructions say the same. A low best score
|
|
113
|
+
cannot tell a missing member from one the candidate search did not bring up.
|
|
114
|
+
- The embedding providers look up their API key before importing the SDK, so
|
|
115
|
+
keyword-only runs (no key) no longer import `openai`; `search` starts about
|
|
116
|
+
2 s faster.
|
|
117
|
+
- `search` and `download` log plain `logger: message` lines to stderr at
|
|
118
|
+
WARNING (`-v` for INFO), with `httpx` request lines hidden; the MCP server's
|
|
119
|
+
logging is unchanged. The index/content mismatch of the shipped data set is
|
|
120
|
+
logged at INFO instead of WARNING.
|
|
121
|
+
- Download progress: on a terminal the line is redrawn in place; in host logs
|
|
122
|
+
and pipes one line per 10% instead of one per second.
|
|
123
|
+
- Tool descriptions and the server instructions state that queries are English
|
|
124
|
+
only.
|
|
125
|
+
- The Cohere reranker shares a provider interface with Jev; its requests and
|
|
126
|
+
its fall-back-to-input-order behaviour are unchanged.
|
|
127
|
+
|
|
128
|
+
## [0.1.0] - 2026-09-20
|
|
129
|
+
|
|
130
|
+
First release, split out of the `revit-api-rag` repository (working-tree copy,
|
|
131
|
+
no git history).
|
|
132
|
+
|
|
133
|
+
### Added
|
|
134
|
+
|
|
135
|
+
- MCP server `revit-api-docs` (stdio) with two read-only tools:
|
|
136
|
+
`search_revit_api(query, top_k)` and `get_code_examples(query, top_k)`.
|
|
137
|
+
- Data set as GitHub Release `v1.0-data` (Revit 2026 API reference SQLite,
|
|
138
|
+
SDK samples SQLite, two ChromaDB indexes); downloaded on first run into the
|
|
139
|
+
per-user data directory, SHA-256 verified, resumable. `REVIT_API_DOCS_DATA_DIR`
|
|
140
|
+
overrides the location; `revit-api-docs download` prefetches.
|
|
141
|
+
- Keyword search over SQLite works with no API key; an OpenAI-compatible
|
|
142
|
+
embedding key adds vector search, `COHERE_API_KEY` adds reranking. Embedding
|
|
143
|
+
or rerank failures fall back to keyword search instead of erroring.
|
|
144
|
+
- CLI: `serve` (default), `download`, `search <query> [--examples] [--top-k]`.
|
|
145
|
+
- Offline data pipeline (`pipeline/`, `uv sync --extra pipeline`) from the old
|
|
146
|
+
repository, importing the package's shared retriever, LLM client and prompts.
|
|
147
|
+
- CI (tests + build on Linux/Windows, Python 3.11/3.13) and PyPI Trusted
|
|
148
|
+
Publishing on version tags.
|
|
149
|
+
|
|
150
|
+
[Unreleased]: https://github.com/revitbridge/revit-api-docs/compare/v0.2.0...HEAD
|
|
151
|
+
[0.2.0]: https://github.com/revitbridge/revit-api-docs/compare/v0.1.0...v0.2.0
|
|
152
|
+
[0.1.0]: https://github.com/revitbridge/revit-api-docs/releases/tag/v0.1.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: revit-api-docs
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Revit API reference search for MCP hosts: local semantic + keyword lookup over the Revit 2026 API docs and SDK samples
|
|
5
5
|
Project-URL: Homepage, https://github.com/revitbridge/revit-api-docs
|
|
6
6
|
Project-URL: Issues, https://github.com/revitbridge/revit-api-docs/issues
|
|
@@ -43,6 +43,10 @@ your model already writes correct Revit code, you do not need it;
|
|
|
43
43
|
[revit-bridge](https://github.com/revitbridge/revit-bridge) works without it.
|
|
44
44
|
It never talks to Revit and it never calls a model itself.
|
|
45
45
|
|
|
46
|
+
Queries are **English only**: the corpus is the English API reference. A host
|
|
47
|
+
model that talks to its user in another language rewrites the request into
|
|
48
|
+
English API names or English task keywords before calling a tool.
|
|
49
|
+
|
|
46
50
|
## Install
|
|
47
51
|
|
|
48
52
|
Prerequisites: Python 3.11+ with [`uv`](https://docs.astral.sh/uv/) (for
|
|
@@ -69,6 +73,30 @@ claude mcp add revit-api-docs -- uvx revit-api-docs
|
|
|
69
73
|
|
|
70
74
|
**Any MCP client** — run `uvx revit-api-docs` as a stdio server.
|
|
71
75
|
|
|
76
|
+
**Any MCP client over HTTP** — run the server with the MCP streamable HTTP
|
|
77
|
+
transport and point the client at `/mcp`:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
uvx revit-api-docs serve --transport http --host 127.0.0.1 --port 8765
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"mcpServers": {
|
|
86
|
+
"revit-api-docs": {
|
|
87
|
+
"type": "http",
|
|
88
|
+
"url": "http://127.0.0.1:8765/mcp"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
(Claude Code: `claude mcp add --transport http revit-api-docs http://127.0.0.1:8765/mcp`.)
|
|
95
|
+
stdio stays the default. The HTTP transport has no built-in authentication:
|
|
96
|
+
keep it on a loopback address, or put it behind a reverse proxy that
|
|
97
|
+
authenticates; the server logs a warning when `--host` is not a loopback
|
|
98
|
+
address.
|
|
99
|
+
|
|
72
100
|
On the first start the server downloads the data set (335 MB, four files) from
|
|
73
101
|
this repository's [`v1.0-data` release](https://github.com/revitbridge/revit-api-docs/releases/tag/v1.0-data)
|
|
74
102
|
into `%LOCALAPPDATA%\revit-api-docs` (Windows) or `~/.local/share/revit-api-docs`
|
|
@@ -89,21 +117,35 @@ Two tools, both read-only:
|
|
|
89
117
|
- `search_revit_api(query, top_k=10)` — API entries with signature, parameters
|
|
90
118
|
and remarks. Query with an API name (`Wall.Create`,
|
|
91
119
|
`FilteredElementCollector OfCategory`) or a short task (`create floor from
|
|
92
|
-
boundary`).
|
|
120
|
+
boundary`). The first line names the reranker that ordered the entries
|
|
121
|
+
(`jev`, `cohere` or `none`) and the data set they come from, for example
|
|
122
|
+
`Rerank: none; data set: Revit 2026`; after an abstention line it is the
|
|
123
|
+
second line. Development-environment questions (`target framework for
|
|
124
|
+
Revit 2027 add-in`) also get up to five curated environment notes
|
|
125
|
+
(framework, SDK, manifest, reference packages per Revit release, each with
|
|
126
|
+
its source); these ship with the package and work before the data set is
|
|
127
|
+
installed and without any key.
|
|
93
128
|
- `get_code_examples(query, top_k=3)` — C# from the SDK samples that use the
|
|
94
129
|
matching APIs, with the project name and the APIs each sample touches.
|
|
95
130
|
|
|
96
131
|
Without any API key the server answers from keyword search over the SQLite
|
|
97
|
-
reference
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
132
|
+
reference: BM25 over a full-text index of entry names, IDs, summaries and
|
|
133
|
+
signatures, where identifiers also match by their camel-case parts, so a
|
|
134
|
+
misspelt or unknown name still gets candidates. The index (11.8 MB) is built
|
|
135
|
+
next to the data set on first use (under a second). With an embedding key it
|
|
136
|
+
adds semantic search over the vector store, and with a Cohere key it reranks
|
|
137
|
+
the merged candidates; with a TypeSafe key it can rerank with Jev instead, which
|
|
138
|
+
returns a calibrated relevance per entry. With a threshold set and no entry
|
|
139
|
+
reaching it, the output starts with an abstention line and then lists the
|
|
140
|
+
candidates with their relevance, for reference. See Configure.
|
|
101
141
|
|
|
102
142
|
Try it from a terminal (installs the data set if needed):
|
|
103
143
|
|
|
104
144
|
```bash
|
|
105
145
|
uvx revit-api-docs search "Wall.Create"
|
|
106
146
|
uvx revit-api-docs search "rotate element around axis" --examples
|
|
147
|
+
uvx revit-api-docs environment --revit 2027 # environment notes, no data set needed
|
|
148
|
+
uvx revit-api-docs environment "target framework" # notes a query matches
|
|
107
149
|
```
|
|
108
150
|
|
|
109
151
|
## Configure
|
|
@@ -117,11 +159,34 @@ All settings are environment variables; there is no config file to edit.
|
|
|
117
159
|
| `REVIT_API_DOCS_EMBEDDING_BASE_URL` | `https://openrouter.ai/api/v1` | Any OpenAI-compatible `/embeddings` endpoint |
|
|
118
160
|
| `REVIT_API_DOCS_EMBEDDING_MODEL` | `openai/text-embedding-3-large` | Must produce the same 3072-dimensional space the shipped vectors were built with (`text-embedding-3-large`); another model makes vector search return noise |
|
|
119
161
|
| `COHERE_API_KEY` | *(unset)* | Enables reranking with Cohere `rerank-v3.5` (native REST API) |
|
|
162
|
+
| `REVIT_API_DOCS_RERANK_PROVIDER` | `cohere` | `cohere`, `jev` or `none`. With `jev`, a failed or unconfigured Jev call falls back to Cohere when `COHERE_API_KEY` is set, otherwise to no reranking; the first output line says which one ran |
|
|
163
|
+
| `TYPESAFE_API_KEY` | *(unset)* | Key for TypeSafe System One (Jev), used when the provider is `jev`. At most 30 candidates per request, 2 requests in flight, 2 retries, 20 s timeout |
|
|
164
|
+
| `REVIT_API_DOCS_JEV_MODEL` | `jev-latest` | Jev model or alias; pin a version such as `jev-1.14.0` for reproducible results |
|
|
165
|
+
| `REVIT_API_DOCS_MIN_RELEVANCE` | *(unset)* | Probability 0-1 (`retrieval.api.min_relevance`). Only honoured while Jev ranks the results, and it only decides whether to abstain: no entry is dropped, every result keeps its `Relevance` line. When no entry reaches it, `search_revit_api` starts with "No entry in the Revit 2026 data set scored high enough for this query", notes that the member may be absent from this version or listed under a different name or wording, and lists the low-scoring candidates for reference. No effect with Cohere or without reranking. See "Reranking with Jev" below |
|
|
120
166
|
| `REVIT_API_DOCS_RELEASE_URL` | this repository's `v1.0-data` release | Mirror for the data files; the SHA-256 checks still apply |
|
|
121
167
|
| `HTTPS_PROXY` / `HTTP_PROXY` | *(unset)* | Proxy for the embedding and rerank calls |
|
|
122
168
|
|
|
123
169
|
Pass them through the `env` block of your MCP host's server entry.
|
|
124
170
|
|
|
171
|
+
**Reranking with Jev.** If you have a `TYPESAFE_API_KEY`,
|
|
172
|
+
`REVIT_API_DOCS_RERANK_PROVIDER=jev` is the recommended setting (the default
|
|
173
|
+
provider stays `cohere`). On 60 English test queries (50 with a known answer)
|
|
174
|
+
over the keyword (BM25) candidates, with no embedding key, Jev raised nDCG@5
|
|
175
|
+
from 0.675 to 0.871 and never turned a correct top-5 answer into a miss.
|
|
176
|
+
Input tokens cost about $0.23 per 1,000 queries.
|
|
177
|
+
`REVIT_API_DOCS_MIN_RELEVANCE` stays unset by default. Set to 0.15 it filters
|
|
178
|
+
out clearly unrelated queries (questions that are not about Revit, types this
|
|
179
|
+
data set does not have), abstaining on about 2.5% of the queries that do have
|
|
180
|
+
an answer. It cannot spot a misspelt or misplaced member name: such a query
|
|
181
|
+
usually gets the closest real API as the first result, to be confirmed with a
|
|
182
|
+
compile check. **Do not use 0.5**: it abstained on 14% of the queries that
|
|
183
|
+
have an answer. What TypeSafe keeps: see the `jev-data-handling` note
|
|
184
|
+
(`uvx revit-api-docs environment typesafe`).
|
|
185
|
+
|
|
186
|
+
Privacy: with an embedding, Cohere or TypeSafe key the query text and the
|
|
187
|
+
candidate API entries (public documentation) are sent to that provider. Keep
|
|
188
|
+
queries to API names and generic task descriptions, in English.
|
|
189
|
+
|
|
125
190
|
Data set: the SQLite databases and ChromaDB indexes were built from the Revit
|
|
126
191
|
2026 API CHM and the Revit 2026 SDK samples with the pipeline in `pipeline/`
|
|
127
192
|
(`uv sync --extra pipeline`; needs the CHM, the SDK and OpenRouter/Cohere keys
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# revit-api-docs
|
|
2
|
+
|
|
3
|
+
Revit API reference search as an MCP server: two read-only tools over a local
|
|
4
|
+
copy of the Revit 2026 API documentation (27,596 classes, methods, properties
|
|
5
|
+
and enums) and the official SDK samples (153 projects).
|
|
6
|
+
|
|
7
|
+
**Optional.** It exists for models that do not know the Revit API well. If
|
|
8
|
+
your model already writes correct Revit code, you do not need it;
|
|
9
|
+
[revit-bridge](https://github.com/revitbridge/revit-bridge) works without it.
|
|
10
|
+
It never talks to Revit and it never calls a model itself.
|
|
11
|
+
|
|
12
|
+
Queries are **English only**: the corpus is the English API reference. A host
|
|
13
|
+
model that talks to its user in another language rewrites the request into
|
|
14
|
+
English API names or English task keywords before calling a tool.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Prerequisites: Python 3.11+ with [`uv`](https://docs.astral.sh/uv/) (for
|
|
19
|
+
`uvx`), about 700 MB of disk for the data set, network for the first run.
|
|
20
|
+
|
|
21
|
+
**Claude Desktop** — `claude_desktop_config.json`:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"revit-api-docs": {
|
|
27
|
+
"command": "uvx",
|
|
28
|
+
"args": ["revit-api-docs"]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Claude Code**:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
claude mcp add revit-api-docs -- uvx revit-api-docs
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Any MCP client** — run `uvx revit-api-docs` as a stdio server.
|
|
41
|
+
|
|
42
|
+
**Any MCP client over HTTP** — run the server with the MCP streamable HTTP
|
|
43
|
+
transport and point the client at `/mcp`:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uvx revit-api-docs serve --transport http --host 127.0.0.1 --port 8765
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"revit-api-docs": {
|
|
53
|
+
"type": "http",
|
|
54
|
+
"url": "http://127.0.0.1:8765/mcp"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
(Claude Code: `claude mcp add --transport http revit-api-docs http://127.0.0.1:8765/mcp`.)
|
|
61
|
+
stdio stays the default. The HTTP transport has no built-in authentication:
|
|
62
|
+
keep it on a loopback address, or put it behind a reverse proxy that
|
|
63
|
+
authenticates; the server logs a warning when `--host` is not a loopback
|
|
64
|
+
address.
|
|
65
|
+
|
|
66
|
+
On the first start the server downloads the data set (335 MB, four files) from
|
|
67
|
+
this repository's [`v1.0-data` release](https://github.com/revitbridge/revit-api-docs/releases/tag/v1.0-data)
|
|
68
|
+
into `%LOCALAPPDATA%\revit-api-docs` (Windows) or `~/.local/share/revit-api-docs`
|
|
69
|
+
(Linux; `~/Library/Application Support/revit-api-docs` on macOS), verifies each
|
|
70
|
+
file's SHA-256 and unpacks the vector stores. Tool calls made while that runs
|
|
71
|
+
return a short progress message instead of results. To do it ahead of time:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uvx revit-api-docs download
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
From a checkout: `uv sync` then `uv run revit-api-docs`.
|
|
78
|
+
|
|
79
|
+
## Use
|
|
80
|
+
|
|
81
|
+
Two tools, both read-only:
|
|
82
|
+
|
|
83
|
+
- `search_revit_api(query, top_k=10)` — API entries with signature, parameters
|
|
84
|
+
and remarks. Query with an API name (`Wall.Create`,
|
|
85
|
+
`FilteredElementCollector OfCategory`) or a short task (`create floor from
|
|
86
|
+
boundary`). The first line names the reranker that ordered the entries
|
|
87
|
+
(`jev`, `cohere` or `none`) and the data set they come from, for example
|
|
88
|
+
`Rerank: none; data set: Revit 2026`; after an abstention line it is the
|
|
89
|
+
second line. Development-environment questions (`target framework for
|
|
90
|
+
Revit 2027 add-in`) also get up to five curated environment notes
|
|
91
|
+
(framework, SDK, manifest, reference packages per Revit release, each with
|
|
92
|
+
its source); these ship with the package and work before the data set is
|
|
93
|
+
installed and without any key.
|
|
94
|
+
- `get_code_examples(query, top_k=3)` — C# from the SDK samples that use the
|
|
95
|
+
matching APIs, with the project name and the APIs each sample touches.
|
|
96
|
+
|
|
97
|
+
Without any API key the server answers from keyword search over the SQLite
|
|
98
|
+
reference: BM25 over a full-text index of entry names, IDs, summaries and
|
|
99
|
+
signatures, where identifiers also match by their camel-case parts, so a
|
|
100
|
+
misspelt or unknown name still gets candidates. The index (11.8 MB) is built
|
|
101
|
+
next to the data set on first use (under a second). With an embedding key it
|
|
102
|
+
adds semantic search over the vector store, and with a Cohere key it reranks
|
|
103
|
+
the merged candidates; with a TypeSafe key it can rerank with Jev instead, which
|
|
104
|
+
returns a calibrated relevance per entry. With a threshold set and no entry
|
|
105
|
+
reaching it, the output starts with an abstention line and then lists the
|
|
106
|
+
candidates with their relevance, for reference. See Configure.
|
|
107
|
+
|
|
108
|
+
Try it from a terminal (installs the data set if needed):
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
uvx revit-api-docs search "Wall.Create"
|
|
112
|
+
uvx revit-api-docs search "rotate element around axis" --examples
|
|
113
|
+
uvx revit-api-docs environment --revit 2027 # environment notes, no data set needed
|
|
114
|
+
uvx revit-api-docs environment "target framework" # notes a query matches
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Configure
|
|
118
|
+
|
|
119
|
+
All settings are environment variables; there is no config file to edit.
|
|
120
|
+
|
|
121
|
+
| Variable | Default | Meaning |
|
|
122
|
+
|---|---|---|
|
|
123
|
+
| `REVIT_API_DOCS_DATA_DIR` | `%LOCALAPPDATA%\revit-api-docs` (Windows), `~/.local/share/revit-api-docs` (Linux), `~/Library/Application Support/revit-api-docs` (macOS) | Where the data set lives. An existing tree with `sqlite/` and `chromadb/` from the old `revit-api-rag` checkout works as is |
|
|
124
|
+
| `REVIT_API_DOCS_EMBEDDING_API_KEY` | *(unset)* | Key for the embedding endpoint; turns on semantic (vector) search. `OPENROUTER_API_KEY` is used when this is unset |
|
|
125
|
+
| `REVIT_API_DOCS_EMBEDDING_BASE_URL` | `https://openrouter.ai/api/v1` | Any OpenAI-compatible `/embeddings` endpoint |
|
|
126
|
+
| `REVIT_API_DOCS_EMBEDDING_MODEL` | `openai/text-embedding-3-large` | Must produce the same 3072-dimensional space the shipped vectors were built with (`text-embedding-3-large`); another model makes vector search return noise |
|
|
127
|
+
| `COHERE_API_KEY` | *(unset)* | Enables reranking with Cohere `rerank-v3.5` (native REST API) |
|
|
128
|
+
| `REVIT_API_DOCS_RERANK_PROVIDER` | `cohere` | `cohere`, `jev` or `none`. With `jev`, a failed or unconfigured Jev call falls back to Cohere when `COHERE_API_KEY` is set, otherwise to no reranking; the first output line says which one ran |
|
|
129
|
+
| `TYPESAFE_API_KEY` | *(unset)* | Key for TypeSafe System One (Jev), used when the provider is `jev`. At most 30 candidates per request, 2 requests in flight, 2 retries, 20 s timeout |
|
|
130
|
+
| `REVIT_API_DOCS_JEV_MODEL` | `jev-latest` | Jev model or alias; pin a version such as `jev-1.14.0` for reproducible results |
|
|
131
|
+
| `REVIT_API_DOCS_MIN_RELEVANCE` | *(unset)* | Probability 0-1 (`retrieval.api.min_relevance`). Only honoured while Jev ranks the results, and it only decides whether to abstain: no entry is dropped, every result keeps its `Relevance` line. When no entry reaches it, `search_revit_api` starts with "No entry in the Revit 2026 data set scored high enough for this query", notes that the member may be absent from this version or listed under a different name or wording, and lists the low-scoring candidates for reference. No effect with Cohere or without reranking. See "Reranking with Jev" below |
|
|
132
|
+
| `REVIT_API_DOCS_RELEASE_URL` | this repository's `v1.0-data` release | Mirror for the data files; the SHA-256 checks still apply |
|
|
133
|
+
| `HTTPS_PROXY` / `HTTP_PROXY` | *(unset)* | Proxy for the embedding and rerank calls |
|
|
134
|
+
|
|
135
|
+
Pass them through the `env` block of your MCP host's server entry.
|
|
136
|
+
|
|
137
|
+
**Reranking with Jev.** If you have a `TYPESAFE_API_KEY`,
|
|
138
|
+
`REVIT_API_DOCS_RERANK_PROVIDER=jev` is the recommended setting (the default
|
|
139
|
+
provider stays `cohere`). On 60 English test queries (50 with a known answer)
|
|
140
|
+
over the keyword (BM25) candidates, with no embedding key, Jev raised nDCG@5
|
|
141
|
+
from 0.675 to 0.871 and never turned a correct top-5 answer into a miss.
|
|
142
|
+
Input tokens cost about $0.23 per 1,000 queries.
|
|
143
|
+
`REVIT_API_DOCS_MIN_RELEVANCE` stays unset by default. Set to 0.15 it filters
|
|
144
|
+
out clearly unrelated queries (questions that are not about Revit, types this
|
|
145
|
+
data set does not have), abstaining on about 2.5% of the queries that do have
|
|
146
|
+
an answer. It cannot spot a misspelt or misplaced member name: such a query
|
|
147
|
+
usually gets the closest real API as the first result, to be confirmed with a
|
|
148
|
+
compile check. **Do not use 0.5**: it abstained on 14% of the queries that
|
|
149
|
+
have an answer. What TypeSafe keeps: see the `jev-data-handling` note
|
|
150
|
+
(`uvx revit-api-docs environment typesafe`).
|
|
151
|
+
|
|
152
|
+
Privacy: with an embedding, Cohere or TypeSafe key the query text and the
|
|
153
|
+
candidate API entries (public documentation) are sent to that provider. Keep
|
|
154
|
+
queries to API names and generic task descriptions, in English.
|
|
155
|
+
|
|
156
|
+
Data set: the SQLite databases and ChromaDB indexes were built from the Revit
|
|
157
|
+
2026 API CHM and the Revit 2026 SDK samples with the pipeline in `pipeline/`
|
|
158
|
+
(`uv sync --extra pipeline`; needs the CHM, the SDK and OpenRouter/Cohere keys
|
|
159
|
+
in the environment). The server does not need any of that.
|
|
160
|
+
|
|
161
|
+
Development:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
uv sync
|
|
165
|
+
uv run pytest
|
|
166
|
+
uv build
|
|
167
|
+
uvx --from . revit-api-docs search "Wall.Create"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
License: MIT. Issues and discussion: <https://github.com/revitbridge/revit-api-docs/issues>.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "revit-api-docs"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "Revit API reference search for MCP hosts: local semantic + keyword lookup over the Revit 2026 API docs and SDK samples"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|