Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CLI #2

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .ruff.toml
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
37 changes: 37 additions & 0 deletions sanclone/main.py
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()
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
url="https://github.com/whitead/sanclone",
license="MIT",
packages=["sanclone", "sanclone.tools"],
install_requires=["langchain", "biopython"],
install_requires=["langchain", "biopython", "click"],
entry_points={"console_scripts": ["sanclone = sanclone.main:main"]},
test_suite="tests",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down
Loading