clai 0.1.0__tar.gz → 0.1.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of clai might be problematic. Click here for more details.

clai-0.1.12/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ site
2
+ .venv
3
+ dist
4
+ __pycache__
5
+ .env
6
+ .dev.vars
7
+ /scratch/
8
+ /.coverage
9
+ env*/
10
+ /TODO.md
11
+ /postgres-data/
12
+ .DS_Store
13
+ examples/pydantic_ai_examples/.chat_app_messages.sqlite
14
+ .cache/
15
+ .vscode/
16
+ /question_graph_history.json
17
+ /docs-site/.wrangler/
18
+ /CLAUDE.md
19
+ node_modules/
clai-0.1.12/PKG-INFO ADDED
@@ -0,0 +1,106 @@
1
+ Metadata-Version: 2.4
2
+ Name: clai
3
+ Version: 0.1.12
4
+ Summary: PydanticAI CLI: command line interface to chat to LLMs
5
+ Author-email: Samuel Colvin <samuel@pydantic.dev>, Marcelo Trylesinski <marcelotryle@gmail.com>, David Montague <david@pydantic.dev>, Alex Hall <alex@pydantic.dev>
6
+ License-Expression: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Environment :: Console
9
+ Classifier: Environment :: MacOS X
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Information Technology
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Operating System :: Unix
16
+ Classifier: Programming Language :: Python
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Internet
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Requires-Python: >=3.9
27
+ Requires-Dist: pydantic-ai==0.1.12
28
+ Description-Content-Type: text/markdown
29
+
30
+ # clai
31
+
32
+ [![CI](https://github.com/pydantic/pydantic-ai/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/pydantic/pydantic-ai/actions/workflows/ci.yml?query=branch%3Amain)
33
+ [![Coverage](https://coverage-badge.samuelcolvin.workers.dev/pydantic/pydantic-ai.svg)](https://coverage-badge.samuelcolvin.workers.dev/redirect/pydantic/pydantic-ai)
34
+ [![PyPI](https://img.shields.io/pypi/v/clai.svg)](https://pypi.python.org/pypi/clai)
35
+ [![versions](https://img.shields.io/pypi/pyversions/clai.svg)](https://github.com/pydantic/pydantic-ai)
36
+ [![license](https://img.shields.io/github/license/pydantic/pydantic-ai.svg?v)](https://github.com/pydantic/pydantic-ai/blob/main/LICENSE)
37
+
38
+ (pronounced "clay")
39
+
40
+ Command line interface to chat to LLMs, part of the [PydanticAI project](https://github.com/pydantic/pydantic-ai).
41
+
42
+ ## Usage
43
+
44
+ <!-- Keep this in sync with docs/cli.md -->
45
+
46
+ You'll need to set an environment variable depending on the provider you intend to use.
47
+
48
+ E.g. if you're using OpenAI, set the `OPENAI_API_KEY` environment variable:
49
+
50
+ ```bash
51
+ export OPENAI_API_KEY='your-api-key-here'
52
+ ```
53
+
54
+ Then with [`uvx`](https://docs.astral.sh/uv/guides/tools/), run:
55
+
56
+ ```bash
57
+ uvx clai
58
+ ```
59
+
60
+ Or to install `clai` globally [with `uv`](https://docs.astral.sh/uv/guides/tools/#installing-tools), run:
61
+
62
+ ```bash
63
+ uv tool install clai
64
+ ...
65
+ clai
66
+ ```
67
+
68
+ Or with `pip`, run:
69
+
70
+ ```bash
71
+ pip install clai
72
+ ...
73
+ clai
74
+ ```
75
+
76
+ Either way, running `clai` will start an interactive session where you can chat with the AI model. Special commands available in interactive mode:
77
+
78
+ - `/exit`: Exit the session
79
+ - `/markdown`: Show the last response in markdown format
80
+ - `/multiline`: Toggle multiline input mode (use Ctrl+D to submit)
81
+
82
+ ## Help
83
+
84
+ ```
85
+ usage: clai [-h] [-m [MODEL]] [-l] [-t [CODE_THEME]] [--no-stream] [--version] [prompt]
86
+
87
+ PydanticAI CLI v...
88
+
89
+ Special prompts:
90
+ * `/exit` - exit the interactive mode (ctrl-c and ctrl-d also work)
91
+ * `/markdown` - show the last markdown output of the last question
92
+ * `/multiline` - toggle multiline mode
93
+
94
+ positional arguments:
95
+ prompt AI Prompt, if omitted fall into interactive mode
96
+
97
+ options:
98
+ -h, --help show this help message and exit
99
+ -m [MODEL], --model [MODEL]
100
+ Model to use, in format "<provider>:<model>" e.g. "openai:gpt-4o" or "anthropic:claude-3-7-sonnet-latest". Defaults to "openai:gpt-4o".
101
+ -l, --list-models List all available models and exit
102
+ -t [CODE_THEME], --code-theme [CODE_THEME]
103
+ Which colors to use for code, can be "dark", "light" or any theme from pygments.org/styles/. Defaults to "dark" which works well on dark terminals.
104
+ --no-stream Disable streaming from the model
105
+ --version Show version and exit
106
+ ```
clai-0.1.12/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # clai
2
+
3
+ [![CI](https://github.com/pydantic/pydantic-ai/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/pydantic/pydantic-ai/actions/workflows/ci.yml?query=branch%3Amain)
4
+ [![Coverage](https://coverage-badge.samuelcolvin.workers.dev/pydantic/pydantic-ai.svg)](https://coverage-badge.samuelcolvin.workers.dev/redirect/pydantic/pydantic-ai)
5
+ [![PyPI](https://img.shields.io/pypi/v/clai.svg)](https://pypi.python.org/pypi/clai)
6
+ [![versions](https://img.shields.io/pypi/pyversions/clai.svg)](https://github.com/pydantic/pydantic-ai)
7
+ [![license](https://img.shields.io/github/license/pydantic/pydantic-ai.svg?v)](https://github.com/pydantic/pydantic-ai/blob/main/LICENSE)
8
+
9
+ (pronounced "clay")
10
+
11
+ Command line interface to chat to LLMs, part of the [PydanticAI project](https://github.com/pydantic/pydantic-ai).
12
+
13
+ ## Usage
14
+
15
+ <!-- Keep this in sync with docs/cli.md -->
16
+
17
+ You'll need to set an environment variable depending on the provider you intend to use.
18
+
19
+ E.g. if you're using OpenAI, set the `OPENAI_API_KEY` environment variable:
20
+
21
+ ```bash
22
+ export OPENAI_API_KEY='your-api-key-here'
23
+ ```
24
+
25
+ Then with [`uvx`](https://docs.astral.sh/uv/guides/tools/), run:
26
+
27
+ ```bash
28
+ uvx clai
29
+ ```
30
+
31
+ Or to install `clai` globally [with `uv`](https://docs.astral.sh/uv/guides/tools/#installing-tools), run:
32
+
33
+ ```bash
34
+ uv tool install clai
35
+ ...
36
+ clai
37
+ ```
38
+
39
+ Or with `pip`, run:
40
+
41
+ ```bash
42
+ pip install clai
43
+ ...
44
+ clai
45
+ ```
46
+
47
+ Either way, running `clai` will start an interactive session where you can chat with the AI model. Special commands available in interactive mode:
48
+
49
+ - `/exit`: Exit the session
50
+ - `/markdown`: Show the last response in markdown format
51
+ - `/multiline`: Toggle multiline input mode (use Ctrl+D to submit)
52
+
53
+ ## Help
54
+
55
+ ```
56
+ usage: clai [-h] [-m [MODEL]] [-l] [-t [CODE_THEME]] [--no-stream] [--version] [prompt]
57
+
58
+ PydanticAI CLI v...
59
+
60
+ Special prompts:
61
+ * `/exit` - exit the interactive mode (ctrl-c and ctrl-d also work)
62
+ * `/markdown` - show the last markdown output of the last question
63
+ * `/multiline` - toggle multiline mode
64
+
65
+ positional arguments:
66
+ prompt AI Prompt, if omitted fall into interactive mode
67
+
68
+ options:
69
+ -h, --help show this help message and exit
70
+ -m [MODEL], --model [MODEL]
71
+ Model to use, in format "<provider>:<model>" e.g. "openai:gpt-4o" or "anthropic:claude-3-7-sonnet-latest". Defaults to "openai:gpt-4o".
72
+ -l, --list-models List all available models and exit
73
+ -t [CODE_THEME], --code-theme [CODE_THEME]
74
+ Which colors to use for code, can be "dark", "light" or any theme from pygments.org/styles/. Defaults to "dark" which works well on dark terminals.
75
+ --no-stream Disable streaming from the model
76
+ --version Show version and exit
77
+ ```
@@ -0,0 +1,11 @@
1
+ from importlib.metadata import version as _metadata_version
2
+
3
+ from pydantic_ai import _cli
4
+
5
+ __all__ = '__version__', 'cli'
6
+ __version__ = _metadata_version('clai')
7
+
8
+
9
+ def cli():
10
+ """Run the clai CLI and exit."""
11
+ _cli.cli_exit('clai')
@@ -0,0 +1,6 @@
1
+ """This means `python -m clai` should run the CLI."""
2
+
3
+ from pydantic_ai import _cli
4
+
5
+ if __name__ == '__main__':
6
+ _cli.cli_exit('clai')
@@ -0,0 +1,63 @@
1
+ [build-system]
2
+ requires = ["hatchling", "uv-dynamic-versioning>=0.7.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [tool.hatch.version]
6
+ source = "uv-dynamic-versioning"
7
+
8
+ [tool.uv-dynamic-versioning]
9
+ vcs = "git"
10
+ style = "pep440"
11
+ bump = true
12
+
13
+ [project]
14
+ name = "clai"
15
+ dynamic = ["version", "dependencies"]
16
+ description = "PydanticAI CLI: command line interface to chat to LLMs"
17
+ authors = [
18
+ { name = "Samuel Colvin", email = "samuel@pydantic.dev" },
19
+ { name = "Marcelo Trylesinski", email = "marcelotryle@gmail.com" },
20
+ { name = "David Montague", email = "david@pydantic.dev" },
21
+ { name = "Alex Hall", email = "alex@pydantic.dev" },
22
+ ]
23
+ license = "MIT"
24
+ readme = "README.md"
25
+ classifiers = [
26
+ "Development Status :: 4 - Beta",
27
+ "Programming Language :: Python",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3 :: Only",
30
+ "Programming Language :: Python :: 3.9",
31
+ "Programming Language :: Python :: 3.10",
32
+ "Programming Language :: Python :: 3.11",
33
+ "Programming Language :: Python :: 3.12",
34
+ "Programming Language :: Python :: 3.13",
35
+ "Intended Audience :: Developers",
36
+ "Intended Audience :: Information Technology",
37
+ "Intended Audience :: System Administrators",
38
+ "License :: OSI Approved :: MIT License",
39
+ "Operating System :: Unix",
40
+ "Operating System :: POSIX :: Linux",
41
+ "Environment :: Console",
42
+ "Environment :: MacOS X",
43
+ "Topic :: Software Development :: Libraries :: Python Modules",
44
+ "Topic :: Internet",
45
+ ]
46
+ requires-python = ">=3.9"
47
+
48
+ [tool.hatch.metadata.hooks.uv-dynamic-versioning]
49
+ dependencies = [
50
+ "pydantic-ai=={{ version }}",
51
+ ]
52
+
53
+ [tool.hatch.metadata]
54
+ allow-direct-references = true
55
+
56
+ [project.scripts]
57
+ clai = "clai:cli"
58
+
59
+ [tool.hatch.build.targets.wheel]
60
+ packages = ["clai"]
61
+
62
+ [tool.uv.sources]
63
+ pydantic-ai = { workspace = true }
@@ -0,0 +1,30 @@
1
+ import os
2
+ import re
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ import pytest
7
+
8
+ from pydantic_ai._cli import cli
9
+
10
+
11
+ @pytest.mark.skipif(sys.version_info >= (3, 13), reason='slightly different output with 3.13')
12
+ def test_cli_help(capfd: pytest.CaptureFixture[str]):
13
+ """Check README.md help output matches `clai --help`."""
14
+ os.environ['COLUMNS'] = '150'
15
+ with pytest.raises(SystemExit):
16
+ cli(['--help'], prog_name='clai')
17
+
18
+ help_output = capfd.readouterr().out.strip()
19
+ # TODO change when we reach v1
20
+ help_output = re.sub(r'(PydanticAI CLI v).+', r'\1...', help_output)
21
+
22
+ this_dir = Path(__file__).parent
23
+ readme = this_dir / 'README.md'
24
+ content = readme.read_text()
25
+
26
+ new_content, count = re.subn('^(## Help\n+```).+?```', rf'\1\n{help_output}\n```', content, flags=re.M | re.S)
27
+ assert count, 'help section not found'
28
+ if new_content != content:
29
+ readme.write_text(new_content)
30
+ pytest.fail('`clai --help` output changed.')
clai-0.1.0/PKG-INFO DELETED
@@ -1,80 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: clai
3
- Version: 0.1.0
4
- Summary: Command Line AI- this tool lets you call ChatGPT from a CLI
5
- License: Proprietary
6
- Author: apockill
7
- Author-email: apocthiel@gmail.com
8
- Requires-Python: >=3.8,<4.0
9
- Classifier: License :: Other/Proprietary License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.8
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Requires-Dist: openai (>=0.27.0,<0.28.0)
15
- Description-Content-Type: text/markdown
16
-
17
- # clai
18
- Command Line AI- this tool lets you call ChatGPT from a CLI.
19
-
20
- I'm designing this to be used in conjunction with a fork of [shin][shin], which will allow you
21
- to call `clai` from any textbox in your computer. Finally, chatGPT everywhere!
22
-
23
- [shin]: https://github.com/apockill/shin
24
- _________________
25
-
26
- [![PyPI version](https://badge.fury.io/py/clai.svg)](http://badge.fury.io/py/clai)
27
- [![Test Status](https://github.com/apockill/clai/workflows/Test/badge.svg?branch=main)](https://github.com/apockill/clai/actions?query=workflow%3ATest)
28
- [![Lint Status](https://github.com/apockill/clai/workflows/Lint/badge.svg?branch=main)](https://github.com/apockill/clai/actions?query=workflow%3ALint)
29
- [![codecov](https://codecov.io/gh/apockill/clai/branch/main/graph/badge.svg)](https://codecov.io/gh/apockill/clai)
30
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
31
- [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://timothycrosley.github.io/isort/)
32
- _________________
33
-
34
- [Read Latest Documentation](https://apockill.github.io/clai/) - [Browse GitHub Code Repository](https://github.com/apockill/clai/)
35
- _________________
36
-
37
- ## Installation
38
- 1. The recommended installation method is to use `pipx`, via
39
- ```
40
- pipx install clai
41
- ```
42
-
43
- 1. Then go to [OpenAI] and create an API Key. Once it's generated, add the following to
44
- your `.bashrc`:
45
- ```bash
46
- export OPENAI_API_TOKEN=<paste here>
47
- ```
48
-
49
- [OpenAI]: https://platform.openai.com/account/api-keys
50
-
51
- ## Usage
52
- Invoke the assistant with the format `clai <your prompt>`. For example:
53
- ```
54
- clai Write an email saying I'll be late to work because I'm working on commandline AIs
55
- ```
56
-
57
- ## Development
58
-
59
- ### Installing python dependencies
60
- ```shell
61
- poetry install
62
- ```
63
-
64
- ### Running Tests
65
- ```shell
66
- pytest .
67
- ```
68
-
69
- ### Formatting Code
70
- ```shell
71
- bash .github/format.sh
72
- ```
73
-
74
- ### Linting
75
- ```shell
76
- bash .github/check_lint.sh
77
- ```
78
-
79
- # TODO: remove references to tests?
80
-
clai-0.1.0/README.md DELETED
@@ -1,63 +0,0 @@
1
- # clai
2
- Command Line AI- this tool lets you call ChatGPT from a CLI.
3
-
4
- I'm designing this to be used in conjunction with a fork of [shin][shin], which will allow you
5
- to call `clai` from any textbox in your computer. Finally, chatGPT everywhere!
6
-
7
- [shin]: https://github.com/apockill/shin
8
- _________________
9
-
10
- [![PyPI version](https://badge.fury.io/py/clai.svg)](http://badge.fury.io/py/clai)
11
- [![Test Status](https://github.com/apockill/clai/workflows/Test/badge.svg?branch=main)](https://github.com/apockill/clai/actions?query=workflow%3ATest)
12
- [![Lint Status](https://github.com/apockill/clai/workflows/Lint/badge.svg?branch=main)](https://github.com/apockill/clai/actions?query=workflow%3ALint)
13
- [![codecov](https://codecov.io/gh/apockill/clai/branch/main/graph/badge.svg)](https://codecov.io/gh/apockill/clai)
14
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
15
- [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://timothycrosley.github.io/isort/)
16
- _________________
17
-
18
- [Read Latest Documentation](https://apockill.github.io/clai/) - [Browse GitHub Code Repository](https://github.com/apockill/clai/)
19
- _________________
20
-
21
- ## Installation
22
- 1. The recommended installation method is to use `pipx`, via
23
- ```
24
- pipx install clai
25
- ```
26
-
27
- 1. Then go to [OpenAI] and create an API Key. Once it's generated, add the following to
28
- your `.bashrc`:
29
- ```bash
30
- export OPENAI_API_TOKEN=<paste here>
31
- ```
32
-
33
- [OpenAI]: https://platform.openai.com/account/api-keys
34
-
35
- ## Usage
36
- Invoke the assistant with the format `clai <your prompt>`. For example:
37
- ```
38
- clai Write an email saying I'll be late to work because I'm working on commandline AIs
39
- ```
40
-
41
- ## Development
42
-
43
- ### Installing python dependencies
44
- ```shell
45
- poetry install
46
- ```
47
-
48
- ### Running Tests
49
- ```shell
50
- pytest .
51
- ```
52
-
53
- ### Formatting Code
54
- ```shell
55
- bash .github/format.sh
56
- ```
57
-
58
- ### Linting
59
- ```shell
60
- bash .github/check_lint.sh
61
- ```
62
-
63
- # TODO: remove references to tests?
@@ -1,6 +0,0 @@
1
- """**clai**
2
-
3
- Command Line AI- this tool lets you call ChatGPT from a CLI
4
- """
5
- __version__ = "0.1.0"
6
- from .invoke import invoke
clai-0.1.0/clai/api.py DELETED
@@ -1,17 +0,0 @@
1
- import os
2
- from types import ModuleType
3
-
4
- import openai
5
-
6
- API_TOKEN_VAR = "OPENAI_API_TOKEN"
7
-
8
-
9
- def initialize_api() -> ModuleType:
10
- try:
11
- api_key = os.environ[API_TOKEN_VAR]
12
- except KeyError:
13
- print(f"You must set the`{API_TOKEN_VAR}` variable in your environment!")
14
- exit(1)
15
-
16
- openai.api_key = api_key
17
- return openai
clai-0.1.0/clai/invoke.py DELETED
@@ -1,103 +0,0 @@
1
- from argparse import ArgumentParser
2
-
3
- from .api import initialize_api
4
-
5
- DEFAULT_ASSISTANT_ROLE = """
6
- You are an assistant that is capable of being called anywhere on a desktop computer. You
7
- may be called within the context of an email, a URL box, commandline, a text editor, or
8
- even word documents!
9
-
10
- Your role is to answer the users request as shortly and succinctly as possible. You
11
- will follow the following rules:
12
-
13
- When asked to write a command:
14
- 1) Assume a linux desktop environment in a bash shell
15
- 2) Feel free to use commonly installed unix tools
16
-
17
- When asked to write a command, code, formulas, or any one-line response task:
18
- 1) NEVER WRITE EXPLANATIONS. Only include the command/code/etc, ready to be run
19
- 2) NEVER WRITE USAGE INSTRUCTIONS.
20
- 3) Remember, the text that you write will immediately be run, do not include code blocks
21
- 4) If there is something that requires user input, such as a cell in a sheet or a
22
- variable from the user, write it inside of brackets, like this: <INPUT DESCRIBER>,
23
- where the insides of the bracket have an example of what is needed to be filled in.
24
-
25
- When asked to write long-form text content:
26
- 1) Never ask for more information. If something is to be guessed, write it in template
27
- format. For example, if asked to write an email use <Insert time here> when writing
28
- the portion of an email that specifies something that was not included in the users
29
- question.
30
- 2) Only assume the content is long form if the user mentions email, or 'long message'.
31
- """
32
-
33
- EXAMPLE_EMAIL = """
34
- Dear <Recipient's Name>,
35
-
36
- I hope this email finds you well. I am writing to request a meeting with you on <Date and Time>, and I would appreciate it if you could confirm your availability at your earliest convenience.
37
-
38
- The purpose of this meeting is to discuss <Purpose of the Meeting> with you. Specifically, I would like to <Agenda Item 1>, <Agenda Item 2>, and <Agenda Item 3>. The meeting will last approximately <Meeting Duration> and will take place at <Meeting Location>.
39
-
40
- Please let me know if this date and time work for you. If not, please suggest an alternative time that is convenient for you. Additionally, if there are any documents or information you would like me to review before the meeting, please let me know, and I will make sure to review them.
41
-
42
- I look forward to hearing from you soon.
43
-
44
- Best regards,
45
-
46
- <Your Name>
47
- """ # noqa: E501
48
-
49
- EXAMPLE_REGEX = '=IFERROR(REGEXEXTRACT(<INPUT CELL HERE>, "[A-z0-9._%+-]+@[A-z0-9.-]+\.[A-z]{2,4}");"")' # noqa
50
-
51
- EXAMPLE_PYTHON = """
52
- def fibonacci(n: int) -> Generator[int, None, None]:
53
- a, b = 0, 1
54
- for _ in range(n):
55
- yield a
56
- a, b = b, a + b
57
- """
58
- CONTEXT = [
59
- {"role": "system", "content": DEFAULT_ASSISTANT_ROLE},
60
- {
61
- "role": "user",
62
- "content": "commandline search for files with the name 'bruh' in them",
63
- },
64
- {"role": "assistant", "content": "grep -rnw . -e 'bruh'"},
65
- {
66
- "role": "user",
67
- "content": "email set up a meeting next week",
68
- },
69
- {"role": "assistant", "content": EXAMPLE_EMAIL},
70
- {
71
- "role": "user",
72
- "content": "google sheets formula extracts an email from string of text",
73
- },
74
- {
75
- "role": "assistant",
76
- "content": EXAMPLE_REGEX,
77
- },
78
- {
79
- "role": "user",
80
- "content": "python fibonacci function in form of a generator",
81
- },
82
- {
83
- "role": "assistant",
84
- "content": EXAMPLE_PYTHON,
85
- },
86
- ]
87
-
88
-
89
- def invoke() -> None:
90
- parser = ArgumentParser("CLAI- your own command line AI!")
91
- parser.add_argument("prompt", type=str, nargs="+")
92
- parser.add_argument("-e", "--engine", default="")
93
- args = parser.parse_args()
94
-
95
- openai = initialize_api()
96
-
97
- prompt = " ".join(args.prompt)
98
- response = openai.ChatCompletion.create(
99
- model="gpt-3.5-turbo", messages=[*CONTEXT, {"role": "user", "content": prompt}]
100
- )
101
-
102
- best_response = response["choices"][0]["message"]["content"]
103
- print(best_response.strip())
clai-0.1.0/pyproject.toml DELETED
@@ -1,48 +0,0 @@
1
- [tool.poetry]
2
- name = "clai"
3
- version = "0.1.0"
4
- description = "Command Line AI- this tool lets you call ChatGPT from a CLI"
5
- authors = ["apockill <apocthiel@gmail.com>"]
6
- license = "Proprietary"
7
- readme = "README.md"
8
-
9
- [tool.poetry.dependencies]
10
- python = "^3.8"
11
- openai = "^0.27.0"
12
-
13
- [tool.poetry.dev-dependencies]
14
- darglint = "^1.8.1"
15
- vulture = "^2.5"
16
- bandit = "^1.7"
17
- isort = "^5.10"
18
- flake8-bugbear = "^22.7"
19
- black = "^22.6"
20
- mypy = "^0.961"
21
- pytest = "^7.1"
22
- pytest-cov = "^3.0"
23
- pep8-naming = "^0.13.1"
24
- portray = "^1.7"
25
- cruft = "^2.10"
26
-
27
- [tool.poetry.scripts]
28
- clai = "clai:invoke"
29
- ai = "clai:invoke"
30
-
31
- [build-system]
32
- requires = ["poetry>=0.12"]
33
- build-backend = "poetry.masonry.api"
34
-
35
- [tool.black]
36
- line-length = 88
37
-
38
- [tool.isort]
39
- profile = "hug"
40
-
41
- [tool.mypy]
42
- strict = true
43
- ignore_missing_imports = true
44
- disallow_subclassing_any = false
45
- implicit_reexport = true
46
- # We can't add annotations to decorators from other libraries, making this
47
- # check not very useful
48
- disallow_untyped_decorators = false
clai-0.1.0/setup.py DELETED
@@ -1,34 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from setuptools import setup
3
-
4
- packages = \
5
- ['clai']
6
-
7
- package_data = \
8
- {'': ['*']}
9
-
10
- install_requires = \
11
- ['openai>=0.27.0,<0.28.0']
12
-
13
- entry_points = \
14
- {'console_scripts': ['ai = clai:invoke', 'clai = clai:invoke']}
15
-
16
- setup_kwargs = {
17
- 'name': 'clai',
18
- 'version': '0.1.0',
19
- 'description': 'Command Line AI- this tool lets you call ChatGPT from a CLI',
20
- 'long_description': "# clai\nCommand Line AI- this tool lets you call ChatGPT from a CLI. \n\nI'm designing this to be used in conjunction with a fork of [shin][shin], which will allow you\nto call `clai` from any textbox in your computer. Finally, chatGPT everywhere!\n\n[shin]: https://github.com/apockill/shin\n_________________\n\n[![PyPI version](https://badge.fury.io/py/clai.svg)](http://badge.fury.io/py/clai)\n[![Test Status](https://github.com/apockill/clai/workflows/Test/badge.svg?branch=main)](https://github.com/apockill/clai/actions?query=workflow%3ATest)\n[![Lint Status](https://github.com/apockill/clai/workflows/Lint/badge.svg?branch=main)](https://github.com/apockill/clai/actions?query=workflow%3ALint)\n[![codecov](https://codecov.io/gh/apockill/clai/branch/main/graph/badge.svg)](https://codecov.io/gh/apockill/clai)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://timothycrosley.github.io/isort/)\n_________________\n\n[Read Latest Documentation](https://apockill.github.io/clai/) - [Browse GitHub Code Repository](https://github.com/apockill/clai/)\n_________________\n\n## Installation\n1. The recommended installation method is to use `pipx`, via\n ```\n pipx install clai\n ```\n\n1. Then go to [OpenAI] and create an API Key. Once it's generated, add the following to \n your `.bashrc`:\n ```bash\n export OPENAI_API_TOKEN=<paste here>\n ```\n\n[OpenAI]: https://platform.openai.com/account/api-keys\n\n## Usage\nInvoke the assistant with the format `clai <your prompt>`. For example:\n```\nclai Write an email saying I'll be late to work because I'm working on commandline AIs\n```\n\n## Development\n\n### Installing python dependencies\n```shell\npoetry install\n```\n\n### Running Tests\n```shell\npytest .\n```\n\n### Formatting Code\n```shell\nbash .github/format.sh\n```\n\n### Linting\n```shell\nbash .github/check_lint.sh\n```\n\n# TODO: remove references to tests?\n",
21
- 'author': 'apockill',
22
- 'author_email': 'apocthiel@gmail.com',
23
- 'maintainer': 'None',
24
- 'maintainer_email': 'None',
25
- 'url': 'None',
26
- 'packages': packages,
27
- 'package_data': package_data,
28
- 'install_requires': install_requires,
29
- 'entry_points': entry_points,
30
- 'python_requires': '>=3.8,<4.0',
31
- }
32
-
33
-
34
- setup(**setup_kwargs)