General Introduction
The DSPy Example Codebase is a GitHub codebase maintained by the Langtrace AI team that showcases a variety of AI program examples built using DSPy. The codebase is designed to help developers better understand and apply DSPy for AI program development by demonstrating the many features of DSPy through real-world examples. The codebase is clearly structured and each example program contains detailed code and datasets for easy learning and reference.
Function List
- Sample Program Collection: Contains several examples of AI programs built using DSPy.
- Clear program structure: Each example program contains the dataset, the main program logic, and the runtime entry file.
- Multi-program collaboration: Partial example showing a composite system with multiple DSPy programs working together.
- Contribution Guidelines: Provide detailed contribution guidelines to encourage users to participate in code base improvements.
- MIT license: The codebase is licensed under the MIT license, which allows free use and modification.
Using Help
Installation process
- Cloning Codebase: Run the following command in a terminal to clone the code base:
git clone https://github.com/mbakgun/dspy-examples.git
- Access to the catalog: Go to the cloned code base directory:
cd dspy-examples
- Installation of dependencies: Use pip to install the required dependencies:
pip install -r requirements.txt
Using the sample program
- Navigate to the sample program folder: Select a sample program as needed and go to the corresponding folder. Example:
cd src/example_program
- running program: Implementation
run.py
file to run the sample program:
python run.py
Main function operation flow
- Data set preparation: Each sample program folder contains a
dataset
folder that holds the datasets required by the program. The user can replace or modify the dataset as needed. - Main program logic::
program.py
file contains the main logic code of the sample program. Users can read and modify this file to understand the specific implementation of the program. - Signature definition::
signatures.py
file defines the signatures used in the program. The user can add or modify signatures as needed. - complex system: Part of the example shows a composite system with multiple DSPy programs working together. In this case, the user needs to run each subroutine of the
run.py
Documentation.
Contribution Guidelines
- Forked code base: Click the Fork button on GitHub to fork the code base.
- Creating a new branch: Create a new branch for your feature or fix:
git checkout -b feature-branch
- Submit changes: Make changes and submit:
git add .
git commit -m "Describe your changes"
- Push Changes: Push changes to your forked repository:
git push origin feature-branch
- Submit a pull request: Submit a pull request on GitHub describing your changes.