Last active
July 5, 2024 05:20
-
-
Save elijahbenizzy/de7c403d31b7cc2581c464a014f79a30 to your computer and use it in GitHub Desktop.
graph_builder.py
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
graph = ( | |
GraphBuilder() | |
.with_actions( | |
prompt=process_prompt, | |
check_safety=check_safety, | |
decide_mode=choose_mode, | |
generate_code=chat_response.bind( | |
prepend_prompt="Please respond with *only* code and no other text | |
"(at all) to the following", | |
), | |
... # more left out for brevity | |
) | |
.with_transitions( | |
("prompt", "check_safety", default), | |
("check_safety", "decide_mode", when(safe=True)), | |
("check_safety", "unsafe_response", default), | |
("decide_mode", "generate_code", when(mode="generate_code")), | |
... # more left out for brevity | |
) | |
.build() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment