Change REDAME.md with the new call semantics.

This commit is contained in:
Oleksandr Kozachuk 2023-08-12 12:44:13 +02:00
parent 4b2f634b79
commit 1fb9144192

View File

@ -29,65 +29,99 @@ pip install .
## Usage ## Usage
The `cmm` script has global options, a list of commands, and options per command:
```bash ```bash
cmm [-h] [-p PRINT | -q QUESTION | -D | -d | -l] [-c CONFIG] [-m MAX_TOKENS] [-T TEMPERATURE] [-M MODEL] [-n NUMBER] [-t [TAGS [TAGS ...]]] [-e [EXTAGS [EXTAGS ...]]] [-o [OTAGS [OTAGS ...]]] [-a] [-w] [-W] cmm [global options] command [command options]
``` ```
### Arguments ### Global Options
- `-p`, `--print`: YAML file to print.
- `-q`, `--question`: Question to ask.
- `-D`, `--chat-dump`: Print chat history as a Python structure.
- `-d`, `--chat`: Print chat history as readable text.
- `-a`, `--match-all-tags`: All given tags must match when selecting chat history entries.
- `-w`, `--with-tags`: Print chat history with tags.
- `-W`, `--with-tags`: Print chat history with filenames.
- `-l`, `--list-tags`: List all tags and their frequency.
- `-c`, `--config`: Config file name (defaults to `.config.yaml`). - `-c`, `--config`: Config file name (defaults to `.config.yaml`).
### Commands
- `ask`: Ask a question.
- `hist`: Print chat history.
- `tag`: Manage tags.
- `model`: Manage models.
- `print`: Print files.
### Command Options
#### `ask` Command Options
- `-q`, `--question`: Question to ask (required).
- `-m`, `--max-tokens`: Max tokens to use. - `-m`, `--max-tokens`: Max tokens to use.
- `-T`, `--temperature`: Temperature to use. - `-T`, `--temperature`: Temperature to use.
- `-M`, `--model`: Model to use. - `-M`, `--model`: Model to use.
- `-n`, `--number`: Number of answers to produce (default is 3). - `-n`, `--number`: Number of answers to produce (default is 3).
- `-s`, `--source`: Add content of a file to the query.
- `-S`, `--only-source-code`: Add pure source code to the chat history.
- `-t`, `--tags`: List of tag names. - `-t`, `--tags`: List of tag names.
- `-e`, `--extags`: List of tag names to exclude. - `-e`, `--extags`: List of tag names to exclude.
- `-o`, `--output-tags`: List of output tag names (default is the input tags). - `-o`, `--output-tags`: List of output tag names (default is the input tags).
- `-a`, `--match-all-tags`: All given tags must match when selecting chat history entries.
#### `hist` Command Options
- `-d`, `--dump`: Print chat history as Python structure.
- `-w`, `--with-tags`: Print chat history with tags.
- `-W`, `--with-files`: Print chat history with filenames.
- `-S`, `--only-source-code`: Print only source code.
- `-t`, `--tags`: List of tag names.
- `-e`, `--extags`: List of tag names to exclude.
- `-a`, `--match-all-tags`: All given tags must match when selecting chat history entries.
#### `tag` Command Options
- `-l`, `--list`: List all tags and their frequency.
#### `model` Command Options
- `-l`, `--list`: List all available models.
#### `print` Command Options
- `-f`, `--file`: File to print (required).
- `-S`, `--only-source-code`: Print only source code.
### Examples ### Examples
1. Print the contents of a YAML file: 1. Ask a question:
```bash ```bash
cmm -p example.yaml cmm ask -q "What is the meaning of life?" -t philosophy -e religion
``` ```
2. Ask a question: 2. Display the chat history:
```bash ```bash
cmm -q "What is the meaning of life?" -t philosophy -e religion cmm hist
``` ```
3. Display the chat history as a Python structure: 3. Filter chat history by tags:
```bash ```bash
cmm -D cmm hist -t tag1 tag2
``` ```
4. Display the chat history as readable text: 4. Exclude chat history by tags:
```bash ```bash
cmm -d cmm hist -e tag3 tag4
``` ```
5. Filter chat history by tags: 5. List all tags and their frequency:
```bash ```bash
cmm -d -t tag1 tag2 cmm tag -l
``` ```
6. Exclude chat history by tags: 6. Print the contents of a file:
```bash ```bash
cmm -d -e tag3 tag4 cmm print -f example.yaml
``` ```
## Configuration ## Configuration