Skip to content
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

use mkdocs-gallery for example / tutorial documentation #89

Merged
merged 46 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
31de025
mkdocs-gallery example
pmeier Oct 19, 2023
d255956
Merge branch 'main'
pmeier Nov 23, 2023
6df7fc0
fix example
pmeier Nov 23, 2023
a4d8763
Merge branch 'main' into mkdocs-gallery
pmeier Dec 18, 2023
80f3626
ignore generated docs
pmeier Dec 18, 2023
e5e217c
add async example
pmeier Dec 18, 2023
18d9b5e
try deactivate gen files
pmeier Dec 18, 2023
345d99d
don't run in strict mode
pmeier Dec 18, 2023
f91a7f3
Merge branch 'main' into mkdocs-gallery
pmeier Jan 22, 2024
f594abb
proper example
pmeier Jan 22, 2024
c22cef8
remove example notebooks
pmeier Jan 22, 2024
0e4466c
Update environment-dev.yml
pmeier Jan 22, 2024
e297795
fix
pmeier Jan 22, 2024
e1de7c7
disable import sorting in examples
pmeier Jan 22, 2024
c5b9b69
Merge branch 'main' into mkdocs-gallery
pmeier Feb 1, 2024
2f5878c
reenable gen-files plugin
pmeier Feb 2, 2024
954a114
use logo as default thumbnail
pmeier Feb 8, 2024
a824108
progress
pmeier Feb 8, 2024
afffdfd
cleanup
pmeier Feb 8, 2024
4d59c63
dirty
pmeier Feb 9, 2024
adcba4e
dirty
pmeier Feb 9, 2024
30d5bc7
dirty
pmeier Feb 9, 2024
0ca2f33
python API
pmeier Feb 12, 2024
4837148
REST api progress
pmeier Feb 12, 2024
6fb4221
REST API
pmeier Feb 12, 2024
156baa8
streaming progress
pmeier Feb 12, 2024
cbbc374
progress custom components
pmeier Feb 12, 2024
3157243
finish streaming
pmeier Feb 12, 2024
e6cc875
Merge branch 'main' into mkdocs-gallery
pmeier Feb 12, 2024
859ad86
add Cohere
pmeier Feb 12, 2024
33d99e2
fix links
pmeier Feb 12, 2024
a048d13
cleanup
pmeier Feb 12, 2024
42b4bbd
cleanup
pmeier Feb 12, 2024
3bfc268
remove unused gitignore
pmeier Feb 12, 2024
e332763
Merge branch 'main' into mkdocs-gallery
pmeier Feb 13, 2024
72d06c3
add AI21 assistant
pmeier Feb 13, 2024
02f2d1e
Merge branch 'main' into mkdocs-gallery
pmeier Feb 13, 2024
ed1341c
remove jupyter from pre-commit config
pmeier Feb 14, 2024
d633620
remove boto3 from dev requirements
pmeier Feb 14, 2024
a20c73b
Merge branch 'main' into mkdocs-gallery
pmeier Feb 14, 2024
7889689
remove doc tests
pmeier Feb 14, 2024
3802aa4
Merge branch 'main' into mkdocs-gallery
pmeier Feb 19, 2024
5690b48
update
pmeier Feb 19, 2024
45dc7b1
Merge branch 'main' into mkdocs-gallery
pmeier Feb 19, 2024
0c920d1
Merge branch 'main' into mkdocs-gallery
pmeier Mar 4, 2024
a6a7ab0
Merge branch 'main' into mkdocs-gallery
pmeier Mar 4, 2024
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
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build:

mkdocs:
configuration: mkdocs.yml
fail_on_warning: true
# fail_on_warning: true

# Optionally declare the Python requirements required to build your docs
conda:
Expand Down
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
generated
3 changes: 3 additions & 0 deletions docs/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Examples

Here are some examples
31 changes: 31 additions & 0 deletions docs/examples/example_python_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
# Python API

"""

# %%
# Let's create a document

from pathlib import Path

document_path = Path.cwd() / "ragna.txt"
with open(document_path, "w") as file:
file.write("Ragna is awesome!\n")

# %%
# Let's ask a question
#
# !!! note
#
# We can write default markdown here!

from ragna import Rag, assistants, source_storages

rag = Rag()
async with rag.chat(
documents=[document_path],
source_storage=source_storages.RagnaDemoSourceStorage,
assistant=assistants.RagnaDemoAssistant,
) as chat:
answer = await chat.answer("?")
print(answer)
2 changes: 2 additions & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ dependencies:
- mkdocs-gen-files
- material-plausible-plugin
- mktestdocs
# FIXME: replace this with a stable release when available
- mkdocs-gallery @ git+https://github.com/pmeier/mkdocs-gallery@async-gallery
pmeier marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 9 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
site_name: Ragna

repo_url: https://github.com/Quansight/ragna
copyright: Copyright © 2023 Ragna Development Team at Quansight LLC
extra:
Expand Down Expand Up @@ -54,9 +55,13 @@ plugins:
import:
- https://docs.python.org/3/objects.inv
- https://fastapi.tiangolo.com/objects.inv
- gen-files:
scripts:
- scripts/docs/gen_files.py
- gallery:
examples_dirs: docs/examples
gallery_dirs: docs/generated/gallery
filename_pattern: /example_
# - gen-files:
# scripts:
# - scripts/docs/gen_files.py
- material-plausible

hooks:
Expand All @@ -81,6 +86,7 @@ nav:
- "tutorials/web-app.md"
- How-to:
- "how-tos/set-configuration.md"
- Examples: generated/gallery
- Community:
- "community/welcome.md"
- "community/contribute.md"
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ ignore = ["E501"]
[tool.ruff.per-file-ignores]
# ignore unused imports and imports not at the top of the file in __init__.py files
"__init__.py" = ["F401", "E402"]
# The examples often have imports below the top of the file to follow the narrative
"docs/examples/**/*.py" = ["E402", "F704"]
"*.ipynb" = ["E402"]


[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra --tb=short"
Expand Down
Loading