Skip to content

Commit

Permalink
feat(README): add CONTRIBUTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
efugier committed May 6, 2024
1 parent 8860441 commit fc8eec0
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 15 deletions.
69 changes: 69 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
## Contributing to Smartcat 🐈‍⬛

### State of the project and main directions

Smartcat has reached an acceptable feature set. As a unix CLI tool it should remain focused and minimal but feature requests and suggestions are encouraged.

Codebase quality improvement are very welcome as I hadn't really used rust since 2019 and it shows.

### Codebase map

```python
src/
# args parsing logic
├── main.rs
# logic to customize the template prompt with the args
├── prompt_customization.rs
# logic to insert the input into the prompt
├── input_processing.rs
# smartcat-related config structs
├── config
│ │ # function to check config
│   ├── mod.rs
│ │ # config structs for API definition (url, key...)
│   ├── api.rs
│ │ # config structs for prompt defition (messages, model, temperature...)
│   └── prompt.rs
# third-party related code
└── third_party
# make third party requests
├── mod.rs
# logic to adapt smartcat prompts to third party ones
├── prompt_adapters.rs
# logic to parse and extract the message from third party answers
└── response_parsing.rs
```

#### Logic flow:

The prompt object is passed through the entire program, enriched with the input (from stdin) and then the response. The response is them written stdout and the whole thing is saved a the last prompt for re-use.

```python
main
# parse the args and get the template prompt / continue with last conversation as prompt
-> prompt_customization::customize_prompt
# update the templated prompt with the information from the args
-> input_processing::process_input_with_request
# insert the input in the prompt
# load the api config
-> third_party::make_api_request
# translate the smartcat prompt to api-specific prompt
# make the request
# get the message from api-specific response
# add response message to the prompt
# write the response message to stdout
# save the enriched prompt as last conversation
# exit
```

### Testing

Some tests rely on environement variables and don't behave well with multi-threading. They are marked with `#[serial]` from the [serial_test](https://docs.rs/serial_test/latest/serial_test/index.html) crate.


### TODO

- [ ] make it available on homebrew
- [ ] handle streams
- [ ] automagical context fetches (might be out of scope)
- [ ] add RAG capabilities (might be out of scope)
19 changes: 4 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# smartcat (sc)

Puts a brain behind `cat`! CLI interface to bring language models in the Unix ecosystem and allow terminal power users to make the most out of llms.
Puts a brain behind `cat`! CLI interface to bring language models in the Unix ecosystem and allow terminal power users to make the most out of llms while keeping full control.

<p align="center">
<img src="assets/workflow.gif" />
Expand Down Expand Up @@ -50,7 +50,7 @@ Answers might be slow depending on your setup, you may want to try the third par
- [Example workflows](#example-workflows)
- [Configuration](#configuration) ← please read this carefully
- [Ollama setup](#ollama-setup) ← easiest way to get running for free
- [Developping](#developping)
- [How to help?](./CONTRIBUTING.md)

## Installation

Expand Down Expand Up @@ -313,17 +313,6 @@ see [the config setup file](./src/config/mod.rs) for more details.

⚠️ Answers might be slow depending on your setup, you may want to try the third party APIs for an optimal workflow.

## Developping
## How to help?

Some tests rely on environement variables and don't behave well with multi-threading. They are marked with `#[serial]` from the [serial_test](https://docs.rs/serial_test/latest/serial_test/index.html) crate.

### State of the project

Smartcat has reached an acceptable feature set. The focus is now on upgrading the codebase quality as I hadn't really touched rust since 2019 and it shows.

#### TODO

- [ ] make it available on homebrew
- [ ] handle streams
- [ ] automagical context fetches (might be out of scope)
- [ ] add RAG capabilities
See [CONTRIBUTING.md](./CONTRIBUTING.MD)

0 comments on commit fc8eec0

Please sign in to comment.