kwark 0.0.0__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.
- kwark-0.0.0/PKG-INFO +39 -0
- kwark-0.0.0/README.md +22 -0
- kwark-0.0.0/kwark/__init__.py +13 -0
- kwark-0.0.0/kwark/__main__.py +4 -0
- kwark-0.0.0/kwark/ai.py +31 -0
- kwark-0.0.0/kwark/command/__init__.py +6 -0
- kwark-0.0.0/kwark/command/rize_command.py +31 -0
- kwark-0.0.0/kwark/prompts/rize.txt +14 -0
- kwark-0.0.0/kwark/util.py +11 -0
- kwark-0.0.0/pyproject.toml +21 -0
kwark-0.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: kwark
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Tap into AI brilliance from a simple shell command
|
|
5
|
+
License: MIT
|
|
6
|
+
Author: Steampunk Wizard
|
|
7
|
+
Author-email: kwark@steamwiz.io
|
|
8
|
+
Requires-Python: >=3.11,<3.12
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Requires-Dist: anthropic (>=0.45.2,<0.46.0)
|
|
13
|
+
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
14
|
+
Requires-Dist: wizlib (>=3.1.4,<4.0.0)
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# Kwark
|
|
18
|
+
|
|
19
|
+
## Tap into AI brilliance from a simple shell command
|
|
20
|
+
|
|
21
|
+
The tool currently has one command, `rize`, short for "summarize", which uses the Anthropic API to summarize the conculsions from a discussion or thread. It's designed to allow capturing discussion from e.g. Slack and use the output for documentation.
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
The `rize` command processes text from standard input.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pbpaste | kwark rize
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick installation (MacOS)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
brew install python@3.11
|
|
35
|
+
python3.11 -m pip install pipx
|
|
36
|
+
pipx install kwark
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
|
kwark-0.0.0/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Kwark
|
|
2
|
+
|
|
3
|
+
## Tap into AI brilliance from a simple shell command
|
|
4
|
+
|
|
5
|
+
The tool currently has one command, `rize`, short for "summarize", which uses the Anthropic API to summarize the conculsions from a discussion or thread. It's designed to allow capturing discussion from e.g. Slack and use the output for documentation.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
The `rize` command processes text from standard input.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pbpaste | kwark rize
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick installation (MacOS)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
brew install python@3.11
|
|
19
|
+
python3.11 -m pip install pipx
|
|
20
|
+
pipx install kwark
|
|
21
|
+
```
|
|
22
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from wizlib.app import WizApp
|
|
2
|
+
from wizlib.stream_handler import StreamHandler
|
|
3
|
+
from wizlib.config_handler import ConfigHandler
|
|
4
|
+
from wizlib.ui_handler import UIHandler
|
|
5
|
+
|
|
6
|
+
from kwark.command import KwarkCommand
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class KwarkApp(WizApp):
|
|
10
|
+
|
|
11
|
+
base = KwarkCommand
|
|
12
|
+
name = 'kwark'
|
|
13
|
+
handlers = [StreamHandler, ConfigHandler, UIHandler]
|
kwark-0.0.0/kwark/ai.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from anthropic import Anthropic
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AI: # pragma: nocover
|
|
5
|
+
|
|
6
|
+
model = 'claude-3-5-sonnet-20241022'
|
|
7
|
+
|
|
8
|
+
def __init__(self):
|
|
9
|
+
self.client = Anthropic()
|
|
10
|
+
|
|
11
|
+
def query(self, text):
|
|
12
|
+
"""Send a one-time query, no tools"""
|
|
13
|
+
messages = [
|
|
14
|
+
{
|
|
15
|
+
"role": "user",
|
|
16
|
+
"content": [
|
|
17
|
+
{
|
|
18
|
+
"type": "text",
|
|
19
|
+
"text": text
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
]
|
|
25
|
+
message = self.client.messages.create(
|
|
26
|
+
model=self.model,
|
|
27
|
+
max_tokens=4096,
|
|
28
|
+
temperature=0,
|
|
29
|
+
messages=messages)
|
|
30
|
+
response = message.content[0].text
|
|
31
|
+
return response
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from wizlib.parser import WizParser
|
|
2
|
+
|
|
3
|
+
from kwark.command import KwarkCommand
|
|
4
|
+
from kwark.util import load_prompt
|
|
5
|
+
from kwark.ai import AI
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RizeCommand(KwarkCommand):
|
|
9
|
+
"""Summarize observations and conclusions from random text such as a
|
|
10
|
+
thread, email, or notes"""
|
|
11
|
+
|
|
12
|
+
name = 'rize'
|
|
13
|
+
prompt = load_prompt(name)
|
|
14
|
+
|
|
15
|
+
@classmethod
|
|
16
|
+
def add_args(cls, parser: WizParser):
|
|
17
|
+
super().add_args(parser)
|
|
18
|
+
# parser.add_argument()
|
|
19
|
+
|
|
20
|
+
def handle_vals(self):
|
|
21
|
+
super().handle_vals()
|
|
22
|
+
# if not self.provided('dir'):
|
|
23
|
+
# self.dir = self.app.config.get('filez4eva-source')
|
|
24
|
+
|
|
25
|
+
@KwarkCommand.wrap
|
|
26
|
+
def execute(self):
|
|
27
|
+
input = self.app.stream.text
|
|
28
|
+
prompt = self.prompt.format(text=input)
|
|
29
|
+
response = AI().query(prompt)
|
|
30
|
+
return response
|
|
31
|
+
# return f"Hello, {input}!"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Summarize the text below.
|
|
2
|
+
|
|
3
|
+
DO NOT reference the text itself. For example: Do not return sentences beginning with "the text says..."
|
|
4
|
+
|
|
5
|
+
If the text contains a conversation, DO NOT name the speakers. For example, Do not return sentences beginning with "Steve said..."
|
|
6
|
+
|
|
7
|
+
State the information and conclusions from the text, presenting them as independent pieces of information.
|
|
8
|
+
|
|
9
|
+
Respond with a single paragraph of text with 1-4 complete sentences.
|
|
10
|
+
|
|
11
|
+
-----
|
|
12
|
+
|
|
13
|
+
{text}
|
|
14
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def load_prompt(name):
|
|
6
|
+
mydirectory = os.path.dirname(os.path.abspath(__file__))
|
|
7
|
+
promptdir = Path(mydirectory) / 'prompts'
|
|
8
|
+
filepath = promptdir / f"{name}.txt"
|
|
9
|
+
with open(filepath) as file:
|
|
10
|
+
content = file.read()
|
|
11
|
+
return content
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "kwark"
|
|
3
|
+
description = "Tap into AI brilliance from a simple shell command"
|
|
4
|
+
authors = ["Steampunk Wizard <kwark@steamwiz.io>"]
|
|
5
|
+
license = "MIT"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
version = "0.0.0"
|
|
8
|
+
|
|
9
|
+
[tool.poetry.dependencies]
|
|
10
|
+
python = "~3.11"
|
|
11
|
+
wizlib = "^3.1.4"
|
|
12
|
+
requests = "^2.32.3"
|
|
13
|
+
anthropic = "^0.45.2"
|
|
14
|
+
|
|
15
|
+
[tool.poetry.group.dev.dependencies]
|
|
16
|
+
pycodestyle = "^2.11.0"
|
|
17
|
+
autopep8 = "^2.0.4"
|
|
18
|
+
coverage = "^7.3.0"
|
|
19
|
+
|
|
20
|
+
[tool.poetry.scripts]
|
|
21
|
+
kwark = "kwark:KwarkApp.main"
|