-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves the examples so they're fully runnable
Adds READMEs with basic instructions.
- Loading branch information
1 parent
63ae384
commit af5a62e
Showing
12 changed files
with
123 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Counter | ||
|
||
This is an example of a simple state machine. | ||
|
||
We have three files: | ||
|
||
- [application.py](application.py) -- This contains a mainline to run the counter as well as a function to export the counter (for later use) | ||
- [requirements.txt](requirements.txt) -- Just the requirements. All this needs is Burr/Streamlit | ||
- [streamlit_app.py](streamlit_app.py) -- This contains a simple Streamlit app to interact with the counter. | ||
|
||
To run just the application, you can run: | ||
|
||
```bash | ||
python application.py | ||
``` | ||
|
||
To run the streamlit app, you can run: | ||
|
||
```bash | ||
streamlit run streamlit_app.py | ||
``` | ||
|
||
This will open a chrome window and print out the URL. The state machine this encapsulates takes the following form: | ||
|
||
![State Machine](digraph.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Cowsay | ||
|
||
This is an example of a simple infinite state machine. | ||
|
||
We have three files: | ||
|
||
- [application.py](application.py) -- This contains a mainline to run the cowsay app as well as a function to export the app (for later use) | ||
- [requirements.txt](requirements.txt) -- Just the requirements. All this needs is Burr/Streamlit/cowsay | ||
- [streamlit_app.py](streamlit_app.py) -- This contains a simple Streamlit app to interact with the cow | ||
|
||
To run just the application, you can run: | ||
|
||
```bash | ||
python application.py | ||
``` | ||
|
||
Note this is an infinte state machine, so this will run forever! Thus remember to ctrl-c eventually. | ||
To run the streamlit app, you can run: | ||
|
||
```bash | ||
streamlit run streamlit_app.py | ||
``` | ||
|
||
This allows you to press a button and see the cow say something (or see it decide not to speak). | ||
|
||
This will open a chrome window and print out the URL. The state machine this encapsulates takes the following form: | ||
|
||
![State Machine](digraph.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# GPT-like chatbot | ||
|
||
This is an example of chatgpt-like bot. It is simplified, but demonstrates the core concepts nicely. | ||
|
||
The core idea is that we: | ||
|
||
1. Accept a prompt | ||
2. Check to see if the prompt is "safe" (this is currently a no-op, but its there for show) | ||
3. Decide the response mode by querying openAI (answer a question, generate an image, write some code, and can't decide/prompt for more) | ||
4. Query one of our models with a modified prompt to return the right response | ||
5. Return the response | ||
6. Go back to the beginning and wipe the state. | ||
|
||
We have both a hamilton and non-hamilton implementation of this for comparison. For the simplicity of this example, | ||
Hamilton is likely overkill. There are a few nodes that could leverage it well, but the rest are too simple to | ||
worry about putting in a DAG. As examples get more complex, we anticipate that Hamilton nodes will play a more important role. | ||
|
||
The state machine this encapsulates takes the following form: | ||
|
||
![State Machine](digraph.png) | ||
|
||
|
||
Note that it is currently wired up to handle errors in the state machine, but the actions do not respect that yet. Coming soon. | ||
|
||
We have three files: | ||
|
||
- [application.py](application.py) -- This contains a mainline to generate the graph portrayal. | ||
- [requirements.txt](requirements.txt) -- Just the requirements. All this needs is Burr/Streamlit/openai | ||
- [streamlit_app.py](streamlit_app.py) -- This contains a simple Streamlit app to interact with the cow | ||
|
||
|
||
You must have your `OPENAI_API_KEY` set in your environment. You can do this by running. | ||
|
||
To run on streamlit, you can launch the app: | ||
|
||
```bash | ||
streamlit run streamlit_app.py | ||
``` | ||
|
||
This allows you to input a prompt, watch it "think", and explore the history/"why" of the response. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
burr[streamlit] | ||
openai |