Skip to content

Commit

Permalink
make it pip installable
Browse files Browse the repository at this point in the history
  • Loading branch information
granawkins committed Jan 31, 2024
1 parent a653de8 commit bb988ba
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 29 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,29 @@ Please proceed with caution. This obviously has the potential to cause harm if s
git clone http://github.com/AbanteAI/rawdog
cd rawdog
```
2. Setup a virtual environment and install dependencies
2. Install it locally with pip
```
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -e .
```
3. Choose a mode of interaction. You will be prompted to input your API key if not found:
Direct: Execute a single prompt and close
```
python3 -m rawdog Plot the size of all the files and directories in cwd
rawdog Plot the size of all the files and directories in cwd
```
Conversation: Initiate back-and-forth until you close. Rawdog can see its scripts and output.
```
python3 -m rawdog
rawdog
>>> What can I do for you? (Ctrl-C to exit)
>>> > |
```
## Optional Arguments
* `--dry-run`: Print and manually approve each script before executing.
* `--continuation`: Let the model run scripts to generate context for itself before completing the task.
## Model selection
Rawdog uses `litellm` for completions with 'gpt-4' as the default. You can adjust the model or
point it to other providers by modifying `~/.rawdog/config.yaml`.
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "rawdog"
version = "0.1.0"
description = "An AI command-line assistant"
readme = "README.md"
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]

[project.urls]
Homepage = "https://github.com/AbanteAI/rawdog"
Issues = "https://github.com/AbanteAI/rawdog/issues"

[project.scripts]
rawdog = "rawdog.__main__:main"
Empty file removed rawdog/__init__.py
Empty file.
1 change: 1 addition & 0 deletions src/rawdog/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.0"
48 changes: 25 additions & 23 deletions rawdog/__main__.py → src/rawdog/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,28 @@ def banner():
parser.add_argument('--continuation', action='store_true', help='Allow Rawdog to execute consecutive scripts.')
args = parser.parse_args()
llm_client = LLMClient(continuation=args.continuation) # Will prompt for API key if not found
if len(args.prompt) > 0:
rawdog(" ".join(args.prompt))
else:
banner()
while True:
try:
print("\nWhat can I do for you? (Ctrl-C to exit)")
prompt = input("> ")
print("")
continuation = True
while continuation is True:
try:
output = rawdog(prompt, silence=True)
continuation = args.continuation and output.strip().endswith("CONTINUE")
if args.dry_run or continuation is False:
print(output)
llm_client.conversation.append({"role": "system", "content": f"LAST SCRIPT OUTPUT:\n{output}"})
except KeyboardInterrupt:
print("Exiting...")
break
except KeyboardInterrupt:
print("Exiting...")
break

def main():
if len(args.prompt) > 0:
rawdog(" ".join(args.prompt))
else:
banner()
while True:
try:
print("\nWhat can I do for you? (Ctrl-C to exit)")
prompt = input("> ")
print("")
continuation = True
while continuation is True:
try:
output = rawdog(prompt, silence=True)
continuation = args.continuation and output and output.strip().endswith("CONTINUE")
if args.dry_run or continuation is False:
print(output)
llm_client.conversation.append({"role": "system", "content": f"LAST SCRIPT OUTPUT:\n{output}"})
except KeyboardInterrupt:
print("Exiting...")
break
except KeyboardInterrupt:
print("Exiting...")
break
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit bb988ba

Please sign in to comment.