Skip to content

Commit

Permalink
Clean up api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Jan 17, 2025
1 parent 051f7e4 commit d4134fb
Show file tree
Hide file tree
Showing 10 changed files with 213 additions and 379 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
with:
enable-cache: true
python-version: 3.9
- run: uv run sphinx-build -T -b html docs docs/_build/html
- run: uv run sphinx-build -T -W -b html docs docs/_build/html

ci_success:
name: "CI Success"
Expand Down
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def skip_private_members(app, what, name, obj, skip, options):
return True
if hasattr(obj, "__doc__") and obj.__doc__ and ":private:" in obj.__doc__:
return True
if name == "__init__" and obj.__objclass__ is object:
if name == "__init__" and getattr(obj, "__objclass__", None) is object:
# dont document default init
return True
return None
Expand All @@ -76,10 +76,12 @@ def skip_private_members(app, what, name, obj, skip, options):
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autodoc.typehints",
"sphinx.ext.mathjax",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinxcontrib.autodoc_pydantic",
"IPython.sphinxext.ipython_console_highlighting",
"myst_parser",
"_extensions.gallery_directive",
"sphinx_design",
Expand Down
2 changes: 2 additions & 0 deletions docs/create_api_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def _load_module_members(module_path: str, namespace: str) -> ModuleMembers:
continue
if ":private:" in (type_.__doc__ or ""):
continue
if hasattr(module, "__all__") and name not in module.__all__:
continue

if inspect.isclass(type_):
# The type of the class is used to select a template
Expand Down
2 changes: 1 addition & 1 deletion libs/langchain-mongodb/langchain_mongodb/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def reciprocal_rank_stage(
extra_fields: Any fields other than text_field that one wishes to keep.
Returns:
RRF score := \frac{1}{rank + penalty} with rank in [1,2,..,n]
RRF score
"""

rrf_pipeline = [
Expand Down
9 changes: 5 additions & 4 deletions libs/langchain-mongodb/langchain_mongodb/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ class MongoDBAtlasVectorSearch(VectorStore):
Setup:
* Set up a MongoDB Atlas cluster. The free tier M0 will allow you to start.
Search Indexes are only available on Atlas, the fully managed cloud service,
not the self-managed MongoDB.
Follow [this guide](https://www.mongodb.com/basics/mongodb-atlas-tutorial)
Search Indexes are only available on Atlas, the fully managed cloud service,
not the self-managed MongoDB.
Follow [this guide](https://www.mongodb.com/basics/mongodb-atlas-tutorial)
* Create a Collection and a Vector Search Index.The procedure is described
[here](https://www.mongodb.com/docs/atlas/atlas-vector-search/create-index/#procedure).
[here](https://www.mongodb.com/docs/atlas/atlas-vector-search/create-index/#procedure).
* Install ``langchain-mongodb``
Expand Down Expand Up @@ -189,6 +189,7 @@ class MongoDBAtlasVectorSearch(VectorStore):
* [SIM=0.916096] foo [{'_id': '1', 'baz': 'bar'}]
Use as Retriever:
.. code-block:: python
retriever = vector_store.as_retriever(
Expand Down
Loading

0 comments on commit d4134fb

Please sign in to comment.