-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
73 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters