Skip to content

Commit e013456

Browse files
committed
merge main
2 parents 10b9b89 + 62bcf12 commit e013456

File tree

347 files changed

+14436
-52925
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

347 files changed

+14436
-52925
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/build_and_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
run: |
5454
source test_before_testpypi/bin/activate
5555
# Install the locally built wheel and testing dependencies
56-
pip install dist/*.whl pytest
56+
pip install dist/*.whl pytest pytest-asyncio
5757
pytest tests/metadata/test_metadata.py tests/predict
5858
deactivate
5959
# Publish to test-PyPI
@@ -100,7 +100,7 @@ jobs:
100100
run: |
101101
source test_before_pypi/bin/activate
102102
# Install the locally built wheel and testing dependencies
103-
pip install dist/*.whl pytest
103+
pip install dist/*.whl pytest pytest-asyncio
104104
pytest tests/metadata/test_metadata.py tests/predict
105105
deactivate
106106
rm -r test_before_pypi

.github/workflows/run_tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ jobs:
8383
args: check --fix-only
8484
- name: Run tests with pytest
8585
run: uv run -p .venv pytest tests/
86+
- name: Install optional dependencies
87+
run: uv sync -p .venv --extra dev --extra test_extras
88+
- name: Run extra tests
89+
run: uv run -p .venv pytest tests/ -m extra --extra
8690

8791
build_package:
8892
name: Build Package

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ docs/docs/**/*.json*
6464
*.pkl
6565
*.tar.gz
6666

67-
test_before_pypi/
67+
test_before_pypi/
68+
dspy/.internal_dspyai/dist/

CONTRIBUTING.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Contribution Guide
2+
3+
DSPy is an actively growing project and community! We welcome your contributions and involvement. Below are instructions for how to contribute to DSPy.
4+
5+
## Finding an Issue
6+
7+
The fastest way to contribute is to find open issues that need an assignee. We maintain two lists of GitHub tags for contributors:
8+
9+
- [good first issue](https://github.com/stanfordnlp/dspy/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22good%20first%20issue%22):
10+
a list of small, well-defined issues for newcomers to the project.
11+
- [help wanted](https://github.com/stanfordnlp/dspy/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22help%20wanted%22):
12+
a list of issues that welcome community contributions. These issues have a wide range of complexity.
13+
14+
We also welcome new ideas! If you would like to propose a new feature, please open a feature request to
15+
discuss. If you already have a design in mind, please include a notebook/code example to demonstrate
16+
your idea. Keep in mind that designing a new feature or use case may take longer than contributing to
17+
an open issue.
18+
19+
## Contributing Code
20+
21+
Follow these steps to submit your code contribution.
22+
23+
### Step 1. Open an Issue
24+
25+
Before making any changes, we recommend opening an issue (if one doesn't already exist) and discussing your
26+
proposed changes. This way, we can give you feedback and validate the proposed changes.
27+
28+
If your code change involves fixing a bug, please include a code snippet or notebook
29+
to show how to reproduce the broken behavior.
30+
31+
For minor changes (simple bug fixes or documentation fixes), feel free to open a PR without discussion.
32+
33+
### Step 2. Make Code Changes
34+
35+
To make code changes, fork the repository and set up your local development environment following the
36+
instructions in the "Environment Setup" section below.
37+
38+
### Step 3. Create a Pull Request
39+
40+
Once your changes are ready, open a pull request from your branch in your fork to the main branch in the
41+
[DSPy repo](https://github.com/stanfordnlp/dspy).
42+
43+
### Step 4. Code Review
44+
45+
Once your PR is up and passes all CI tests, we will assign reviewers to review the code. There may be
46+
several rounds of comments and code changes before the pull request gets approved by the reviewer.
47+
48+
### Step 5. Merging
49+
50+
Once the pull request is approved, a team member will take care of merging.
51+
52+
## Environment Setup
53+
54+
Python 3.9 or later is required.
55+
56+
Setting up your DSPy development environment requires you to fork the DSPy repository and clone it locally.
57+
If you are not familiar with the GitHub fork process, please refer to [Fork a repository](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo). After creating the fork, clone
58+
it to your local development device:
59+
60+
```shell
61+
git clone {url-to-your-fork}
62+
cd dspy
63+
```
64+
65+
Next, we must set up a Python environment with the correct dependencies. There are two recommended ways to set up the
66+
dev environment.
67+
68+
### [Recommended] Set Up Environment Using uv
69+
70+
[uv](https://github.com/astral-sh/uv) is a rust-based Python package and project manager that provides a fast
71+
way to set up the development environment. First, install uv by following the
72+
[installation guide](https://docs.astral.sh/uv/getting-started/installation/).
73+
74+
After uv is installed, in your working directory (`dspy/`), run:
75+
76+
```shell
77+
uv sync --extra dev
78+
```
79+
80+
Then you are all set!
81+
82+
To verify that your environment is set up successfully, run some unit tests:
83+
84+
```shell
85+
uv run pytest tests/predict
86+
```
87+
88+
Note: You need to use the `uv run` prefix for every Python command, as uv creates a Python virtual
89+
environment and `uv run` points the command to that environment. For example, to execute a Python script you will need
90+
`uv run python script.py`.
91+
92+
### Set Up Environment Using conda + pip
93+
94+
You can also set up the virtual environment via conda + pip, which takes a few extra steps but offers more flexibility. Before starting,
95+
make sure you have conda installed. If not, please follow the instructions
96+
[here](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html).
97+
98+
To set up the environment, run:
99+
100+
```shell
101+
conda create -n dspy-dev python=3.11
102+
conda activate dspy-dev
103+
pip install -e ".[dev]"
104+
```
105+
106+
Then verify the installation by running some unit tests:
107+
108+
```shell
109+
pytest tests/predict
110+
```
111+

docs/README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
# DSPy Documentation
1+
**If you're looking to understand the framework, please go to the [DSPy Docs at dspy.ai](https://dspy.ai)**
2+
3+
 
4+
5+
--------
6+
7+
 
8+
9+
The content below is focused on how to modify the documentation site.
10+
11+
 
12+
13+
# Modifying the DSPy Documentation
14+
215

316
This website is built using [Material for MKDocs](https://squidfunk.github.io/mkdocs-material/), a Material UI inspired theme for MKDocs.
417

@@ -18,12 +31,17 @@ To build and test the documentation locally:
1831

1932
3. In docs/ directory, run the command below to generate the API docs and index them:
2033
```bash
21-
cd docs/
2234
python scripts/generate_api_docs.py
2335
python scripts/generate_api_summary.py
2436
```
2537

26-
4. Run the build command:
38+
4. (Optional) On MacOS you may also need to install libraries for building the site
39+
```bash
40+
brew install cairo freetype libffi libjpeg libpng zlib
41+
export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib
42+
```
43+
44+
5. Run the build command:
2745
```bash
2846
mkdocs build
2947
```
@@ -50,12 +68,7 @@ If the CI build check fails, please review your changes and ensure the documenta
5068

5169
This guide is for contributors looking to make changes to the documentation in the `dspy/docs` folder.
5270

53-
1. **Pull the up-to-date version of the website**: Please pull the latest version of the live documentation site via its subtree repository with the following command:
54-
55-
```bash
56-
#Ensure you are in the top-level dspy/ folder
57-
git subtree pull --prefix=docs https://github.com/krypticmouse/dspy-docs master
58-
```
71+
1. **Pull the up-to-date version of the website**: Please pull the latest version of the live documentation site via cloning the dspy repo. The current docs are in the `dspy/docs` folder.
5972

6073
2. **Push your new changes on a new branch**: Feel free to add or edit existing documentation and open a PR for your changes. Once your PR is reviewed and approved, the changes will be ready to merge into main.
6174

docs/docs/api/adapters/Adapter.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# dspy.Adapter
22

3+
<!-- START_API_REF -->
34
::: dspy.Adapter
45
handler: python
56
options:
67
members:
78
- __call__
9+
- acall
810
- format
911
- format_assistant_message_content
1012
- format_conversation_history
@@ -22,3 +24,4 @@
2224
show_object_full_path: false
2325
separate_signature: false
2426
inherited_members: true
27+
<!-- END_API_REF -->

docs/docs/api/adapters/ChatAdapter.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# dspy.ChatAdapter
22

3+
<!-- START_API_REF -->
34
::: dspy.ChatAdapter
45
handler: python
56
options:
67
members:
78
- __call__
9+
- acall
810
- format
911
- format_assistant_message_content
1012
- format_conversation_history
@@ -25,3 +27,4 @@
2527
show_object_full_path: false
2628
separate_signature: false
2729
inherited_members: true
30+
<!-- END_API_REF -->

docs/docs/api/adapters/JSONAdapter.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# dspy.JSONAdapter
22

3+
<!-- START_API_REF -->
34
::: dspy.JSONAdapter
45
handler: python
56
options:
67
members:
78
- __call__
9+
- acall
810
- format
911
- format_assistant_message_content
1012
- format_conversation_history
@@ -25,3 +27,4 @@
2527
show_object_full_path: false
2628
separate_signature: false
2729
inherited_members: true
30+
<!-- END_API_REF -->

docs/docs/api/adapters/TwoStepAdapter.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# dspy.TwoStepAdapter
22

3+
<!-- START_API_REF -->
34
::: dspy.TwoStepAdapter
45
handler: python
56
options:
67
members:
78
- __call__
9+
- acall
810
- format
911
- format_assistant_message_content
1012
- format_conversation_history
@@ -22,3 +24,4 @@
2224
show_object_full_path: false
2325
separate_signature: false
2426
inherited_members: true
27+
<!-- END_API_REF -->

docs/docs/api/evaluation/CompleteAndGrounded.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# dspy.evaluate.CompleteAndGrounded
22

3+
<!-- START_API_REF -->
34
::: dspy.evaluate.CompleteAndGrounded
45
handler: python
56
options:
67
members:
78
- __call__
9+
- acall
810
- batch
911
- deepcopy
1012
- dump_state
1113
- forward
1214
- get_lm
15+
- inspect_history
1316
- load
1417
- load_state
1518
- map_named_predictors
@@ -29,3 +32,4 @@
2932
show_object_full_path: false
3033
separate_signature: false
3134
inherited_members: true
35+
<!-- END_API_REF -->

docs/docs/api/evaluation/Evaluate.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# dspy.Evaluate
22

3+
<!-- START_API_REF -->
34
::: dspy.Evaluate
45
handler: python
56
options:
@@ -13,3 +14,4 @@
1314
show_object_full_path: false
1415
separate_signature: false
1516
inherited_members: true
17+
<!-- END_API_REF -->

docs/docs/api/evaluation/SemanticF1.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# dspy.evaluate.SemanticF1
22

3+
<!-- START_API_REF -->
34
::: dspy.evaluate.SemanticF1
45
handler: python
56
options:
67
members:
78
- __call__
9+
- acall
810
- batch
911
- deepcopy
1012
- dump_state
1113
- forward
1214
- get_lm
15+
- inspect_history
1316
- load
1417
- load_state
1518
- map_named_predictors
@@ -29,3 +32,4 @@
2932
show_object_full_path: false
3033
separate_signature: false
3134
inherited_members: true
35+
<!-- END_API_REF -->

docs/docs/api/evaluation/answer_exact_match.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# dspy.evaluate.answer_exact_match
22

3+
<!-- START_API_REF -->
34
::: dspy.evaluate.answer_exact_match
45
handler: python
56
options:
@@ -11,3 +12,4 @@
1112
show_object_full_path: false
1213
separate_signature: false
1314
inherited_members: true
15+
<!-- END_API_REF -->

docs/docs/api/evaluation/answer_passage_match.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# dspy.evaluate.answer_passage_match
22

3+
<!-- START_API_REF -->
34
::: dspy.evaluate.answer_passage_match
45
handler: python
56
options:
@@ -11,3 +12,4 @@
1112
show_object_full_path: false
1213
separate_signature: false
1314
inherited_members: true
15+
<!-- END_API_REF -->

docs/docs/api/models/Embedder.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# dspy.Embedder
22

3+
<!-- START_API_REF -->
34
::: dspy.Embedder
45
handler: python
56
options:
67
members:
78
- __call__
9+
- acall
810
show_source: true
911
show_root_heading: true
1012
heading_level: 2
@@ -13,3 +15,4 @@
1315
show_object_full_path: false
1416
separate_signature: false
1517
inherited_members: true
18+
<!-- END_API_REF -->

0 commit comments

Comments
 (0)