For Developers
Below is a guide for running the beta version of ChainForge directly from source, for people who want to modify, develop or extend it. Note that these steps may change in the future.
Install requirements
Before you can run ChainForge, you need to install dependencies. cd
into chainforge
and run
pip install -r requirements.txt
to install requirements. (Ideally, you will run this in a virtualenv
.)
To install Node.js requirements, first make sure you have Node.js installed. Then cd
into chainforge/react-server
and run:
npm install
You might run into dependency conflicts. You can re-run with --force
to force continued installation.
Serving ChainForge manually
To serve ChainForge manually, you have two options: 1. Run everything from a single Python script, which requires building the React app to static files, or 2. Serve the React front-end separately from the Flask back-end and take advantage of React hot reloading.
We recommend the former option for end-users, and the latter for developers.
Option 1: Build React app as static files (end-users)
cd
into react-server
directory and run:
npm run build
Wait a moment while it builds the React app to static files.
Option 2: Serve React front-end with hot reloading (developers)
cd
into react-server
directory and run the following to serve the React front-end:
npm run start
Serving the backend
Regardless of which option you chose, cd
into the root ChainForge directory and run:
python -m chainforge.app serve
This script spins up a Flask server on port 8000. Note that most of the app logic is fully in the browser, but some calls (like loading API keys as environment variables, or querying Anthropic API) still go through the Flask server.
If you built the React app statically, go to localhost:8000
in a web browser to view the app (ideally in Google Chrome).
If you served the React app with hot reloading with npm run start
, go to the server address you ran it on (usually localhost:3000
).
Problems?
Open an Issue.
Contributing to ChainForge
If you want to contribute, welcome! Please fork this repository and submit a Pull Request with your changes.
If you have access to the main repository, we request that you add a branch dev/<your_first_name>
and develop changes from there. When you are ready to push changes, say to address an open Issue, make a Pull Request on the experimental
repository and assign the main developer (Ian Arawjo) to it.