mirror of
https://github.com/Hopiu/llm.git
synced 2026-04-18 20:21:03 +00:00
Rename back to llm, refs #1
This commit is contained in:
parent
04d00d9522
commit
93ebb96cfa
6 changed files with 17 additions and 20 deletions
12
README.md
12
README.md
|
|
@ -1,9 +1,9 @@
|
|||
# llm-cli
|
||||
# llm
|
||||
|
||||
[](https://pypi.org/project/llm-cli/)
|
||||
[](https://github.com/simonw/llm-cli/releases)
|
||||
[](https://github.com/simonw/llm-cli/actions?query=workflow%3ATest)
|
||||
[](https://github.com/simonw/llm-cli/blob/master/LICENSE)
|
||||
[](https://pypi.org/project/llm/)
|
||||
[](https://github.com/simonw/llm/releases)
|
||||
[](https://github.com/simonw/llm/actions?query=workflow%3ATest)
|
||||
[](https://github.com/simonw/llm/blob/master/LICENSE)
|
||||
|
||||
Access large language models from the command-line
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ Access large language models from the command-line
|
|||
|
||||
Install this tool using `pip`:
|
||||
|
||||
pip install llm-cli
|
||||
pip install llm
|
||||
|
||||
You need an OpenAI API key, which should either be set in the `OPENAI_API_KEY` environment variable, or saved in a plain text file called `~/.openai-api-key.txt` in your home directory.
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import sys
|
|||
default="chatgpt",
|
||||
default_if_no_args=True,
|
||||
)
|
||||
@click.version_option(package_name="llm_cli")
|
||||
@click.version_option()
|
||||
def cli():
|
||||
"Access large language models from the command-line"
|
||||
|
||||
|
|
@ -55,10 +55,8 @@ def get_openai_api_key():
|
|||
# Expand this to home directory / ~.openai-api-key.txt
|
||||
if "OPENAI_API_KEY" in os.environ:
|
||||
return os.environ["OPENAI_API_KEY"]
|
||||
path = os.path.expanduser("~/.openai-api-key.txt")
|
||||
path = os.path.expanduser('~/.openai-api-key.txt')
|
||||
# If the file exists, read it
|
||||
if os.path.exists(path):
|
||||
return open(path).read().strip()
|
||||
raise click.ClickException(
|
||||
"No OpenAI API key found. Set OPENAI_API_KEY environment variable or create ~/.openai-api-key.txt"
|
||||
)
|
||||
raise click.ClickException("No OpenAI API key found. Set OPENAI_API_KEY environment variable or create ~/.openai-api-key.txt")
|
||||
6
setup.py
6
setup.py
|
|
@ -13,7 +13,7 @@ def get_long_description():
|
|||
|
||||
|
||||
setup(
|
||||
name="llm-cli",
|
||||
name="llm",
|
||||
description="Access large language models from the command-line",
|
||||
long_description=get_long_description(),
|
||||
long_description_content_type="text/markdown",
|
||||
|
|
@ -26,10 +26,10 @@ setup(
|
|||
},
|
||||
license="Apache License, Version 2.0",
|
||||
version=VERSION,
|
||||
packages=["llm_cli"],
|
||||
packages=["llm"],
|
||||
entry_points="""
|
||||
[console_scripts]
|
||||
llm=llm_cli.cli:cli
|
||||
llm=llm.cli:cli
|
||||
""",
|
||||
install_requires=["click", "openai", "click-default-group-wheel"],
|
||||
extras_require={"test": ["pytest"]},
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
from click.testing import CliRunner
|
||||
from llm_cli.cli import cli
|
||||
from llm.cli import cli
|
||||
|
||||
|
||||
def test_prompt_required():
|
||||
def test_version():
|
||||
runner = CliRunner()
|
||||
with runner.isolated_filesystem():
|
||||
result = runner.invoke(cli)
|
||||
assert result.exit_code == 2
|
||||
assert "Missing argument 'PROMPT'" in result.output
|
||||
|
||||
result = runner.invoke(cli, ["--version"])
|
||||
assert result.exit_code == 0
|
||||
assert result.output.startswith("cli, version ")
|
||||
|
|
|
|||
Loading…
Reference in a new issue