Skip to content

Commit

Permalink
Feature/docsv1 (gpt-engineer-org#554)
Browse files Browse the repository at this point in the history
* Initial Docs Setup

* .gitignore updated with docs

* Added Guide to Build Sphnix Docs

* Fixed typo

* Added `.readthedocs.yaml` and `docs/requirements.txt` files

* redundant extension removed

* updated `docs/requirements.txt`

* Added Respository Stats

* Added RESULTS.md of Benchmark

* Typo fixed

* Fixed local installation and typos

* Update README.md (gpt-engineer-org#561)

Fixed the route for the WINDOWS_README.md file.

* Update FUNDING.yml

* Update FUNDING.yml

* Update FUNDING.yml

* Update FUNDING.yml

* Update FUNDING.yml

* Added DISCLAIMER in docs

* Instructions to build Docs added

* added `doc` dependencies in `pyproject.toml` file using PEP621

* added command to install `docs` dependencies

* Fixed Links for `.md` files

* updated the instructions

---------

Co-authored-by: César García <cesargarciasaez@gmail.com>
Co-authored-by: Anton Osika <anton.osika@gmail.com>
  • Loading branch information
3 people authored and 70ziko committed Oct 25, 2023
1 parent a119756 commit 2d8e969
Show file tree
Hide file tree
Showing 36 changed files with 5,189 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ To enforce this we use [`pre-commit`](https://pre-commit.com/) to run [`black`](
```bash
$ pip install -e .

# For docs building, install doc dependencies too

$ pip install -e .[doc]

# And then install the `pre-commit` hooks with:

$ pre-commit install
Expand Down
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,22 @@ benchmark
!benchmark/*/prompt

.gpte_consent

.gpte_consent

# docs

docs/_build
docs/__init__
docs/ai
docs/chat_to_files
docs/collect
docs/learning
docs/main
docs/steps/
docs/db
docs/db/

# poetry

poetry.lock
32 changes: 32 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .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.11"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - 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: docs/requirements.txt
66 changes: 66 additions & 0 deletions docs/DOCS_BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Building Docs with Sphinx
=========================

This example shows a basic Sphinx docs project with Read the Docs. This project is using `sphinx` with `readthedocs`
project template.

Some useful links are given below to lear and contribute in the project.

📚 [docs/](https://www.sphinx-doc.org/en/master/usage/quickstart.html)<br>
A basic Sphinx project lives in `docs/`, it was generated using Sphinx defaults. All the `*.rst` & `*.md` make up sections in the documentation. Both `.rst` and `.md` formats are supported in this project

⚙️ [.readthedocs.yaml](https://docs.readthedocs.io/en/stable/config-file/v2.html)<br>
Read the Docs Build configuration is stored in `.readthedocs.yaml`.


📍 [docs/requirements.txt](https://docs.readthedocs.io/en/stable/config-file/v2.html)<br>
Python dependencies are [pinned](https://docs.readthedocs.io/en/latest/guides/reproducible-builds.html) (uses [pip-tools](https://pip-tools.readthedocs.io/en/latest/)) here. Make sure to add your Python dependencies to `requirements.txt` or if you choose [pip-tools](https://pip-tools.readthedocs.io/en/latest/), edit `docs/requirements.txt`.



Example Project usage
---------------------

`Poetry` is the package manager for `gpt-engineer`. In order to build documentation, we have to add docs requirements in
development environment.

This project has a standard readthedocs layout which is built by Read the Docs almost the same way that you would build it
locally (on your own laptop!).

You can build and view this documentation project locally - we recommend that you activate a `poetry` or your choice of `venv`
and dependency management tool.

Update `repository_stats.md` file under `docs/intro`

```console
# Install required Python dependencies (MkDocs etc.)
pip install -e .[doc]
cd docs/
# Create the `api_reference.rst`
python create_api_rst.py

# Build the docs
make html
```

Project Docs Structure
----------------------
If you are new to Read the Docs, you may want to refer to the [Read the Docs User documentation](https://docs.readthedocs.io/).

Below is the rundown of documentation structure for `pandasai`, you need to know:

1. place your `docs/` folder alongside your Python project.
2. copy `.readthedocs.yaml` and the `docs/` folder into your project root.
3. `docs/api_reference.rst` contains the API documentation created using `docstring`. Run the `create_api_rst.py` to update the API reference file.
4. Project is using standard Google Docstring Style.
5. Rebuild the documenation locally to see that it works.
6. Documentation are hosted on [Read the Docs tutorial](https://docs.readthedocs.io/en/stable/tutorial/)


Read the Docs tutorial
----------------------

To get started with Read the Docs, you may also refer to the
[Read the Docs tutorial](https://docs.readthedocs.io/en/stable/tutorial/). I

With every release, build the documentation manually.
20 changes: 20 additions & 0 deletions docs/Makefile
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.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = gpt_engineer
SOURCEDIR = .
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)
79 changes: 79 additions & 0 deletions docs/RESULTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Benchmarks

```bash
python scripts/benchmark.py
```

## 2023-06-21

| Benchmark | Ran | Works | Perfect |
|--------------------|-----|-------|---------|
| currency_converter ||||
| image_resizer ||||
| pomodoro_timer ||||
| url_shortener ||||
| file_explorer ||||
| markdown_editor ||||
| timer_app ||||
| weather_app ||||
| file_organizer ||||
| password_generator ||||
| todo_list ||||

## Notes on the errors

Most errors come from that the "generate entrypoint" are incorrect. Ignoring
those, we get 8/11 fully correct.

All errors are very easy to fix.

One error was trying to modify a constant.
One error was that the html template was not fully filled in.
One error is that a dependency was used incorrectly and easy to fix

## 2023-06-19

| Benchmark | Ran | Works | Perfect |
|--------------------|-----|-------|---------|
| currency_converter ||||
| image_resizer ||||
| pomodoro_timer ||||
| url_shortener ||||
| file_explorer ||||
| markdown_editor ||||
| timer_app ||||
| weather_app ||||
| file_organizer ||||
| password_generator ||||
| todo_list ||||

## Notes on the errors

**timer_app** almost works with unit tests config

- failure mode: undefined import/conflicting names

**file_explorer** works

**file organiser**: works

**image_resizer** almost works with unit tests config

- failure mode: undefined import

**todo_list** runs. doesn't really work with unit tests config
Uncaught ReferenceError: module is not defined

- failure mode: placeholder text

url_shortener starts but gets the error:
SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 8636125824 and this is thread id 13021003776.

markdown_editor:
failing tests, 'WebDriver' object has no attribute 'find_element_by_id'

pomodoro: doesn't run it only tests

currency_converter: backend doesn't return anything

weather_app only runs test, no code existed
154 changes: 154 additions & 0 deletions docs/api_reference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
.. _api_reference:

=============
API Reference
=============

:mod:`gpt_engineer.ai`: Ai
===========================

.. automodule:: gpt_engineer.ai
:no-members:
:no-inherited-members:

Functions
--------------
.. currentmodule:: gpt_engineer

.. autosummary::
:toctree: ai

ai.create_chat_model
ai.fallback_model
ai.get_tokenizer
ai.serialize_messages

:mod:`gpt_engineer.chat_to_files`: Chat To Files
=================================================

.. automodule:: gpt_engineer.chat_to_files
:no-members:
:no-inherited-members:

Functions
--------------
.. currentmodule:: gpt_engineer

.. autosummary::
:toctree: chat_to_files

chat_to_files.parse_chat
chat_to_files.to_files

:mod:`gpt_engineer.collect`: Collect
=====================================

.. automodule:: gpt_engineer.collect
:no-members:
:no-inherited-members:

Functions
--------------
.. currentmodule:: gpt_engineer

.. autosummary::
:toctree: collect

collect.collect_learnings
collect.send_learning
collect.steps_file_hash

:mod:`gpt_engineer.db`: Db
===========================

.. automodule:: gpt_engineer.db
:no-members:
:no-inherited-members:

Functions
--------------
.. currentmodule:: gpt_engineer

.. autosummary::
:toctree: db

db.archive

:mod:`gpt_engineer.learning`: Learning
=======================================

.. automodule:: gpt_engineer.learning
:no-members:
:no-inherited-members:

Functions
--------------
.. currentmodule:: gpt_engineer

.. autosummary::
:toctree: learning

learning.ask_if_can_store
learning.check_consent
learning.collect_consent
learning.extract_learning
learning.get_session
learning.human_input
learning.logs_to_string

:mod:`gpt_engineer.main`: Main
===============================

.. automodule:: gpt_engineer.main
:no-members:
:no-inherited-members:

Functions
--------------
.. currentmodule:: gpt_engineer

.. autosummary::
:toctree: main

main.main

:mod:`gpt_engineer.steps`: Steps
=================================

.. automodule:: gpt_engineer.steps
:no-members:
:no-inherited-members:

Classes
--------------
.. currentmodule:: gpt_engineer

.. autosummary::
:toctree: steps
:template: class.rst

steps.Config

Functions
--------------
.. currentmodule:: gpt_engineer

.. autosummary::
:toctree: steps

steps.clarify
steps.curr_fn
steps.execute_entrypoint
steps.fix_code
steps.gen_clarified_code
steps.gen_code
steps.gen_entrypoint
steps.gen_spec
steps.gen_unit_tests
steps.get_prompt
steps.human_review
steps.respec
steps.setup_sys_prompt
steps.simple_gen
steps.use_feedback

2 changes: 2 additions & 0 deletions docs/code_conduct_link.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.. include:: ../.github/CODE_OF_CONDUCT.md
:parser: myst_parser.sphinx_
Loading

0 comments on commit 2d8e969

Please sign in to comment.