-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7db862
commit 2e6441a
Showing
14 changed files
with
541 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pip install -r requirements/docs.txt | ||
cd docs | ||
rm -rf build | ||
|
||
# update api rst | ||
#rm -rf source/api/ | ||
#sphinx-apidoc --module-first -o source/api/ ../modelscope/ | ||
make html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
WHL_BUILD_DIR :=package | ||
DOC_BUILD_DIR :=docs/build/ | ||
|
||
# default rule | ||
default: whl docs | ||
|
||
.PHONY: docs | ||
docs: | ||
bash .dev_scripts/build_docs.sh | ||
|
||
.PHONY: whl | ||
whl: | ||
python setup.py sdist bdist_wheel | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf $(WHL_BUILD_DIR) $(DOC_BUILD_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = source_en | ||
BUILDDIR = build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## maintain docs | ||
1. build docs | ||
```shell | ||
# in root directory: | ||
make docs | ||
``` | ||
|
||
2. doc string format | ||
|
||
We adopt the google style docstring format as the standard, please refer to the following documents. | ||
1. Google Python style guide docstring [link](http://google.github.io/styleguide/pyguide.html#381-docstrings) | ||
2. Google docstring example [link](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) | ||
3. sample:torch.nn.modules.conv [link](https://pytorch.org/docs/stable/_modules/torch/nn/modules/conv.html#Conv1d) | ||
4. load function as an example: | ||
|
||
```python | ||
def load(file, file_format=None, **kwargs): | ||
"""Load data from json/yaml/pickle files. | ||
This method provides a unified api for loading data from serialized files. | ||
Args: | ||
file (str or :obj:`Path` or file-like object): Filename or a file-like | ||
object. | ||
file_format (str, optional): If not specified, the file format will be | ||
inferred from the file extension, otherwise use the specified one. | ||
Currently supported formats include "json", "yaml/yml". | ||
Examples: | ||
>>> load('/path/of/your/file') # file is stored in disk | ||
>>> load('https://path/of/your/file') # file is stored on internet | ||
>>> load('oss://path/of/your/file') # file is stored in petrel | ||
Returns: | ||
The content from the file. | ||
""" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=source | ||
set BUILDDIR=build | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.http://sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# .readthedocs.yaml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the OS, Python version and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.12" | ||
|
||
# Build documentation in the "docs/" directory with Sphinx | ||
sphinx: | ||
configuration: docs/source/conf.py | ||
|
||
# Optionally build your docs in additional formats such as PDF and ePub | ||
# formats: | ||
# - epub | ||
|
||
# Optional but recommended, declare the Python requirements required | ||
# to build your documentation | ||
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html | ||
python: | ||
install: | ||
- requirements: requirements/docs.txt | ||
- requirements: requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
import os | ||
import sys | ||
|
||
# import sphinx_book_theme | ||
|
||
sys.path.insert(0, os.path.abspath('../../')) | ||
# -- Project information ----------------------------------------------------- | ||
|
||
project = 'modelscope_agent' | ||
copyright = '2022-2024, Alibaba ModelScope' | ||
author = 'ModelScope Authors' | ||
version_file = '../../modelscope_agent/version.py' | ||
html_theme = 'sphinx_rtd_theme' | ||
language = 'zh_CN' | ||
|
||
|
||
def get_version(): | ||
with open(version_file, 'r', encoding='utf-8') as f: | ||
exec(compile(f.read(), version_file, 'exec')) | ||
return locals()['__version__'] | ||
|
||
|
||
# The full version, including alpha/beta/rc tags | ||
version = get_version() | ||
release = version | ||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
'sphinx.ext.napoleon', | ||
'sphinx.ext.autosummary', | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.viewcode', | ||
'sphinx_markdown_tables', | ||
'sphinx_copybutton', | ||
'myst_parser', | ||
] | ||
|
||
# build the templated autosummary files | ||
autosummary_generate = True | ||
numpydoc_show_class_members = False | ||
|
||
# Enable overriding of function signatures in the first line of the docstring. | ||
autodoc_docstring_signature = True | ||
|
||
# Disable docstring inheritance | ||
autodoc_inherit_docstrings = False | ||
|
||
# Show type hints in the description | ||
autodoc_typehints = 'description' | ||
|
||
# Add parameter types if the parameter is documented in the docstring | ||
autodoc_typehints_description_target = 'documented_params' | ||
|
||
autodoc_default_options = { | ||
'member-order': 'bysource', | ||
} | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ['_templates'] | ||
|
||
# The suffix(es) of source filenames. | ||
# You can specify multiple suffix as a list of string: | ||
# | ||
source_suffix = ['.rst', '.md'] | ||
|
||
# The master toctree document. | ||
root_doc = 'index' | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns = [ | ||
'build', 'source/.ipynb_checkpoints', 'source/api/generated', 'Thumbs.db', | ||
'.DS_Store' | ||
] | ||
# A list of glob-style patterns [1] that are used to find source files. | ||
# They are matched against the source file names relative to the source directory, | ||
# using slashes as directory separators on all platforms. | ||
# The default is **, meaning that all files are recursively included from the source directory. | ||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
# html_theme = 'sphinx_book_theme' | ||
# html_theme_path = [sphinx_book_theme.get_html_theme_path()] | ||
# html_theme_options = {} | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ['_static'] | ||
# html_css_files = ['css/readthedocs.css'] | ||
|
||
# -- Options for HTMLHelp output --------------------------------------------- | ||
# Output file base name for HTML help builder. | ||
|
||
# -- Extension configuration ------------------------------------------------- | ||
# Ignore >>> when copying code | ||
copybutton_prompt_text = r'>>> |\.\.\. ' | ||
copybutton_prompt_is_regexp = True | ||
|
||
# Example configuration for intersphinx: refer to the Python standard library. | ||
intersphinx_mapping = {'https://docs.python.org/': None} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
.. swift documentation file, | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Modelscope-Agent DOCUMENTATION | ||
======================== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Get Started | ||
|
||
get_started/installation.md | ||
get_started/introduction.md | ||
get_started/quickstart.md | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Module Overview | ||
|
||
modules/llm.md | ||
modules/tool.md | ||
modules/memory.md | ||
modules/retrieve.md | ||
modules/callback.md | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Tools Contribution | ||
|
||
contributing/tool_contribution_guide.md | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: LLM Application | ||
|
||
training_llms/train.md | ||
training_llms/train_agentfabric_llm_tool_use.md | ||
llms/qwen2_tool_calling.md | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Use cases | ||
|
||
use_cases/application.md | ||
use_cases/code_interpreter_case.md | ||
use_cases/llama3_for_agent.md | ||
use_cases/openAPI_for_agent.md | ||
deployment/local_deploy.md | ||
|
||
|
||
|
||
Indices and tables | ||
================== | ||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# .readthedocs.yaml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the OS, Python version and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.12" | ||
|
||
# Build documentation in the "docs/" directory with Sphinx | ||
sphinx: | ||
configuration: docs/source_en/conf.py | ||
|
||
# Optionally build your docs in additional formats such as PDF and ePub | ||
# formats: | ||
# - epub | ||
|
||
# Optional but recommended, declare the Python requirements required | ||
# to build your documentation | ||
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html | ||
python: | ||
install: | ||
- requirements: requirements/docs.txt | ||
- requirements: requirements.txt |
Oops, something went wrong.