diff --git a/README.md b/README.md new file mode 100644 index 0000000..610b48d --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# slm + +A simple command-line tool to interact with an LLM API. + +## Configuration + +The tool reads its configuration from `~/.config/slm/config.toml`. + +### Config File Format + +```toml +api_key = "your_api_key_here" +server_url = "https://your-api-server.com/v1/chat/completions" +model = "nvidia/Gemma-4-31B-IT-NVFP4" +``` + +| Field | Description | +| :--- | :--- | +| `api_key` | Your API authentication key. | +| `server_url` | The full URL to the chat completions endpoint. | +| `model` | The identifier of the model to use. | + +## Usage + +By default, `slm` reads from standard input and sends it to the configured model. + +### Basic Example + +```bash +echo "Hello, how are you?" | slm +``` + +### With a Prompt + +You can append a specific prompt to the input using the `-p` or `--prompt` argument. This is useful for giving the model a persona or specific instructions. + +```bash +echo "the capital of France" | slm -p "Answer in one word." +``` + +## Arguments + +| Argument | Short | Description | +| :--- | :--- | :--- | +| `--prompt ` | `-p` | Optional prompt to append to the content read from stdin. | diff --git a/src/main.rs b/src/main.rs index 9454ed9..3127ebe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ struct Args { struct Config { api_key: String, server_url: String, + model: String, } #[derive(Serialize)] @@ -70,7 +71,7 @@ async fn run() -> Result<(), Box> { // Construct the API request let request_body = ChatRequest { - model: "nvidia/Gemma-4-31B-IT-NVFP4".to_string(), // Default model + model: config.model.clone(), messages: vec![Message { role: "user".to_string(), content: final_content,