Skip to content

WIP: Separate documents #1123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -21,8 +21,19 @@ test_coverage:
test_profile:
poetry run pytest -vv tests/ --profile-svg

docs:
poetry run sphinx-build -b html docs _build/docs
docs: docs-guardrails docs-community docs-colang docs-review

docs-guardrails:
poetry run sphinx-build -b html docs _build/docs/guardrails

docs-community:
poetry run sphinx-build -b html docs/community _build/docs/community

docs-colang:
poetry run sphinx-build -b html docs/colang _build/docs/colang

docs-review:
poetry run sphinx-build -b html docs/review _build/docs

pre_commit:
pre-commit install
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
85 changes: 85 additions & 0 deletions docs/colang/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Copyright (c) 2024, NVIDIA CORPORATION.

from datetime import date
from pathlib import Path

from toml import load

project = "NeMo Guardrails and Colang"
this_year = date.today().year
copyright = f"2023-{this_year}, NVIDIA Corporation"
author = "NVIDIA Corporation"
release = "0.0.0"

with open(
Path(__file__).parent.parent.parent / "pyproject.toml", encoding="utf-8"
) as f:
t = load(f)
release = t.get("tool").get("poetry").get("version")

extensions = [
"myst_parser",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
"sphinx_reredirects",
]

copybutton_exclude = ".linenos, .gp, .go"

myst_linkify_fuzzy_links = False
myst_heading_anchors = 3
myst_enable_extensions = [
"deflist",
"dollarmath",
"fieldlist",
"substitution",
]

myst_substitutions = {
"version": release,
}

exclude_patterns = [
"_build/**",
]

# intersphinx_mapping = {
# 'gpu-op': ('https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest', None),
# }

# suppress_warnings = ["etoc.toctree", "myst.header", "misc.highlighting_failure"]

html_theme = "nvidia_sphinx_theme"
html_copy_source = False
html_show_sourcelink = False
html_show_sphinx = False

html_domain_indices = False
html_use_index = False
html_extra_path = ["project.json", "versions1.json"]
highlight_language = "console"

html_theme_options = {
"icon_links": [],
"switcher": {
"json_url": "../versions1.json",
"version_match": release,
},
}

html_baseurl = "https://docs.nvidia.com/nemo/guardrails/community/latest/"
34 changes: 23 additions & 11 deletions docs/getting-started/README.md → docs/colang/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Getting Started
# Developing Guardrails with Colang

This *Getting Started* section of the documentation is meant to help you get started with NeMo Guardrails. It is structured as a sequence of guides focused on specific topics. Each guide builds on the previous one by introducing new concepts and features. For each guide, in addition to the README, you will find a corresponding Jupyter notebook and the final configuration (*config.yml*) in the *config* folder.

1. [Hello World](./1-hello-world/README.md): get started with the basics of NeMo Guardrails by building a simple rail that controls the greeting behavior.
2. [Core Colang Concepts](./2-core-colang-concepts/README.md): learn about the core concepts of Colang: messages and flows.
3. [Demo Use Case](./3-demo-use-case/README.md): the choice of a representative use case.
4. [Input moderation](./4-input-rails/README.md): make sure the input from the user is safe, before engaging with it.
5. [Output moderation](./5-output-rails/README.md): make sure the output of the bot is not offensive and making sure it does not contain certain words.
6. [Preventing off-topic questions](./6-topical-rails/README.md): make sure that the bot responds only to a specific set of topics.
7. [Retrieval Augmented Generation](./7-rag/README.md): integrate an external knowledge base.

```{toctree}
:caption: Guardrails with Colang
:name: Guardrails with Colang
:hidden:
:maxdepth: 2
:caption: Contents

1-hello-world/README
2-core-colang-concepts/README
@@ -13,12 +23,14 @@
6-topical-rails/README
7-rag/README
```
This *Getting Started* section of the documentation is meant to help you get started with NeMo Guardrails. It is structured as a sequence of guides focused on specific topics. Each guide builds on the previous one by introducing new concepts and features. For each guide, in addition to the README, you will find a corresponding Jupyter notebook and the final configuration (*config.yml*) in the *config* folder.

1. [Hello World](./1-hello-world/README.md): get started with the basics of NeMo Guardrails by building a simple rail that controls the greeting behavior.
2. [Core Colang Concepts](./2-core-colang-concepts/README.md): learn about the core concepts of Colang: messages and flows.
3. [Demo Use Case](./3-demo-use-case/README.md): the choice of a representative use case.
4. [Input moderation](./4-input-rails/README.md): make sure the input from the user is safe, before engaging with it.
5. [Output moderation](./5-output-rails/README.md): make sure the output of the bot is not offensive and making sure it does not contain certain words.
6. [Preventing off-topic questions](./6-topical-rails/README.md): make sure that the bot responds only to a specific set of topics.
7. [Retrieval Augmented Generation](./7-rag/README.md): integrate an external knowledge base.
```{toctree}
:caption: Colang 2.0
:name: Colang 2.0
:hidden:

colang-2/overview
colang-2/whats-changed
colang-2/getting-started/index
colang-2/language-reference/index
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
85 changes: 85 additions & 0 deletions docs/community/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Copyright (c) 2024, NVIDIA CORPORATION.

from datetime import date
from pathlib import Path

from toml import load

project = "Community Integrations with NeMo Guardrails"
this_year = date.today().year
copyright = f"2023-{this_year}, NVIDIA Corporation"
author = "NVIDIA Corporation"
release = "0.0.0"

with open(
Path(__file__).parent.parent.parent / "pyproject.toml", encoding="utf-8"
) as f:
t = load(f)
release = t.get("tool").get("poetry").get("version")

extensions = [
"myst_parser",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
"sphinx_reredirects",
]

copybutton_exclude = ".linenos, .gp, .go"

myst_linkify_fuzzy_links = False
myst_heading_anchors = 3
myst_enable_extensions = [
"deflist",
"dollarmath",
"fieldlist",
"substitution",
]

myst_substitutions = {
"version": release,
}

exclude_patterns = [
"_build/**",
]

# intersphinx_mapping = {
# 'gpu-op': ('https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest', None),
# }

# suppress_warnings = ["etoc.toctree", "myst.header", "misc.highlighting_failure"]

html_theme = "nvidia_sphinx_theme"
html_copy_source = False
html_show_sourcelink = False
html_show_sphinx = False

html_domain_indices = False
html_use_index = False
html_extra_path = ["project.json", "versions1.json"]
highlight_language = "console"

html_theme_options = {
"icon_links": [],
"switcher": {
"json_url": "../versions1.json",
"version_match": release,
},
}

html_baseurl = "https://docs.nvidia.com/nemo/guardrails/community/latest/"
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions docs/community/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Community Integrations with NeMo Guardrails

```{toctree}
:maxdepth: 1
:glob:

*
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions docs/community/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "name": "nemo-guardrails-community-integrations", "version": "0.13.0" }
File renamed without changes.
6 changes: 2 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -44,6 +44,8 @@

exclude_patterns = [
"README.md",
"community",
"colang",
]

myst_linkify_fuzzy_links = False
@@ -59,10 +61,6 @@
"version": release,
}

exclude_patterns = [
"_build/**",
]

# intersphinx_mapping = {
# 'gpu-op': ('https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest', None),
# }
4 changes: 0 additions & 4 deletions docs/getting-started/1-hello-world/config/config.yml

This file was deleted.

16 changes: 0 additions & 16 deletions docs/getting-started/1-hello-world/config/rails.co

This file was deleted.

4 changes: 0 additions & 4 deletions docs/getting-started/2-core-colang-concepts/config/config.yml

This file was deleted.

16 changes: 0 additions & 16 deletions docs/getting-started/2-core-colang-concepts/config/rails.co

This file was deleted.

29 changes: 0 additions & 29 deletions docs/getting-started/4-input-rails/config/config.yml

This file was deleted.

21 changes: 0 additions & 21 deletions docs/getting-started/4-input-rails/config/prompts.yml

This file was deleted.

32 changes: 0 additions & 32 deletions docs/getting-started/5-output-rails/config/actions.py

This file was deleted.

Loading