Code Monkey home page Code Monkey logo

dspy's People

Contributors

anush008 avatar arnavsinghvi11 avatar cbrew avatar danielmachlab avatar darinkishore avatar detaos avatar eltociear avatar guyaglionby avatar hmoazam avatar insop avatar jasper-xian avatar jcopps avatar ke7 avatar lawliet19189 avatar manishshettym avatar mateiz avatar meditans avatar msnidal avatar okhat avatar paridhimaheshwari2708 avatar qwertyzzy avatar sam-h-bean avatar santhnm2 avatar shangyint avatar sky-2002 avatar stalkermustang avatar sweep-ai[bot] avatar tleers avatar tomjoshi avatar xenonmolecule avatar

dspy's Issues

Sweep: Update cloned documentation from llama-index to document DSPy

Details

I've cloned some documentation setup for collaborators in the docs directory -> namely, "DOCS_README.md Makefile index.rst make.bat".

These should all be setup so that they work for DSPy, not llama-index.

Thank you!

Checklist
  • Modify docs/DOCS_README.mdfd2a94e Edit
  • Running GitHub Actions for docs/DOCS_README.mdEdit
  • Modify docs/conf.py6aa6f03 Edit
  • Running GitHub Actions for docs/conf.pyEdit
  • Modify docs/index.rst247309e Edit
  • Running GitHub Actions for docs/index.rstEdit

Sweep: Asynchronous Compiled Programs

Details

Currently the compiled programs are not async and hence are not efficient to serve using a python server. It would be useful to merge the PRs aiming to add async across the dspy library.

This could also involve adding nurseries in order to await an ensemble of requests simultaneously.

Checklist
  • Modify dspy/teleprompt/random_search.py930f948 Edit
  • Running GitHub Actions for dspy/teleprompt/random_search.pyEdit
  • Modify dspy/teleprompt/ensemble.py09314f6 Edit
  • Running GitHub Actions for dspy/teleprompt/ensemble.pyEdit
  • Modify dspy/teleprompt/finetune.py215893d Edit
  • Running GitHub Actions for dspy/teleprompt/finetune.pyEdit
  • Modify dspy/primitives/box.py1068536 Edit
  • Running GitHub Actions for dspy/primitives/box.pyEdit
  • Modify docs/teleprompters.md0fcdd68 Edit
  • Running GitHub Actions for docs/teleprompters.mdEdit

Sweep: Create `docs/source/index.rst`

Details

DO SMALL, INDIVIDUAL STEPS. THINK SLOWLY AND DELIBERATELY.

Index.rst is currently empty. Create an introduction to the package, drawing on docs/README.rst.

Next, allow linking to each of the other .rst files in the docs directory via the sidebar, for the index page. This includes language_models_client, retrieval_models_client, teleprompters, using_local_models, and modules.rst

Checklist
  • Modify docs/source/index.rst7d8ffeb Edit
  • Running GitHub Actions for docs/source/index.rstEdit

Sweep: Add useful docstrings for all classes and functions in `dspy/primitives/*.py`.

Details

Add useful docstrings for all classes and functions in dspy/primitives/*.py.

Ensure every file is fully documented.

This includes:

assertions.py
box.py
example.py
module.py
prediction.py
program.py
Checklist

Sweep: Fix Readthedocs

Details

Running Sphinx v7.2.6
making output directory... done
[autosummary] generating autosummary for: index.rst
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
�[2Kreading sources... [100%] index
/home/docs/checkouts/readthedocs.org/user_builds/dspy-ai/checkouts/latest/docs/index.rst:8: WARNING: toctree contains reference to nonexisting document 'installation'
/home/docs/checkouts/readthedocs.org/user_builds/dspy-ai/checkouts/latest/docs/index.rst:8: WARNING: toctree contains reference to nonexisting document 'syntax'
/home/docs/checkouts/readthedocs.org/user_builds/dspy-ai/checkouts/latest/docs/index.rst:8: WARNING: toctree contains reference to nonexisting document 'compiling'
/home/docs/checkouts/readthedocs.org/user_builds/dspy-ai/checkouts/latest/docs/index.rst:8: WARNING: toctree contains reference to nonexisting document 'tutorials'
/home/docs/checkouts/readthedocs.org/user_builds/dspy-ai/checkouts/latest/docs/index.rst:8: WARNING: toctree contains reference to nonexisting document 'faq'
/home/docs/checkouts/readthedocs.org/user_builds/dspy-ai/checkouts/latest/docs/index.rst:8: WARNING: toctree contains reference to nonexisting document 'language_models_client'
/home/docs/checkouts/readthedocs.org/user_builds/dspy-ai/checkouts/latest/docs/index.rst:8: WARNING: toctree contains reference to nonexisting document 'dspy.teleprompt.bootstrap'
/home/docs/checkouts/readthedocs.org/user_builds/dspy-ai/checkouts/latest/docs/index.rst:22: WARNING: toctree glob pattern 'api/*' didn't match any documents
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets... copying static files... done
copying extra files... done
done
�[2Kwriting output... [100%] index
generating indices... genindex done
highlighting module code...
writing additional pages... search done
dumping search index in English (code: en)... done
dumping object inventory... done
Updating searchtools for Read the Docs search... build succeeded, 8 warnings.

The HTML pages are in ../_readthedocs/html.

Checklist
  • Modify docs/index.rst66e4250 Edit
  • Running GitHub Actions for docs/index.rstEdit

Sweep: Ensure `predict` in the `dspy/` folder has documentation.

Details

Details

All the documentation should be written back to the docs folder. If a documentation section is already present, modify, it, do not add a new one.

Ensure the documentation does more than describe the code—you should identify the philosophical usage/purpose of predict, (draw from the README.md for this) and ensure that how we achieve that is written in your documentation, in addition to actual examples of how to use the thing you are documenting. For examples, please refer to the jupyter notebooks.

Good luck. Please be thorough and comprehensive.

Checklist
  • Modify docs/modules/modules.mdee3fc12 Edit
  • Running GitHub Actions for docs/modules/modules.mdEdit

Sweep: Ensure `retrieve` in the `dspy/` folder has comprehensive documentation.

Details

Details

All the documentation should be written back to the docs folder. If a documentation section is already present, modify, it, do not add a new one.

Ensure the documentation does more than describe the code—you should identify the philosophical usage/purpose of retrieve, (draw from the README.md for this) and ensure that how we achieve that is written in your documentation, in addition to actual examples of how to use the thing you are documenting. For examples, please refer to the jupyter notebooks.

Good luck. Please be thorough and comprehensive.

Checklist
  • Create docs/retrieve.md867f563 Edit
  • Running GitHub Actions for docs/retrieve.mdEdit
  • Modify docs/DOCS_README.md8485a44 Edit
  • Running GitHub Actions for docs/DOCS_README.mdEdit

Sweep: Ensure `evaluate` in the `dspy/` folder has documentation.

Details

Details

All the documentation should be written back to the docs folder. If a documentation section is already present, modify, it, do not add a new one.

Ensure the documentation does more than describe the code—you should identify the philosophical usage/purpose of evaluate, (draw from the README.md for this) and ensure that how we achieve that is written in your documentation, in addition to actual examples of how to use the thing you are documenting. For examples, please refer to the jupyter notebooks.

Good luck. Please be thorough and comprehensive.

Checklist
  • Create docs/evaluate.md04ec956 Edit
  • Running GitHub Actions for docs/evaluate.mdEdit
  • Modify docs/DOCS_README.mdedc9a64 Edit
  • Running GitHub Actions for docs/DOCS_README.mdEdit

Sweep: Add the readme to the RTD Documentation.

Details

Please add the contents of /readme.md to the documentation. A skeleton of this change is present in docs/source/index.rst, but you may refactor it how you please, keeping in mind future extensability and easy modification.

Please thoroughly plan out the documentation, how it should work, and then put together the starting building blocks by adding the readme to the ReadTheDocs documentation! In future PRs, we will merge the content of modules.md, teleprompters.md, and every jupyter notebook example into the documentation, so please ensure your current implementation takes extensibility into account.

Checklist
  • Create docs/source/readme.rst31b5da2 Edit
  • Running GitHub Actions for docs/source/readme.rstEdit
  • Modify docs/source/index.rst2b3803a Edit
  • Running GitHub Actions for docs/source/index.rstEdit

Sweep: Add docstrings to `signature`.

Details

Please add genuinely useful (ie: not! trivial!!) docstrings to dspy/signatures/signature.py and field.py (same dir).

Below is some documentation on Signatures, from the readme:

#### 3.a) Declaring the input/output behavior of LMs with `dspy.Signature`

When we assign tasks to LMs in **DSPy**, we specify the behavior we need as a **Signature**. A signature is a declarative specification of input/output behavior of a **DSPy module**.

Instead of investing effort into _how_ to get your LM to do a sub-task, signatures enable you to inform **DSPy** _what_ the sub-task is. Later, the **DSPy compiler** will figure out how to build a complex prompt for your large LM (or finetune your small LM) specifically for your signature, on your data, and within your pipeline.

A signature consists of three simple elements:

- A minimal description of the sub-task the LM is supposed to solve.
- A description of one or more input fields (e.g., input question) that will we will give to the LM.
- A description of one or more output fields (e.g., the question's answer) that we will expect from the LM.


We support two notations for expressing signatures. The **short-hand signature notation** is for quick development. You just provide your module (e.g., `dspy.ChainOfThought`) with a string with `input_field_name_1, ... -> output_field_name_1, ...` with the fields separated by commas.

In the `RAG` class earlier, we saw:

```python
self.generate_answer = dspy.ChainOfThought("context, question -> answer")

In many cases, this barebones signature is sufficient. However, sometimes you need more control. In these cases, we can use the full notation to express a more fully-fledged signature below.

class GenerateSearchQuery(dspy.Signature):
    """Write a simple search query that will help answer a complex question."""

    context = dspy.InputField(desc="may contain relevant facts")
    question = dspy.InputField()
    query = dspy.OutputField()

### inside your program's __init__ function
self.generate_answer = dspy.ChainOfThought(GenerateSearchQuery)

You can optionally provide a prefix and/or desc key for each input or output field to refine or constraint the behavior of modules using your signature. The description of the sub-task itself is specified as the docstring (i.e., """Write a simple...""").



<details open>
<summary>Checklist</summary>

- [X] Modify `dspy/signatures/field.py` ✓ https://github.com/darinkishore/dspy/commit/bfea0337c513fe182d221707e13d724d8e6ed7df [Edit](https://github.com/darinkishore/dspy/edit/sweep/add_docstrings_to_signature/dspy/signatures/field.py#L4-L30)
- [X] Running GitHub Actions for `dspy/signatures/field.py` ✓  [Edit](https://github.com/darinkishore/dspy/edit/sweep/add_docstrings_to_signature/dspy/signatures/field.py#L4-L30)
- [X] Modify `dspy/signatures/signature.py` ✓ https://github.com/darinkishore/dspy/commit/7ad290f13bf8d1ba7a2b6f4e695b17c1974ed6d4 [Edit](https://github.com/darinkishore/dspy/edit/sweep/add_docstrings_to_signature/dspy/signatures/signature.py#L34-L100)
- [X] Running GitHub Actions for `dspy/signatures/signature.py` ✓  [Edit](https://github.com/darinkishore/dspy/edit/sweep/add_docstrings_to_signature/dspy/signatures/signature.py#L34-L100)
</details>

Sweep: Set up ReadTheDocs Documentation

Details

The basic configuration is working. Now, the already existing documentation in the docs/ directory needs to be added to the index, and all docstring documentation should also automatically be updated.

Ensure the readthedocs website for the repo will have at least the documentation already present in the docs directory.

Checklist
  • Modify docs/conf.py5c7fee7 Edit
  • Running GitHub Actions for docs/conf.pyEdit
  • Modify docs/index.rst406cacf Edit
  • Running GitHub Actions for docs/index.rstEdit

Sweep: Set up tests for all OpenAI content for a migration to the 1.0 upgrade

We need to migrate from openai v 0.28 to >=1.0.

This is a pretty big upgrade. To ensure it goes smoothly, we must test all usages of the openai library, without using the actual syntax used currently, if that makes sense. Tests should pass on v 0.28 AND v1.0, so we know we have a successful upgrade.

Please plan out the tests. Be careful, meticulous, and thorough.

IMPORTANT: YOU ARE NOT PERFORMING THE MIGRATION. ONLY TESTING ALL OPENAI USAGES.

Sweep: Overhaul Documentation

Checklist
  • Modify docs/language_models_client.mdf4e2b6b Edit
  • Running GitHub Actions for docs/language_models_client.mdEdit
  • Modify docs/language_models_client.rst790f1c9 Edit
  • Running GitHub Actions for docs/language_models_client.rstEdit
  • Modify docs/modules.rst4c7ffd7 Edit
  • Running GitHub Actions for docs/modules.rstEdit

Sweep: Set up tests for all OpenAI content for a migration to the 1.0 upgrade

We need to migrate from openai v 0.28 to >=1.0.

This is a pretty big upgrade. To ensure it goes smoothly, we must test all usages of the openai library, without using the actual syntax used currently, if that makes sense. Tests should pass on v 0.28 AND v1.0, so we know we have a successful upgrade.

V1.0 Change Documentation:

We have released a new major version of our SDK, and we recommend upgrading promptly.
 
It's a total rewrite of the library, so many things have changed, but we've made upgrading easy with a code migration script and detailed docs below. It was extensively [beta tested](https://github.com/openai/openai-python/discussions/631) prior to release.
 
## Getting started

pip install --upgrade openai

 
## What's changed
* Auto-retry with backoff if there's an error
* Proper types (for mypy/pyright/editors)
* You can now instantiate a client, instead of using a global default.
* Switch to explicit client instantiation
* Weights and Biases CLI will now be included in their own package
 
## Migration guide
_For Azure OpenAI users, see [Microsoft's Azure-specific migration guide](https://aka.ms/oai/v1-python-migration)._
 
### Automatic migration with grit
You can automatically migrate your codebase using [grit](https://grit.io/), either [online](https://app.grit.io/migrations/new/openai) or with the following CLI command on Mac or Linux:

openai migrate

 
The grit binary executes entirely locally with AST-based transforms.
 
Be sure to audit its changes: we suggest ensuring you have a clean working tree beforehand, and running `git add --patch` afterwards. Note that grit.io also offers opt-in automatic fixes powered by AI.
 
#### Automatic migration with grit on Windows
To use grit to migrate your code on Windows, you will need to use Windows Subsystem for Linux (WSL). [Installing WSL](https://learn.microsoft.com/en-us/windows/wsl/install) is quick and easy, and you do not need to keep using Linux once the command is done.
 
Here's a step-by-step guide for setting up and using WSL for this purpose:
 
1. Open a PowerShell or Command Prompt as an administrator and run `wsl --install`.
2. Restart your computer.
3. Open the WSL application.
4. In the WSL terminal, `cd` into the appropriate directory (e.g., `cd /mnt/c/Users/Myself/my/code/`) and then run the following commands:
    ```shell
    curl -fsSL https://docs.grit.io/install | bash
    grit install
    grit apply openai
    ```
 
Then, you can close WSL and go back to using Windows.
 
#### Automatic migration with grit in Jupyter Notebooks
If your Jupyter notebooks are not in source control, they will be more difficult to migrate. You may want to copy each cell into grit's web interface, and paste the output back in.
 
If you need to migrate in a way that preserves use of the module-level client instead of instantiated clients, you can use [the openai_global grit migration](https://app.grit.io/migrations/new/openai_global) instead.
 
### Initialization
```python
# old
import openai
 
openai.api_key = os.environ['OPENAI_API_KEY']
 
# new
from openai import OpenAI
 
client = OpenAI(
  api_key=os.environ['OPENAI_API_KEY'],  # this is also the default, it can be omitted
)

Responses

Response objects are now pydantic models and no longer conform to the dictionary shape. However you can easily convert them to a dictionary with model.model_dump().

# before
import json
import openai
 
completion = openai.Completion.create(model='curie')
print(completion['choices'][0]['text'])
print(completion.get('usage'))
print(json.dumps(completion, indent=2))
 
# after
from openai import OpenAI
 
client = OpenAI()
 
completion = client.completions.create(model='curie')
print(completion.choices[0].text)
print(dict(completion).get('usage'))
print(completion.model_dump_json(indent=2))

Async client

We do not support calling asynchronous methods in the module-level client, instead you will have to instantiate an async client.

The rest of the API is exactly the same as the synchronous client.

# old
import openai
 
completion = openai.ChatCompletion.acreate(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hello world"}])
 
# new
from openai import AsyncOpenAI
 
client = AsyncOpenAI()
completion = await client.chat.completions.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hello world"}])

Module client

Important

We highly recommend instantiating client instances instead of relying on the global client.
We also expose a global client instance that is accessible in a similar fashion to versions prior to v1.

import openai
 
# optional; defaults to `os.environ['OPENAI_API_KEY']`
openai.api_key = '...'
 
# all client options can be configured just like the `OpenAI` instantiation counterpart
openai.base_url = "https://..."
openai.default_headers = {"x-foo": "true"}
 
completion = openai.chat.completions.create(
    model="gpt-4",
    messages=[
        {
            "role": "user",
            "content": "How do I output all files in a directory using Python?",
        },
    ],
)
print(completion.choices[0].message.content)

The API is the exact same as the standard client instance based API.

This is intended to be used within REPLs or notebooks for faster iteration, not in application code.

We recommend that you always instantiate a client (e.g., with client = OpenAI()) in application code because:

  • It can be difficult to reason about where client options are configured
  • It's not possible to change certain client options without potentially causing race conditions
  • It's harder to mock for testing purposes
  • It's not possible to control cleanup of network connections

Pagination

All list() methods that support pagination in the API now support automatic iteration, for example:

from openai import OpenAI
 
client = OpenAI()
 
for job in client.fine_tuning.jobs.list(limit=1):
    print(job)

Previously you would have to explicitly call a .auto_paging_iter() method instead. See the README for more details.

Azure OpenAI

To use this library with Azure OpenAI, use the AzureOpenAI class instead of the OpenAI

class.

A more comprehensive Azure-specific migration guide is available on the Microsoft website.

Important

The Azure API shape differs from the core API shape which means that the static types for responses / params won't always be correct.

from openai import AzureOpenAI
 
# gets the API Key from environment variable AZURE_OPENAI_API_KEY
client = AzureOpenAI(
    # https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#rest-api-versioning
    api_version="2023-07-01-preview",
    # https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/create-resource?pivots=web-portal#create-a-resource
    azure_endpoint="https://example-endpoint.openai.azure.com",
)
 
completion = client.chat.completions.create(
    model="deployment-name",  # e.g. gpt-35-instant
    messages=[
        {
            "role": "user",
            "content": "How do I output all files in a directory using Python?",
        },
    ],
)
print(completion.model_dump_json(indent=2))

In addition to the options provided in the base OpenAI client, the following options are provided:

  • azure_endpoint
  • azure_deployment
  • api_version
  • azure_ad_token
  • azure_ad_token_provider

An example of using the client with Azure Active Directory can be found here.

All name changes

Note: all a* methods have been removed; the async client must be used instead.

  • openai.api_base -> openai.base_url
  • openai.proxy -> openai.proxies (docs)
  • openai.InvalidRequestError -> openai.BadRequestError
  • openai.Audio.transcribe() -> client.audio.transcriptions.create()
  • openai.Audio.translate() -> client.audio.translations.create()
  • openai.ChatCompletion.create() -> client.chat.completions.create()
  • openai.Completion.create() -> client.completions.create()
  • openai.Edit.create() -> client.edits.create()
  • openai.Embedding.create() -> client.embeddings.create()
  • openai.File.create() -> client.files.create()
  • openai.File.list() -> client.files.list()
  • openai.File.retrieve() -> client.files.retrieve()
  • openai.File.download() -> client.files.retrieve_content()
  • openai.FineTune.cancel() -> client.fine_tunes.cancel()
  • openai.FineTune.list() -> client.fine_tunes.list()
  • openai.FineTune.list_events() -> client.fine_tunes.list_events()
  • openai.FineTune.stream_events() -> client.fine_tunes.list_events(stream=True)
  • openai.FineTune.retrieve() -> client.fine_tunes.retrieve()
  • openai.FineTune.delete() -> client.fine_tunes.delete()
  • openai.FineTune.create() -> client.fine_tunes.create()
  • openai.FineTuningJob.create() -> client.fine_tuning.jobs.create()
  • openai.FineTuningJob.cancel() -> client.fine_tuning.jobs.cancel()
  • openai.FineTuningJob.delete() -> client.fine_tuning.jobs.create()
  • openai.FineTuningJob.retrieve() -> client.fine_tuning.jobs.retrieve()
  • openai.FineTuningJob.list() -> client.fine_tuning.jobs.list()
  • openai.FineTuningJob.list_events() -> client.fine_tuning.jobs.list_events()
  • openai.Image.create() -> client.images.generate()
  • openai.Image.create_variation() -> client.images.create_variation()
  • openai.Image.create_edit() -> client.images.edit()
  • openai.Model.list() -> client.models.list()
  • openai.Model.delete() -> client.models.delete()
  • openai.Model.retrieve() -> client.models.retrieve()
  • openai.Moderation.create() -> client.moderations.create()
  • openai.api_resources -> openai.resources

Removed

  • openai.api_key_path
  • openai.app_info
  • openai.debug
  • openai.log
  • openai.OpenAIError
  • openai.Audio.transcribe_raw()
  • openai.Audio.translate_raw()
  • openai.ErrorObject
  • openai.Customer
  • openai.api_version
  • openai.verify_ssl_certs
  • openai.api_type
  • openai.enable_telemetry
  • openai.ca_bundle_path
  • openai.requestssession (we now use httpx)
  • openai.aiosession (we now use httpx)
  • openai.Deployment (only used for Azure)
  • openai.Engine
  • openai.File.find_matching_files()
  • openai.embeddings_utils (now in the cookbook)


Please plan out the tests. Be careful, meticulous, and thorough. 

Sweep: Fix the Documentation links. Yeah

Details

The links added in the four new jupyter notebook examples (docs/guides/*.ipynb) point to the wrong locations. They should point to the api_reference directory.

Sweep: Set up project for ReadTheDocs integration.

Details

Let's get up and running for adding ReadTheDocs and turning our existing documentation into a ReadTheDocs/Sphinx compatible version!

The starter tutorial, if you need it, is below:

Read the Docs tutorial
======================

In this tutorial you will create a documentation project on Read the Docs
by importing a Sphinx project from a GitHub repository,
tailor its configuration, and explore several useful features of the platform.

The tutorial is aimed at people interested in learning
how to use Read the Docs to host their documentation projects.
You will fork a fictional software library
similar to the one developed in the :doc:`official Sphinx tutorial <sphinx:tutorial/index>`.
No prior experience with Sphinx is required
and you can follow this tutorial without having done the Sphinx one.

The only things you will need are
a web browser, an Internet connection, and a GitHub account
(you can `register for a free account <https://github.com/signup>`_ if you don't have one).
You will use Read the Docs Community, which means that the project will be public.

Getting started
---------------

Preparing your project on GitHub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To start, `sign in to GitHub <https://github.com/login>`_
and navigate to `the tutorial GitHub template <https://github.com/readthedocs/tutorial-template/>`_,
where you will see a green :guilabel:`Use this template` button.
Click it to open a new page that will ask you for some details:

* Leave the default "Owner", or change it to something better for a tutorial project.
* Introduce an appropriate "Repository name", for example ``rtd-tutorial``.
* Make sure the project is "Public", rather than "Private".

After that, click on the green :guilabel:`Create repository from template` button,
which will generate a new repository on your personal account
(or the one of your choosing).
This is the repository you will import on Read the Docs,
and it contains the following files:

``.readthedocs.yaml``
  Read the Docs configuration file.
  Required to setup the documentation build process.

``README.rst``
  Basic description of the repository, you will leave it untouched.

``pyproject.toml``
  Python project metadata that makes it installable.
  Useful for automatic documentation generation from sources.

``lumache.py``
  Source code of the fictional Python library.

``docs/``
  Directory holding all the Sphinx documentation sources,
  including the Sphinx configuration ``docs/source/conf.py``
  and the root document ``docs/source/index.rst`` written in reStructuredText.

.. figure:: /_static/images/tutorial/github-template.png
   :width: 80%
   :align: center
   :alt: GitHub template for the tutorial

   GitHub template for the tutorial

Sign up for Read the Docs
~~~~~~~~~~~~~~~~~~~~~~~~~

To sign up for a Read the Docs account,
navigate to the `Sign Up page <https://readthedocs.org/accounts/signup/>`_
and choose the option :guilabel:`Sign up with GitHub`.
On the authorization page, click the green :guilabel:`Authorize readthedocs` button.

.. figure:: /_static/images/tutorial/github-authorization.png
   :width: 60%
   :align: center
   :alt: GitHub authorization page

   GitHub authorization page

.. note::

   Read the Docs needs elevated permissions to perform certain operations
   that ensure that the workflow is as smooth as possible,
   like installing :term:`webhooks <webhook>`.
   If you want to learn more,
   check out :ref:`guides/setup/git-repo-automatic:permissions for connected accounts`.

After that, you will be redirected to Read the Docs,
where you will need to confirm your e-mail and username.
Clicking the :guilabel:`Sign Up »` button will create your account
and redirect you to your :term:`dashboard`.

By now, you should have two email notifications:

* One from GitHub, telling you that "A third-party OAuth application ...
  was recently authorized to access your account". You don't need to do
  anything about it.
* Another one from Read the Docs, prompting you to "verify your email
  address". Click on the link to finalize the process.

Once done, your Read the Docs account is created
and ready to import your first project.

Welcome!

.. figure:: /_static/images/tutorial/rtd-empty-dashboard.png
   :width: 80%
   :align: center
   :alt: Read the Docs empty dashboard

   Read the Docs empty dashboard

.. note::

   Our commercial site offers some extra features,
   like support for private projects.
   You can learn more about :doc:`our two different sites </choosing-a-site>`.

First steps
-----------

Importing the project to Read the Docs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To import your GitHub project to Read the Docs,
first click on the :guilabel:`Import a Project` button on your dashboard
(or browse to `the import page <https://readthedocs.org/dashboard/import/>`_ directly).
You should see your GitHub account under the "Filter repositories" list on the right.
If the list of repositories is empty, click the |:arrows_counterclockwise:| button,
and after that all your repositories will appear on the center.

.. figure:: /_static/images/tutorial/rtd-import-projects.gif
   :width: 80%
   :align: center
   :alt: Import projects workflow

   Import projects workflow

Locate your ``rtd-tutorial`` project
(possibly clicking :guilabel:`next ››` at the bottom if you have several pages of projects),
and then click on the |:heavy_plus_sign:| button to the right of the name.
The next page will ask you to fill some details about your Read the Docs project:

Name
  The name of the project. It has to be unique across all the service,
  so it is better if you prepend your username,
  for example ``{username}-rtd-tutorial``.

Repository URL
  The URL that contains the sources. Leave the automatically filled value.

Default branch
  Name of the default branch of the project, leave it as ``main``.

After hitting the :guilabel:`Next` button, you will be redirected to the :term:`project home`.
You just created your first project on Read the Docs! |:tada:|

.. figure:: /_static/images/tutorial/rtd-project-home.png
   :width: 80%
   :align: center
   :alt: Project home

   Project home

Checking the first build
~~~~~~~~~~~~~~~~~~~~~~~~

Read the Docs will try to build the documentation of your project
right after you create it.
To see the build logs,
click on the :guilabel:`Your documentation is building` link on the :term:`project home`,
or alternatively navigate to the "Builds" page,
then open the one on top (the most recent one).

If the build has not finished yet by the time you open it,
you will see a spinner next to a "Installing" or "Building" indicator,
meaning that it is still in progress.

.. figure:: /_static/images/tutorial/rtd-first-successful-build.png
   :width: 80%
   :align: center
   :alt: First successful documentation build

   First successful documentation build

When the build finishes, you will see a green "Build completed" indicator,
the completion date, the elapsed time,
and a link to see the corresponding documentation.
If you now click on :guilabel:`View docs`, you will see your documentation live!

.. figure:: /_static/images/tutorial/rtd-first-light.png
   :width: 80%
   :align: center
   :alt: HTML documentation live on Read the Docs

   HTML documentation live on Read the Docs

.. note::

   Advertisement is one of our main sources of revenue.
   If you want to learn more about how do we fund our operations
   and explore options to go ad-free,
   check out our `Sustainability page <https://readthedocs.org/sustainability/>`_.

   If you don't see the ad, you might be using an ad blocker.
   Our EthicalAds network respects your privacy, doesn't target you,
   and tries to be as unobstrusive as possible,
   so we would like to kindly ask you to :doc:`not block us </advertising/ad-blocking>` |:heart:|

Basic configuration changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can now proceed to make some basic configuration adjustments.
Navigate back to the :term:`project page`
and click on the :guilabel:`⚙ Admin` button, which will open the Settings page.

First of all, add the following text in the description:

    Lumache (/lu'make/) is a Python library for cooks and food lovers
    that creates recipes mixing random ingredients.

Then set the project homepage to ``https://world.openfoodfacts.org/``,
and write ``food, python`` in the list of tags.
All this information will be shown on your project home.

After that, configure your email so you get a notification if the build fails.
To do so, click on the :guilabel:`Notifications` link on the left,
type the email where you would like to get the notification,
and click the :guilabel:`Add` button.
After that, your email will be shown under "Existing Notifications".

Trigger a build from a pull request
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Read the Docs allows you to :doc:`trigger builds from GitHub pull requests </pull-requests>`
and gives you a preview of how the documentation would look like with those changes.

To enable that functionality, first click on the :guilabel:`Advanced Settings` link on the left
under the :guilabel:`⚙ Admin` menu, check the "Build pull requests for this project" checkbox,
and click the :guilabel:`Save` button at the bottom of the page.

Next, navigate to your GitHub repository, locate the file ``docs/source/index.rst``,
and click on the |:pencil2:| icon on the top-right with the tooltip "Edit this file"
to open a web editor (more information `on their documentation`__).

__  https://docs.github.com/en/github/managing-files-in-a-repository/managing-files-on-github/editing-files-in-your-repository

.. figure:: /_static/images/tutorial/gh-edit.png
   :width: 80%
   :align: center
   :alt: File view on GitHub before launching the editor

   File view on GitHub before launching the editor

In the editor, add the following sentence to the file:

.. code-block:: rst
   :caption: docs/source/index.rst

   Lumache has its documentation hosted on Read the Docs.

Write an appropriate commit message,
and choose the "Create a **new branch** for this commit and start a pull request" option,
typing a name for the new branch.
When you are done, click the green :guilabel:`Propose changes` button,
which will take you to the new pull request page,
and there click the :guilabel:`Create pull request` button below the description.

.. figure:: /_static/images/tutorial/gh-pr-build.png
   :width: 80%
   :align: center
   :alt: Read the Docs building the pull request from GitHub

   Read the Docs building the pull request from GitHub

After opening the pull request, a Read the Docs check will appear
indicating that it is building the documentation for that pull request.
If you click on the :guilabel:`Details` link while it is building,
you will access the build logs,
otherwise it will take you directly to the documentation.
When you are satisfied, you can merge the pull request!

Adding a configuration file
---------------------------

The Admin tab of the :term:`project home` allows you
to change some *global* configuration values of your project.
In addition, you can further customize the building process
using the ``.readthedocs.yaml`` :doc:`configuration file </config-file/v2>`.
This has several advantages:

- The configuration lives next to your code and documentation, tracked by version control.
- It can be different for every version (more on versioning in the next section).
- Some configurations are only available using the config file.

This configuration file should be part of your Git repository.
It should be located in the base folder of the repository and be named ``.readthedocs.yaml``.

.. TODO: We are adding a how-to that we need to include in this tutorial.
.. Maybe by reference or maybe as full-featured content.

In this section, we will show you some examples of what a configuration file should contain.

.. tip::

   Settings that apply to the entire project are controlled in the web dashboard,
   while settings that are version or build specific are better in the YAML file.

Changing the Python version
~~~~~~~~~~~~~~~~~~~~~~~~~~~

For example, to explicitly use Python 3.8 to build your project,
navigate to your GitHub repository, click on ``.readthedocs.yaml`` file and then in the pencil icon ✏️ to edit the file
and change the Python version as follows:

.. code-block:: yaml
   :caption: .readthedocs.yaml
   :emphasize-lines: 6

   version: 2

   build:
     os: "ubuntu-22.04"
     tools:
       python: "3.8"

   python:
     install:
       - requirements: docs/requirements.txt

   sphinx:
     configuration: docs/source/conf.py

The purpose of each key is:

``version``
  Mandatory, specifies :doc:`version 2 of the configuration file </config-file/v2>`.

``build.os``
  Required to specify the Python version,
  :ref:`states the name of the base image <config-file/v2:build.os>`.

``build.tools.python``
  Declares the Python version to be used.

``python.install.requirements``
  Specifies the Python dependencies to install required to build the documentation.

After you commit these changes, go back to your project home,
navigate to the "Builds" page, and open the new build that just started.
You will notice that one of the lines contains ``python -mvirtualenv``:
if you click on it, you will see the full output of the corresponding command,
stating that it used Python 3.8.6 to create the virtual environment.

.. figure:: /_static/images/tutorial/build-python3.8.png
   :width: 80%
   :align: center
   :alt: Read the Docs build using Python 3.8

   Read the Docs build using Python 3.8

Making warnings more visible
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you navigate to your HTML documentation,
you will notice that the index page looks correct
but the API section is empty.
This is a very common issue with Sphinx,
and the reason is stated in the build logs.
On the build page you opened before,
click on the :guilabel:`View raw` link on the top right,
which opens the build logs in plain text,
and you will see several warnings:

.. code-block:: text

   WARNING: [autosummary] failed to import 'lumache': no module named lumache
   ...
   WARNING: autodoc: failed to import function 'get_random_ingredients' from module 'lumache'; the following exception was raised:
   No module named 'lumache'
   WARNING: autodoc: failed to import exception 'InvalidKindError' from module 'lumache'; the following exception was raised:
   No module named 'lumache'

To spot these warnings more easily and allow you to address them,
you can add the ``sphinx.fail_on_warning`` option to your Read the Docs configuration file.
For that, navigate to GitHub, locate the ``.readthedocs.yaml`` file you created earlier,
click on the |:pencil2:| icon, and add these contents:

.. code-block:: yaml
   :caption: .readthedocs.yaml
   :emphasize-lines: 12-13

   version: 2

   build:
     os: "ubuntu-22.04"
     tools:
       python: "3.8"

   python:
     install:
       - requirements: docs/requirements.txt

   sphinx:
     configuration: docs/source/conf.py
     fail_on_warning: true

At this point, if you navigate back to your "Builds" page,
you will see a ``Failed`` build, which is exactly the intended result:
the Sphinx project is not properly configured yet,
and instead of rendering an empty API page, now the build fails.

The reason :py:mod:`sphinx:sphinx.ext.autosummary` and :py:mod:`sphinx:sphinx.ext.autodoc`
fail to import the code is because it is not installed.
Luckily, the ``.readthedocs.yaml`` also allows you to specify
which requirements to install.

To install the library code of your project,
go back to editing ``.readthedocs.yaml`` on GitHub and modify it as follows:

.. code-block:: yaml
   :caption: .readthedocs.yaml
   :emphasize-lines: 4-6

   python:
     install:
       - requirements: docs/requirements.txt
       # Install our python package before building the docs
       - method: pip
         path: .

With this change, Read the Docs will install the Python code
before starting the Sphinx build, which will finish seamlessly.
If you go now to the API page of your HTML documentation,
you will see the ``lumache`` summary!

Enabling PDF and EPUB builds
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sphinx can build several other formats in addition to HTML, such as PDF and EPUB.
You might want to enable these formats for your project
so your users can read the documentation offline.

To do so, add this extra content to your ``.readthedocs.yaml``:

.. code-block:: yaml
   :caption: .readthedocs.yaml
   :emphasize-lines: 5-7

   sphinx:
     configuration: docs/source/conf.py
     fail_on_warning: true

   formats:
     - pdf
     - epub

After this change, PDF and EPUB downloads will be available
both from the "Downloads" section of the :term:`project home`,
as well as the :term:`flyout menu`.

.. figure:: /_static/images/tutorial/flyout-downloads.png
   :align: center
   :alt: Downloads available from the flyout menu

   Downloads available from the flyout menu

Versioning documentation
------------------------

Read the Docs allows you to have :doc:`several versions of your documentation </versions>`,
in the same way that you have several versions of your code.
By default, it creates a ``latest`` version
that points to the default branch of your version control system
(``main`` in the case of this tutorial),
and that's why the URLs of your HTML documentation contain the string ``/latest/``.

Creating a new version
~~~~~~~~~~~~~~~~~~~~~~

Let's say you want to create a ``1.0`` version of your code,
with a corresponding ``1.0`` version of the documentation.
For that, first navigate to your GitHub repository, click on the branch selector,
type ``1.0.x``, and click on "Create branch: 1.0.x from 'main'"
(more information `on their documentation`__).

__ https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository

Next, go to your :term:`project home`, click on the :guilabel:`Versions` button,
and under "Active Versions" you will see two entries:

- The ``latest`` version, pointing to the ``main`` branch.
- A new ``stable`` version, pointing to the ``origin/1.0.x`` branch.

.. figure:: /_static/images/tutorial/active-versions.png
   :width: 80%
   :align: center
   :alt: List of active versions of the project

   List of active versions of the project

Right after you created your branch,
Read the Docs created a new special version called ``stable`` pointing to it,
and started building it. When the build finishes,
the ``stable`` version will be listed in the :term:`flyout menu`
and your readers will be able to choose it.

.. note::

   Read the Docs :ref:`follows some rules <versions:how we envision versions working>`
   to decide whether to create a ``stable`` version pointing to your new branch or tag.
   To simplify, it will check if the name resembles a version number
   like ``1.0``, ``2.0.3`` or ``4.x``.

Now you might want to set ``stable`` as the *default version*,
rather than ``latest``,
so that users see the ``stable`` documentation
when they visit the :term:`root URL` of your documentation
(while still being able to change the version in the flyout menu).

For that, go to the :guilabel:`Advanced Settings` link
under the :guilabel:`⚙ Admin` menu of your project home,
choose ``stable`` in the "Default version*" dropdown,
and hit :guilabel:`Save` at the bottom.
Done!

Modifying versions
~~~~~~~~~~~~~~~~~~

Both ``latest`` and ``stable`` are now *active*, which means that
they are visible for users, and new builds can be triggered for them.
In addition to these, Read the Docs also created an *inactive* ``1.0.x``
version, which will always point to the ``1.0.x`` branch of your repository.

.. figure:: /_static/images/tutorial/inactive-versions.png
   :width: 80%
   :align: center
   :alt: List of inactive versions of the project

   List of inactive versions of the project

Let's activate the ``1.0.x`` version.
For that, go to the "Versions" on your :term:`project home`,
locate ``1.0.x`` under "Activate a version",
and click on the :guilabel:`Activate` button.
This will take you to a new page with two checkboxes,
"Active" and "Hidden". Check only "Active",
and click :guilabel:`Save`.

After you do this, ``1.0.x`` will appear on the "Active Versions" section,
and a new build will be triggered for it.

.. note::

   You can read more about :ref:`hidden versions <versions:hidden>`
   in our documentation.

.. "Show a warning for old versions" feature is not available anymore.
   We should re-write this section once we have the notification addons rolled out.


   Show a warning for old versions
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   When your project matures, the number of versions might increase.
   Sometimes you will want to warn your readers
   when they are browsing an old or outdated version of your documentation.

   To showcase how to do that, let's create a ``2.0`` version of the code:
   navigate to your GitHub repository, click on the branch selector,
   type ``2.0.x``, and click on "Create branch: 2.0.x from 'main'".
   This will trigger two things:

   - Since ``2.0.x`` is your newest branch, ``stable`` will switch to tracking it.
   - A new ``2.0.x`` version will be created on your Read the Docs project.
   - Since you already have an active ``stable`` version, ``2.0.x`` will be activated.

   From this point, ``1.0.x`` version is no longer the most up to date one.
   To display a warning to your readers, go to the :guilabel:`⚙ Admin` menu of your project home,
   click on the :guilabel:`Advanced Settings` link on the left,
   enable the "Show version warning" checkbox, and click the :guilabel:`Save` button.

   If you now browse the ``1.0.x`` documentation, you will see a warning on top
   encouraging you to browse the latest version instead. Neat!

   .. figure:: /_static/images/tutorial/old-version-warning.png
      :width: 80%
      :align: center
      :alt: Warning for old versions

      Warning for old versions

Getting insights from your projects
-----------------------------------

Once your project is up and running, you will probably want to understand
how readers are using your documentation, addressing some common questions like:

- what pages are the most visited pages?
- what search terms are the most frequently used?
- are readers finding what they look for?

Read the Docs offers you some analytics tools to find out the answers.

Browsing traffic analytics
~~~~~~~~~~~~~~~~~~~~~~~~~~

The :doc:`/analytics` view shows the top viewed documentation pages of the past 30 days,
plus a visualization of the daily views during that period.
To generate some artificial views on your newly created project,
you can first click around the different pages of your project,
which will be accounted immediately for the current day statistics.

To see the Traffic Analytics view, go back the :term:`project page` again,
click on the :guilabel:`⚙ Admin` button,
and then click on the :guilabel:`Traffic Analytics` section.
You will see the list of pages in descending order of visits,
as well as a plot similar to the one below.

.. figure:: /_static/images/tutorial/traffic-analytics-plot.png
   :width: 80%
   :align: center
   :alt: Traffic Analytics plot

   Traffic Analytics plot

.. note::

   The Traffic Analytics view explained above gives you a simple overview
   of how your readers browse your documentation. It has the advantage that
   it stores no identifying information about your visitors,
   and therefore it respects their privacy.
   However, you might want to get more detailed data by
   :ref:`enabling Google Analytics <analytics:Enabling Google Analytics on your Project>`.
   Notice though that we take some extra measures to :ref:`respect user
   privacy <advertising/advertising-details:analytics>`
   when they visit projects that have Google Analytics enabled,
   and this might reduce the number of visits counted.

Finally, you can also download this data for closer inspection.
To do that, scroll to the bottom of the page
and click on the :guilabel:`Download all data` button.
That will prompt you to download a :abbr:`CSV (Comma-Separated Values)` file
that you can process any way you want.

Browsing search analytics
~~~~~~~~~~~~~~~~~~~~~~~~~

Apart from traffic analytics, Read the Docs also offers the possibility
to inspect :doc:`what search terms your readers use </guides/search-analytics>`
on your documentation.
This can inform decisions on what areas to reinforce,
or what parts of your project are less understood or more difficult to find.

To generate some artificial search statistics on the project,
go to the HTML documentation, locate the Sphinx search box on the left,
type ``ingredients``, and press the :kbd:`Enter` key.
You will be redirected to the search results page, which will show two entries.

Next, go back to the :guilabel:`⚙ Admin` section of your project page,
and then click on the :guilabel:`Search Analytics` section.
You will see a table with the most searched queries
(including the ``ingredients`` one you just typed),
how many results did each query return, and how many times it was searched.
Below the queries table, you will also see a visualization
of the daily number of search queries during the past 30 days.

.. figure:: /_static/images/tutorial/search-analytics-terms.png
   :width: 80%
   :align: center
   :alt: Most searched terms

   Most searched terms

Like the Traffic Analytics, you can also download the whole dataset in CSV format
by clicking on the :guilabel:`Download all data` button.

Where to go from here
---------------------

This is the end of the tutorial. You started by forking a GitHub repository
and importing it on Read the Docs, building its HTML documentation,
and then went through a series of steps to customize the build process,
tweak the project configuration, and add new versions.

Here you have some resources to continue learning about documentation
and Read the Docs:

- You can learn more about the functionality of the platform
  by going over our :doc:`features </reference/features>` page.
- To make the most of the documentation generators that are supported,
  you can read the :doc:`Sphinx tutorial <sphinx:tutorial/index>`
  or the `MkDocs User Guide <https://www.mkdocs.org/user-guide/>`_.
- Display example projects and read the source code in :doc:`/examples`.
- Whether you are a documentation author, a project administrator, a developer, or a designer,
  you can follow our how-to guides that cover specific tasks,
  available under :doc:`/guides/index`.
- For private project support and other enterprise features,
  you can use :doc:`our commercial service </commercial/index>`
  (and if in doubt, check out :doc:`/choosing-a-site`).
- Do you want to join a global community of fellow `documentarians <writethedocs:documentarians>`?
  Check out `Write the Docs <https://www.writethedocs.org/>`_ and
  :doc:`its Slack workspace <writethedocs:slack>`.
- Do you want to contribute to Read the Docs?
  We greatly appreciate it! Check out :doc:`rtd-dev:contribute`.

Happy documenting!
Checklist
  • Create docs/source/conf.pybf1169e Edit
  • Running GitHub Actions for docs/source/conf.pyEdit
  • Create docs/source/index.rst011593c Edit
  • Running GitHub Actions for docs/source/index.rstEdit
  • Create .readthedocs.yaml5a06559 Edit
  • Running GitHub Actions for .readthedocs.yamlEdit
  • Modify dspy/primitives/module.pyfaeb6dc Edit
  • Running GitHub Actions for dspy/primitives/module.pyEdit
  • Modify dspy/primitives/assertions.pyc54a118 Edit
  • Running GitHub Actions for dspy/primitives/assertions.pyEdit
  • Modify dspy/primitives/box.py526e993 Edit
  • Running GitHub Actions for dspy/primitives/box.pyEdit
  • Modify dspy/primitives/example.py735516c Edit
  • Running GitHub Actions for dspy/primitives/example.pyEdit
  • Modify dspy/primitives/prediction.py62d69ad Edit
  • Running GitHub Actions for dspy/primitives/prediction.pyEdit
  • Modify dspy/primitives/program.py8b7b1b2 Edit
  • Running GitHub Actions for dspy/primitives/program.pyEdit
  • Modify dspy/primitives/python_interpreter.py9552a01 Edit
  • Running GitHub Actions for dspy/primitives/python_interpreter.pyEdit

Sweep: `Signature` prompt skeleton

Details

Summary

To enhance the generative capabilities of DSPy, we are proposing the integration of an "immutable" prompt "skeleton" mechanism that mimics DeepMind's FunSearch methodology as described in their paper and illustrated in Extended Data Figure 1. This feature will allow DSPy to merge ideas by sampling different signature variations and prompting the Language Model (LM) to fill in dynamic content within a consistent structural backdrop.

Background

According to DeepMind's research, their prompting structure involved selecting and sorting two programs from a database (referred to as priority v0 and priority v1), to encourage the LM to merge ideas. The prompt also included a new priority function with an empty body (priority v2) for the LM to complete. This process results in the generation of novel programs by leveraging existing knowledge and the generative power of the LM within a fixed format.

Goals

  • Introduce a fixed prompt skeleton within DSPy signatures that acts as an "immutable" structure for prompt construction.
  • Implement a sampling mechanism to select k signature variations and integrate parts into the prompt skeleton for dynamic content population.
  • Retain DSPy signature features, such as input/output field descriptions and constraints, within this new methodology.
  • Ensure that DSPy's compiler accommodates the prompt skeleton with correct processing.

Specifications

  • Immutable Prompt Skeleton: Utilize the Signature class to define an immutable program skeleton and dynamic placeholders to be filled.
  • Signature Sampling Logic: Develop logic for sampling k signature variations that should be external to the Signature class, potentially as part of the module or a dedicated retriever algorithm.
  • Module Execution: Make sure Modules are capable of executing Python code generated through Signature prompting mechanisms, incorporating generated variations.
  • Teleprompter/Compiler: Have the teleprompter/compiler orchestrate input from different components (Signature, Module, Retriever) and construct prompts that are composed, persisted, and if necessary, executed iteratively.

Action Items

  • Define dynamic placeholders within the Signature class.
  • Implement the Signature sampling logic in a helper component or within the Module.
  • Adjust Modules to execute code from dynamic prompt constructions.
  • Update the Teleprompter/Compiler to compile and persist prompts using the sampled Signature variations.
  • Design an interface for the retriever that can interact with the database of Signatures for sampling.
  • Implement persistence and iterative mechanisms where required.

Additional Context

The implementation should be mindful of the DSPy's Signature class's existing architecture and mechanisms. The immutable prompt skeleton should function effectively with current input/output field constraints. The new feature should lead to the innovation of relevant and diverse solutions within the DSPy framework, leveraging the established work from DeepMind's research.

Relevant Files

To guide the implementation and provide context around how and where the changes might integrate within the DSPy codebase, the following files have been identified as possibly relevant:

Ensure ALL action items are well thought out, thorough, tested, and finished.

Checklist
  • Modify dspy/teleprompt/signature_opt.pybfa03c2 Edit
  • Running GitHub Actions for dspy/teleprompt/signature_opt.pyEdit
  • Create dsp/modules/signature_sampler.pye9740c8 Edit
  • Running GitHub Actions for dsp/modules/signature_sampler.pyEdit
  • Create dsp/modules/module.pya47f75e Edit
  • Running GitHub Actions for dsp/modules/module.pyEdit
  • Modify dsp/primitives/compiler.pye450e00 Edit
  • Running GitHub Actions for dsp/primitives/compiler.pyEdit
  • Create dsp/retriever/retriever_interface.py136e208 Edit
  • Running GitHub Actions for dsp/retriever/retriever_interface.pyEdit
  • Modify dsp/primitives/compiler.py7a1b36b Edit
  • Running GitHub Actions for dsp/primitives/compiler.pyEdit

Sweep: Ensure `datasets` in the `dspy/` folder has documentation.

Details

All the documentation should be written back to the docs folder. If a documentation section is already present, modify, it, do not add a new one.

Ensure the documentation does more than describe the code—you should identify the philosophical usage/purpose of datasets, (draw from the README.md for this) and ensure that how we achieve that is written in your documentation, in addition to actual examples of how to use the thing you are documenting. For examples, please refer to the jupyter notebooks.

Good luck. Please be thorough and comprehensive.

Checklist

Sweep: Revise `docs/README.rst` for leftover HTML tags, and other syntax issues.

Details

docs/README.rst was converted from README.md via pandoc. Spare HTML tags are left behind, and things do not work properly at the moment.

Please thoroughly revise docs/README.rst so that all of it, especially the sections after 3b), are syntactically correct. (ie: no HTML tags, code/links properly formatted, etc...)

The documentation section is also now no longer necessary, so ensure it is up to date.

Checklist
  • Modify docs/README.rsta18ce01 Edit
  • Running GitHub Actions for docs/README.rstEdit

Sweep: Add documentation for `Assertions`, in `dspy/assert`.

Details

Assertions were very recently added, but not really documented.

Please be thorough, search the whole repository, and figure out what assertions are, how to use them, what they do, the exact syntax, every case in which they can be used, and document all of it.

This documentation should be in a subfolder of docs/primitives/

Checklist
  • Create docs/primitives/assertions.md645444c Edit

Sweep: Update `teleprompt` documentation

Please update the teleprompters.md documentation in docs/teleprompters. This documentation is based on /dspy/teleprompt/*.

Good luck. Please be thorough and comprehensive.

Checklist
  • Modify docs/teleprompters/teleprompters.mde344da5 Edit
  • Running GitHub Actions for docs/teleprompters/teleprompters.mdEdit

Sweep: Ensure `signatures` in the `dspy/` folder has documentation.

Details

Details

All the documentation should be written back to the docs folder. If a documentation section is already present, modify, it, do not add a new one.

Ensure the documentation does more than describe the code—you should identify the philosophical usage/purpose of signatures, (draw from the README.md for this) and ensure that how we achieve that is written in your documentation, in addition to actual examples of how to use the thing you are documenting. For examples, please refer to the jupyter notebooks.

Good luck. Please be thorough and comprehensive.

Checklist
  • Create docs/signatures/signatures.md8ee1fbc Edit
  • Running GitHub Actions for docs/signatures/signatures.mdEdit
  • Modify docs/modules/modules.md345885f Edit
  • Running GitHub Actions for docs/modules/modules.mdEdit

Sweep: Test

Details

Say "Hello World", sweep! No need to search any codebase files.

Sweep: Refactor index.rst to draw from the new `*.rst` converted documentation

Details

Please ensure index.rst properly indexes and uses the documentation converted from the markdown files:

  • ./docs/language_models_client.rst
  • ./docs/retrieval_models_client.rst
  • ./docs/source/index.rst
  • ./docs/using_local_models.rst
  • ./docs/modules.rst
  • ./docs/teleprompters.rst
  • ./docs/README.rst

Ensure everything follows a logical order. Ensure all related concepts are linked to and work properly.

After understanding the new documentation, PLAN OUT how it should be included (based on structure, length, content) in index.rst.

Checklist
  • Modify docs/source/index.rst13cf3d8 Edit
  • Running GitHub Actions for docs/source/index.rstEdit

Sweep: Test

Details

Say "Hello World", sweep! No need to search any codebase files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.