-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added CLI interface * Added check on OpenAI key
- Loading branch information
Showing
3 changed files
with
41 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Allow lines to be as long as 120 characters. | ||
line-length = 120 |
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,37 @@ | ||
# -*- coding: utf-8 -*- | ||
import click | ||
|
||
WELCOME = """ | ||
Welcome to San Clone 👋 a molecular cloning agent 🧬. | ||
Give it an instruction like "Clone NADH Oxidase from Streptococcus pyogenes into the pET16b" | ||
and press ✨ enter ✨ | ||
""" | ||
|
||
|
||
@click.command() | ||
def main(): | ||
# check openai key | ||
try: | ||
from langchain.llms import OpenAI | ||
|
||
OpenAI(model="babbage-002") | ||
except Exception as e: | ||
if "OPENAI_API_KEY" in str(e): | ||
print("You need to set your OPENAI_API_KEY environment variable.") | ||
print("You can get one from https://beta.openai.com/") | ||
print("Then run the following command:") | ||
print("export OPENAI_API_KEY=<your key>") | ||
print("You can add this to your ~/.bashrc or ~/.bash_profile") | ||
return | ||
print(WELCOME) | ||
while True: | ||
instruction = input(">") | ||
if instruction == "exit" or instruction == "quit" or instruction == "q": | ||
print("Goodbye 👋") | ||
break | ||
else: | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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