Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
316 commits
Select commit Hold shift + click to select a range
8517db6
Update setup.py
okhat Mar 2, 2024
7818700
Update pyproject.toml
okhat Mar 2, 2024
cbed0b9
OpenAI: No retry on ServiceUnavailableError, APIError
okhat Mar 2, 2024
8d698ae
Merge branch 'main' of https://github.com/stanfordnlp/dspy into main
okhat Mar 2, 2024
6ba4130
Some refinements to signature, allowing instantiation and fixing lint…
thomasahle Mar 3, 2024
6af5366
Avoid shadowing by lint
thomasahle Mar 3, 2024
2c11b8b
Update skycamp2023.ipynb
arian-askari Mar 3, 2024
16fdf50
Merge pull request #536 from arian-askari/skycamp2023-refer-to-comple…
okhat Mar 3, 2024
9a1c189
Support for n=... and type-strings
thomasahle Mar 3, 2024
a021bd2
Linting of dummy
thomasahle Mar 3, 2024
f223579
Rewrote type parsing to be 3.9 compatible
thomasahle Mar 3, 2024
dab44cd
Python 3.9 compatability
thomasahle Mar 3, 2024
fe321da
Validate main signature fields
thomasahle Mar 3, 2024
16be7a1
Fixes to completions
thomasahle Mar 3, 2024
6da72e3
Merge branch 'stanfordnlp:main' into main
thomasahle Mar 3, 2024
71ac993
Merge pull request #540 from thomasahle/main
thomasahle Mar 3, 2024
6ed29b4
Fixed #520
thomasahle Mar 3, 2024
8171ba1
Changed max retries back to 3
thomasahle Mar 3, 2024
a637bf4
ci(dspy): Add Ruff linting workflow (#538)
isaacbmiller Mar 4, 2024
2bd6fda
ci(dspy): Fix tests failing - remove --no-root flag (#541)
isaacbmiller Mar 4, 2024
171c204
Batched Generation, SIgnature Based Generation
krypticmouse Mar 4, 2024
59f4f9e
Merge branch 'main' into data-synthesis-v2
krypticmouse Mar 4, 2024
98d59f6
Automatic Style fixes
krypticmouse Mar 4, 2024
c2737f6
fix: printing signature fields in verbose mode for signature_opt
ragul-kachiappan-techjays Mar 4, 2024
7a20578
Update README.md
thomasahle Mar 4, 2024
29a8f04
import fix
krypticmouse Mar 4, 2024
1913b83
Automatic Style fixes
krypticmouse Mar 4, 2024
7980a2b
First try at a new optimizer/teleprompt
thomasahle Mar 4, 2024
c81e973
Add support for neo4j vector index
tomasonjo Mar 4, 2024
c331975
switch to text
tomasonjo Mar 4, 2024
1754cbd
Add docs & some improvements
tomasonjo Mar 4, 2024
ff26c02
Fixes
tomasonjo Mar 4, 2024
7b5f769
Update README.md
thomasahle Mar 4, 2024
e4edd5b
Update README.md
thomasahle Mar 4, 2024
b879095
docs(dspy): add toy invocation of model to minimal-example
nattaylor Mar 5, 2024
ee64653
Move ensemble import to teleprompt (#542)
isaacbmiller Mar 5, 2024
0f39a43
Fix return_all_scores in evaluate
quajak Mar 5, 2024
188694a
add 'k' as argument to FaissRM.forward()
Mar 5, 2024
08dd4e9
Add search to docs
krypticmouse Mar 5, 2024
58030c9
Merge pull request #547 from ragul-kachiappan-dev/main
arnavsinghvi11 Mar 5, 2024
8c666d4
Merge pull request #516 from mrshu/mrshu/fix-chromadb_rm
arnavsinghvi11 Mar 5, 2024
b7b7517
Merge pull request #553 from nattaylor/main
arnavsinghvi11 Mar 5, 2024
cab9eb4
remove extra space
arnavsinghvi11 Mar 5, 2024
929213e
Update minimal-example.mdx
arnavsinghvi11 Mar 5, 2024
b2816c4
Update code snippets in cheatsheet
krypticmouse Mar 5, 2024
e145529
Fix applymap deprecation warning
quajak Mar 5, 2024
3ee75d8
Add Claude wrapper
skucherlapati Mar 5, 2024
017252c
project dependencies
skucherlapati Mar 5, 2024
0cffb58
Adds support to call Claude from dsp modules.
skucherlapati Mar 5, 2024
1f6e0cb
Removed (deactiviated) key
thomasahle Mar 5, 2024
4ed88d9
Merge remote-tracking branch 'bad-ci-remote/fix/evaluate' into github…
isaacbmiller Mar 5, 2024
687d4b0
Pull from original fork repo
isaacbmiller Mar 5, 2024
d75ef1d
make CI fail on fix
isaacbmiller Mar 5, 2024
2c51395
Add error handling and comment for formatting issues
isaacbmiller Mar 5, 2024
2235a6a
Add write permissions for pull requests in run_tests workflow
isaacbmiller Mar 5, 2024
d3b887e
Fail on any error
isaacbmiller Mar 5, 2024
c17c14f
separate comment
isaacbmiller Mar 5, 2024
f9de939
separate comment remove continue
isaacbmiller Mar 5, 2024
89f14c4
Allow PR comment write
isaacbmiller Mar 5, 2024
a5d95dd
try echo syntax
isaacbmiller Mar 5, 2024
c0cc3bc
fix echo syntax
isaacbmiller Mar 5, 2024
c800613
Move to separate file to run with elevated perms
isaacbmiller Mar 5, 2024
ea64522
Give name to workflow
isaacbmiller Mar 5, 2024
83cddf2
Recombine into one file, but separate by action type
isaacbmiller Mar 5, 2024
f193549
change target branch
isaacbmiller Mar 5, 2024
b50b669
Purposely create ruff errors
isaacbmiller Mar 5, 2024
5d2853c
Add console.log
isaacbmiller Mar 5, 2024
af74907
Split into separate workflow
isaacbmiller Mar 5, 2024
e659fc2
Revert "Fix return_all_scores in evaluate"
isaacbmiller Mar 6, 2024
b2e00eb
add ruff as dev dependency
isaacbmiller Mar 6, 2024
d64f4bc
Add verbose to ruff check
isaacbmiller Mar 6, 2024
7e1d501
Make comment action follow github best practices
isaacbmiller Mar 6, 2024
70ef23d
2 commits: 1 bad, 1 good (#569)
isaacbmiller Mar 6, 2024
958cd6a
Rename workflow
isaacbmiller Mar 6, 2024
a2fb536
Fix the "no inputs" case
thomasahle Mar 6, 2024
797f1cd
Added a new method to Module
thomasahle Mar 6, 2024
bf011b8
Fix a bug with generics
thomasahle Mar 6, 2024
d633a77
Formatting
thomasahle Mar 6, 2024
7283847
Created typed signature optimizer
thomasahle Mar 6, 2024
1ac3687
Updated notebook
thomasahle Mar 6, 2024
19c9bb2
Merge remote-tracking branch 'upstream/main'
thomasahle Mar 6, 2024
5dc385f
Automatic Style fixes
thomasahle Mar 6, 2024
baecf8c
Removed submodules
thomasahle Mar 6, 2024
f26c9a0
Fixed tests for python 3.9
thomasahle Mar 6, 2024
495e40f
Automatic Style fixes
thomasahle Mar 6, 2024
5c834c6
Prevent import reorder
thomasahle Mar 6, 2024
6c91b2c
Automatic Style fixes
thomasahle Mar 6, 2024
e16373b
Prevent import reorder
thomasahle Mar 6, 2024
26bb358
removed sub module
thomasahle Mar 6, 2024
c2d639f
Merge pull request #574 from thomasahle/main
thomasahle Mar 6, 2024
2800386
Update ProgramOfThought.md: Example
simon-ami Mar 6, 2024
a82862a
Richer output from signature optimizer
thomasahle Mar 6, 2024
1e638a1
Force the optimizer to not repeat signatures
thomasahle Mar 6, 2024
77c507a
Automatic Style fixes
thomasahle Mar 6, 2024
f672c65
Remove unused kwargs passed to requests sent through `AzureOpenAI`
Mar 6, 2024
988617c
Merge branch 'stanfordnlp:main' into main
thomasahle Mar 6, 2024
669ecd7
Merge pull request #585 from thomasahle/main
thomasahle Mar 6, 2024
eae3e07
Adding metric_threshold to BootstrapFewShotWithRandomSearch
insop Mar 7, 2024
7558b8f
Update cheatsheet.md
thomasahle Mar 7, 2024
610ad59
refactoring optimizers, updates to optimizer notebook
klopsahlong Mar 7, 2024
86a49c1
Merge branch 'main' of https://github.com/stanfordnlp/dspy into optim…
klopsahlong Mar 7, 2024
5f4cd19
merged
klopsahlong Mar 7, 2024
efa7fca
Merge pull request #584 from Yummy2016/mingyi/fix-azure
okhat Mar 7, 2024
a4f69b7
Merge pull request #588 from insop/insop/add_metric_threshold
okhat Mar 7, 2024
3b7f285
Changed MIPRO and COPRO fields
XenonMolecule Mar 7, 2024
1a80a9b
ensure deprecated optimizers return expected output
XenonMolecule Mar 7, 2024
0c7f82e
FIX: BootstrapFewShotWithRandomSearch.metric_threshold is not set in …
Mar 7, 2024
38d301d
Merge branch 'main' of https://github.com/stanfordnlp/dspy into optim…
klopsahlong Mar 7, 2024
4859aa2
Merge branch 'optimizers' of https://github.com/stanfordnlp/dspy into…
klopsahlong Mar 7, 2024
eb6cf85
additonal updates to notebook, merging in refactor changes
klopsahlong Mar 7, 2024
d366d62
updates to notebook
klopsahlong Mar 7, 2024
26700f1
notebook name change
klopsahlong Mar 7, 2024
76e0cb1
minor changes to notebook+copro code (better print statements)
klopsahlong Mar 7, 2024
f71416e
Automatic Style fixes
klopsahlong Mar 7, 2024
e155a45
Add local language model folder
krypticmouse Mar 7, 2024
1d300c8
Merge pull request #593 from coderfengyun/main
arnavsinghvi11 Mar 7, 2024
91c9ddf
Merge pull request #565 from stanfordnlp/add-pr-comment-ruff
okhat Mar 7, 2024
189f858
Fixed multi-module typed signature optimizer
thomasahle Mar 7, 2024
9ec79e6
Merge branch 'stanfordnlp:main' into main
thomasahle Mar 7, 2024
fc664d5
ci(dspy): Add main push test run back (#600)
isaacbmiller Mar 7, 2024
a4f7ca6
Fix code issues in signature-optimizer.mdx
swairshah Mar 7, 2024
f44e50e
a few optimizer updates
klopsahlong Mar 7, 2024
ded09c1
Merge branch 'main' of https://github.com/stanfordnlp/dspy into optim…
klopsahlong Mar 7, 2024
5e6166f
merged
klopsahlong Mar 7, 2024
a82558d
adding in an import that was accidentally removed
klopsahlong Mar 7, 2024
d7bf3bc
updating mipro tests
klopsahlong Mar 7, 2024
2704f5a
fixing warning statement
klopsahlong Mar 7, 2024
484da6a
fixing bug when requires_permission_to_run=False, and doing ruff clea…
klopsahlong Mar 7, 2024
f9f35b6
fixing some variable names in test
klopsahlong Mar 7, 2024
bbaa0ac
fixing variable name
klopsahlong Mar 7, 2024
39f5ba3
adding api references and docs files for functional
krypticmouse Mar 7, 2024
2b2ad80
Update provider name to Claude or Bedrock
VivHarsha Mar 8, 2024
8b5dd0e
Inspect history for Claude models
VivHarsha Mar 8, 2024
a5f75af
updating tests for new optimizers
klopsahlong Mar 8, 2024
8e13bd9
renaming tests
klopsahlong Mar 8, 2024
063a144
small cleanup of breakpoints
klopsahlong Mar 8, 2024
b8bb021
minor updates
klopsahlong Mar 8, 2024
01076bd
removing accidentally added warning from copro
klopsahlong Mar 8, 2024
695cefc
make num_trials a required variable, plus minor changes to notebook
klopsahlong Mar 8, 2024
d2a2f89
adding notebook cache_dir in front of dspy import
klopsahlong Mar 8, 2024
b4bf8de
removing re import from notebook
klopsahlong Mar 8, 2024
48663a2
feature(dspy): added Metadata for ChromaDB retrieval
domci Mar 8, 2024
c8debca
Merge branch 'main' of https://github.com/stanfordnlp/dspy into main
okhat Mar 8, 2024
1d090eb
Update setup.py
okhat Mar 8, 2024
75f9d25
Update pyproject.toml
okhat Mar 8, 2024
bf2667d
Merge branch 'main' of https://github.com/stanfordnlp/dspy into main
okhat Mar 8, 2024
b3e7c58
Merge pull request #603 from stanfordnlp/optimizers
okhat Mar 8, 2024
df99244
Update setup.py
okhat Mar 8, 2024
f03ba08
Update pyproject.toml
okhat Mar 8, 2024
d63c279
Merge origin/main to fix CI issue
quajak Mar 8, 2024
fbef305
fix to signature optimizer - setting num_candidates
klopsahlong Mar 8, 2024
f4538af
Merge pull request #610 from stanfordnlp/optimizers
klopsahlong Mar 8, 2024
0c48d86
Update setup.py
okhat Mar 8, 2024
0456b51
Update pyproject.toml
okhat Mar 8, 2024
167a133
adding in colab badge
klopsahlong Mar 8, 2024
5d3c2c4
Adding typed predictor docs
krypticmouse Mar 8, 2024
2c9c671
Update 8-typed_predictors.md
arnavsinghvi11 Mar 8, 2024
da1f8ae
Merge pull request #602 from swairshah/patch-1
krypticmouse Mar 8, 2024
e72ef1b
📝 (ChromadbRM.md): Update the return type description in the document…
Mar 9, 2024
7b5e0d3
hf models can use auth tokens now (#611)
mgbvox Mar 9, 2024
fc62d60
Update pyproject.toml
CShorten Mar 9, 2024
e505dcd
Update pyproject.toml (Whoops left a comma)
CShorten Mar 9, 2024
424ee2b
Match version
CShorten Mar 9, 2024
638d8e5
update linter
CShorten Mar 9, 2024
829e573
run ruff linter
CShorten Mar 9, 2024
79e3187
update
CShorten Mar 9, 2024
275f133
Revert "run ruff linter"
CShorten Mar 9, 2024
472b166
Update pyproject.toml
CShorten Mar 9, 2024
27f23a7
Merge pull request #604 from stanfordnlp/typed-predictor-docs
arnavsinghvi11 Mar 9, 2024
092dfe4
Merge pull request #478 from ragul-kachiappan/main
arnavsinghvi11 Mar 9, 2024
cf15400
Merge pull request #548 from tomasonjo/main
arnavsinghvi11 Mar 9, 2024
d528d40
Merge pull request #561 from quajak/fix/applymap
arnavsinghvi11 Mar 9, 2024
1be2cfb
Merge pull request #605 from VivHarsha/patch-2
arnavsinghvi11 Mar 9, 2024
a51aad7
Merge pull request #609 from domci/364-metadata
arnavsinghvi11 Mar 9, 2024
226a0d9
Update databricks_rm.py
arnavsinghvi11 Mar 9, 2024
e7549fb
Update databricks_rm.py
arnavsinghvi11 Mar 9, 2024
61ac2f7
Add ruff rule back
isaacbmiller Mar 9, 2024
b8fe312
Make anthropic import optional for tests
isaacbmiller Mar 9, 2024
8903664
Apply ruff fix
isaacbmiller Mar 9, 2024
e7443d6
Update poetry.lock
isaacbmiller Mar 9, 2024
d078598
Revert "Update poetry.lock"
isaacbmiller Mar 9, 2024
f8c5683
Update poetry.lock
isaacbmiller Mar 9, 2024
edadecd
update with self.history
arnavsinghvi11 Mar 9, 2024
805ed48
Merge branch 'main' into claude_3
isaacbmiller Mar 9, 2024
974e4ec
Merge pull request #562 from skucherlapati/claude_3
CShorten Mar 9, 2024
fdef4bd
Merge branch 'stanfordnlp:main' into patch-1
simon-ami Mar 9, 2024
2560b29
higher poetry openai req
darinkishore Mar 10, 2024
ab65929
Update README.md
thomasahle Mar 10, 2024
d73efde
run ruff check --fix-only dspy/retrieve/faiss_rm.py
Mar 10, 2024
02016e1
Merge pull request #559 from software-artisan/main
arnavsinghvi11 Mar 10, 2024
0c1d1b1
Fix return_all_scores in evaluate again to return all (#625)
quajak Mar 10, 2024
a5bc0c9
fix neo4j docs
tomasonjo Mar 11, 2024
56d4378
folder structure change, example driven optimization, mix of lm gener…
krypticmouse Mar 11, 2024
0e13553
typo fixes
krypticmouse Mar 11, 2024
8990a92
Merge pull request #629 from tomasonjo/neo4jfix
arnavsinghvi11 Mar 11, 2024
e4e817a
Merge pull request #612 from stanfordnlp/optimizers
arnavsinghvi11 Mar 11, 2024
5a2c714
lint fixes
krypticmouse Mar 11, 2024
734a345
Merge pull request #579 from SimonB97/patch-1
arnavsinghvi11 Mar 11, 2024
2d845de
Update 8-typed_predictors.md
thomasahle Mar 11, 2024
cad9b47
fix dotdict in marqo
Demontego Mar 12, 2024
7d70c8a
Merge branch 'main' of https://github.com/Demontego/dspy into fix-marqo
Demontego Mar 12, 2024
c26d5ba
feedback driven generation
krypticmouse Mar 12, 2024
e53fcbe
fix(dspy): use DataFrame.applymap in older pandas
maxfriedrich Mar 13, 2024
65551ef
Merge pull request #643 from maxfriedrich/patch-1
detaos Mar 13, 2024
04bedff
Automated feedback incorporations
krypticmouse Mar 13, 2024
846124d
Merge branch 'main' into data-synthesis-v2
krypticmouse Mar 13, 2024
cd78c4d
lint fixes
krypticmouse Mar 13, 2024
ce8eade
print removal
krypticmouse Mar 13, 2024
0d4e094
Merge branch 'stanfordnlp:main' into main
thomasahle Mar 13, 2024
0dce4f7
fix(dspy): remove debug print statement
nbqu Mar 14, 2024
73a9890
lint(dspy): refactor
nbqu Mar 14, 2024
cdd661d
Merge pull request #545 from stanfordnlp/data-synthesis-v2
krypticmouse Mar 14, 2024
9242b01
Remove kwargs print call in Claude LM
krypticmouse Mar 14, 2024
11847e0
Revert "Remove kwargs print call in Claude LM"
krypticmouse Mar 14, 2024
2b23abd
Merge pull request #649 from nbqu/fix-anthropic-bug
krypticmouse Mar 14, 2024
51d2d4f
Merge pull request #635 from Demontego/fix-marqo
arnavsinghvi11 Mar 14, 2024
69cfd9f
Fixed but with prefixes and annotated types
thomasahle Mar 14, 2024
d61ea31
Merge branch 'stanfordnlp:main' into main
thomasahle Mar 14, 2024
6f004cc
Merge pull request #601 from thomasahle/main
thomasahle Mar 14, 2024
259d6b0
Automatically copy over "description" from pydantic field to dspy field
thomasahle Mar 14, 2024
982db44
Fixed issue with boolean outputs
thomasahle Mar 14, 2024
cc8b193
Merge pull request #652 from thomasahle/main
thomasahle Mar 14, 2024
96ee792
Formatting
thomasahle Mar 15, 2024
4244c78
formatting
thomasahle Mar 15, 2024
aee6baf
Merge branch 'stanfordnlp:main' into main
thomasahle Mar 15, 2024
649ba32
Merge pull request #654 from thomasahle/main
thomasahle Mar 15, 2024
561a8e3
Merge remote-tracking branch 'ammirsm_origin/main' into backend-refac…
Mar 15, 2024
e0d545c
fix: updated predict tests with both lm and backend functionality
KCaverly Mar 18, 2024
5a502de
fix: updated test_program for experimental flag
KCaverly Mar 18, 2024
f7cacbc
fix: updated test_chain_of_thought for experimental flag
KCaverly Mar 18, 2024
5da3780
chore: update formatting for functional.py
KCaverly Mar 18, 2024
dab963d
fix: update backend arguments to ensure, that parameter clashes betwe…
KCaverly Mar 18, 2024
740c382
fix: update functional for completion/prediction changes
KCaverly Mar 18, 2024
3232421
chore: update formatting for copro optimizer
KCaverly Mar 18, 2024
d787bfd
fix: aligned copro_optimizer with new prediction and completions api
KCaverly Mar 18, 2024
3704740
chore: format mipro_optimizer
KCaverly Mar 19, 2024
0c25411
fix: passing all tests
KCaverly Mar 19, 2024
64093bb
chore: ruff fixes for backends
KCaverly Mar 19, 2024
d007233
chore: ruff check and fix
KCaverly Mar 19, 2024
627391f
fix: remove typing.Self
KCaverly Mar 19, 2024
873e779
chore: clean up tests/predict
KCaverly Mar 19, 2024
b2f7624
chore: clean up tests/backends
KCaverly Mar 19, 2024
29179d2
chore: clean up tests/evaluate
KCaverly Mar 19, 2024
33b6b38
chore: clean up tests/functional
KCaverly Mar 19, 2024
7100ae1
chore: clean up tests/primitives
KCaverly Mar 19, 2024
ee1f054
chore: clean up tests/signatures
KCaverly Mar 19, 2024
6d5a5ee
chore: clean up tests/teleprompt
KCaverly Mar 19, 2024
a51c60f
fix: remove clean_up_lm_test
KCaverly Mar 19, 2024
ad265b0
fix: remove commented out code
KCaverly Mar 19, 2024
a76b97d
fix: moved BaseLM to output strings versus dictionary of content
KCaverly Mar 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
76 changes: 66 additions & 10 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,92 @@
name: Build and Run Tests
name: Lint, Test, and Build

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

env:
POETRY_VERSION: "1.6.1"

jobs:
fix:
name: Check Ruff Fix
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Ruff Fix Attempt
id: ruff_fix
uses: chartboost/ruff-action@v1
with:
args: --fix-only --exit-non-zero-on-fix
continue-on-error: true

- name: Fail Workflow if Ruff Fix Failed
if: steps.ruff_fix.outcome == 'failure'
run: |
echo "Ruff fix failed, failing the workflow."
echo "Please run 'ruff check . --fix-only' locally and push the changes."
exit 1

test:
name: Test
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
cache: "poetry"
- name: Install dependencies
run: poetry install
run: poetry install --no-interaction
- name: Run lint with tests
uses: chartboost/ruff-action@v1
with:
args: --fix-only
- name: Run tests with pytest
run: poetry run pytest tests/

build_poetry:
name: Build Poetry
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
cache: "poetry"
- name: Build
run: poetry build
- name: Install built package
Expand All @@ -50,17 +95,28 @@ jobs:
run: python -c "import dspy"
- name: Test import dsp
run: python -c "import dsp"

build_setup:
name: Build Setup
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-${{ env.POETRY_VERSION }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Run setup.py build
run: python setup.py build
34 changes: 17 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ default_stages: [commit]
default_install_hook_types: [pre-commit, commit-msg]

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.11
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
# - repo: https://github.com/astral-sh/ruff-pre-commit
# # Ruff version.
# rev: v0.1.11
# hooks:
# # Run the linter.
# - id: ruff
# args: [--fix]
# # Run the formatter.
# - id: ruff-format

- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
Expand Down Expand Up @@ -50,14 +50,14 @@ repos:
args:
- "--autofix"
- "--indent=2"
- repo: local
hooks:
- id: validate-commit-msg
name: Commit Message is Valid
language: pygrep
entry: ^(break|build|ci|docs|feat|fix|perf|refactor|style|test|ops|hotfix|release|maint|init|enh|revert)\([\w,\.,\-,\(,\),\/]+\)(!?)(:)\s{1}([\w,\W,:]+)
stages: [commit-msg]
args: [--negate]
# - repo: local
# hooks:
# - id: validate-commit-msg
# name: Commit Message is Valid
# language: pygrep
# entry: ^(break|build|ci|docs|feat|fix|perf|refactor|style|test|ops|hotfix|release|maint|init|enh|revert)\([\w,\.,\-,\(,\),\/]+\)(!?)(:)\s{1}([\w,\W,:]+)
# stages: [commit-msg]
# args: [--negate]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contibuting
# Contributing

## Finding Issues

Expand Down
62 changes: 59 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ If you need help thinking about your task, we recently created a [Discord server
1. **[Tutorials & Documentation](#2-documentation)**
1. **[Framework Syntax](#3-syntax-youre-in-charge-of-the-workflowits-free-form-python-code)**
1. **[Compiling: Two Powerful Concepts](#4-two-powerful-concepts-signatures--teleprompters)**
1. **[FAQ: Is DSPy right for me?](#5-faq-is-dspy-right-for-me)**
1. **[Pydantic Types](#5-pydantic-types)**
1. **[FAQ: Is DSPy right for me?](#6-faq-is-dspy-right-for-me)**



Expand Down Expand Up @@ -114,7 +115,7 @@ If you're new to DSPy, it's probably best to go in sequential order. You will pr

4. **[Optimizers (formerly Teleprompters)](https://dspy-docs.vercel.app/docs/building-blocks/optimizers)**

6. **[DSPy Assertions](docs/assertions.md)**
6. **[DSPy Assertions](https://dspy-docs.vercel.app/docs/building-blocks/assertions)**


### C) Examples
Expand All @@ -139,6 +140,9 @@ You can find other examples tweeted by [@lateinteraction](https://twitter.com/la
- [DSPy on BIG-Bench Hard Example, by Chris Levy](https://drchrislevy.github.io/posts/dspy/dspy.html)
- [Using Ollama with DSPy for Mistral (quantized) by @jrknox1977](https://gist.github.com/jrknox1977/78c17e492b5a75ee5bbaf9673aee4641)
- [Using DSPy, "The Unreasonable Effectiveness of Eccentric Automatic Prompts" (paper) by VMware's Rick Battle & Teja Gollapudi, and interview at TheRegister](https://www.theregister.com/2024/02/22/prompt_engineering_ai_models/)
- Typed DSPy (contributed by [@normal-computing](https://github.com/normal-computing))
- [Using DSPy to train Gpt 3.5 on HumanEval by Thomas Ahle](https://github.com/stanfordnlp/dspy/blob/main/examples/functional/functional.ipynb)
- [Building a chess playing agent using DSPy by Franck SN](https://medium.com/thoughts-on-machine-learning/building-a-chess-playing-agent-using-dspy-9b87c868f71e)

There are also recent cool examples at [Weaviate's DSPy cookbook](https://github.com/weaviate/recipes/tree/main/integrations/dspy) by Connor Shorten. [See tutorial on YouTube](https://www.youtube.com/watch?v=CEuUG4Umfxs).

Expand Down Expand Up @@ -274,9 +278,61 @@ compiled_rag = teleprompter.compile(RAG(), trainset=my_rag_trainset)
If we now use `compiled_rag`, it will invoke our LM with rich prompts with few-shot demonstrations of chain-of-thought retrieval-augmented question answering on our data.


## 5) Pydantic Types

Sometimes you need more than just string inputs/outputs.
Assume, for example, you need to find

## 5) FAQ: Is DSPy right for me?
```python
from pydantic import BaseModel, Field
from dspy.functional import TypedPredictor

class TravelInformation(BaseModel):
origin: str = Field(pattern=r"^[A-Z]{3}$")
destination: str = Field(pattern=r"^[A-Z]{3}$")
date: datetime.date
confidence: float = Field(gt=0, lt=1)

class TravelSignature(Signature):
""" Extract all travel information in the given email """
email: str = InputField()
flight_information: list[TravelInformation] = OutputField()

predictor = TypedPredictor(TravelSignature)
predictor(email='...')
```

Which will output a list of `TravelInformation` objects.

There are other ways to create typed signatures too. Such as
```python
predictor = TypedChainOfThought("question:str -> answer:int")
```
which applies chain of thought, and is guaranteed to return an int.

There's even an approach inspired by [tanuki.py](https://github.com/Tanuki/tanuki.py), which can be convenient when defining modules:
```python
from dspy.functional import FunctionalModule, predictor, cot

class MyModule(FunctionalModule):
@predictor
def hard_question(possible_topics: list[str]) -> str:
"""Write a hard question based on one of the topics. It should be answerable by a number."""

@cot
def answer(question: str) -> float:
pass

def forward(possible_topics: list[str]):
q = hard_question(possible_topics=possible_topics)
a = answer(question=q)
return (q, a)
```

For more examples, see [the list above](https://github.com/stanfordnlp/dspy#:~:text=Typed%20DSPy),
as well as [the unit tests](https://github.com/stanfordnlp/dspy/blob/main/tests/functional/test_functional.py) for the module.

## 6) FAQ: Is DSPy right for me?

The **DSPy** philosophy and abstraction differ significantly from other libraries and frameworks, so it's usually straightforward to decide when **DSPy** is (or isn't) the right framework for your usecase.

Expand Down
41 changes: 0 additions & 41 deletions docs-page/README.md

This file was deleted.

48 changes: 0 additions & 48 deletions docs-page/api/hosting_language_models_locally/MLC.md

This file was deleted.

Loading