|
| 1 | +<p align="center"> |
| 2 | + <img height="100" src="https://cdn.trieve.ai/trieve-logo.png" alt="Trieve Logo"> |
| 3 | +</p> |
| 4 | +<p align="center"> |
| 5 | +<strong><a href="https://dashboard.trieve.ai">Sign Up (1k chunks free)</a> | <a href="https://docs.trieve.ai">Documentation</a> | <a href="https://discord.gg/eBJXXZDB8z">Discord</a> | <a href="https://matrix.to/#/#trieve-general:trieve.ai">Matrix</a> |
| 6 | +</strong> |
| 7 | +</p> |
| 8 | + |
| 9 | +<p align="center"> |
| 10 | + <a href="https://github.com/devflowinc/trieve/stargazers"> |
| 11 | + <img src="https://img.shields.io/github/stars/devflowinc/trieve.svg?style=flat&color=yellow" alt="Github stars"/> |
| 12 | + </a> |
| 13 | + <a href="https://discord.gg/CuJVfgZf54"> |
| 14 | + <img src="https://img.shields.io/discord/1130153053056684123.svg?label=Discord&logo=Discord&colorB=7289da&style=flat" alt="Join Discord"/> |
| 15 | + </a> |
| 16 | + <a href="https://matrix.to/#/#trieve-general:trieve.ai"> |
| 17 | + <img src="https://img.shields.io/badge/matrix-join-purple?style=flat&logo=matrix&logocolor=white" alt="Join Matrix"/> |
| 18 | + </a> |
| 19 | +</p> |
| 20 | + |
| 21 | +# Trieve CLI |
| 22 | + |
| 23 | +A command-line interface for interacting with the Trieve API. The CLI enables users to upload files, check upload status, ask questions against their knowledge base, and configure their Trieve setup. |
| 24 | + |
| 25 | +## Installation |
| 26 | + |
| 27 | +```bash |
| 28 | +npm install -g trieve-cli |
| 29 | +``` |
| 30 | + |
| 31 | +## Configuration |
| 32 | + |
| 33 | +Before using the CLI, you need to configure it with your Trieve credentials: |
| 34 | + |
| 35 | +```bash |
| 36 | +trieve configure |
| 37 | +``` |
| 38 | + |
| 39 | +This interactive command will prompt you for: |
| 40 | + |
| 41 | +- Your Trieve Organization ID |
| 42 | +- Your Trieve Dataset ID |
| 43 | +- Your Trieve API Key |
| 44 | +- User ID (for topic ownership) |
| 45 | + |
| 46 | +Alternatively, you can set these as environment variables: |
| 47 | + |
| 48 | +- `TRIEVE_ORGANIZATION_ID` |
| 49 | +- `TRIEVE_DATASET_ID` |
| 50 | +- `TRIEVE_API_KEY` |
| 51 | + |
| 52 | +## Commands |
| 53 | + |
| 54 | +### Upload Files |
| 55 | + |
| 56 | +Upload a file to your Trieve dataset: |
| 57 | + |
| 58 | +```bash |
| 59 | +trieve upload [filePath] [-t, --tracking-id <trackingId>] |
| 60 | +``` |
| 61 | + |
| 62 | +If no file path is provided, the CLI will prompt you to enter one interactively. |
| 63 | + |
| 64 | +### Check Upload Status |
| 65 | + |
| 66 | +Check the status of your uploaded files: |
| 67 | + |
| 68 | +```bash |
| 69 | +trieve check-upload-status [-t, --tracking-id <trackingId>] |
| 70 | +``` |
| 71 | + |
| 72 | +Without options, this will display an interactive menu to select files to check. If a tracking ID is provided, it will check the status of that specific file. |
| 73 | + |
| 74 | +### Ask Questions |
| 75 | + |
| 76 | +Ask a question against your Trieve dataset: |
| 77 | + |
| 78 | +```bash |
| 79 | +trieve ask [question] |
| 80 | +``` |
| 81 | + |
| 82 | +If no question is provided, the CLI will prompt you to enter one interactively. The response will be streamed back with reference information that you can expand by pressing 'j'. |
| 83 | + |
| 84 | +### Update Tool Configuration |
| 85 | + |
| 86 | +Customize the RAG system prompt and tool configurations: |
| 87 | + |
| 88 | +```bash |
| 89 | +trieve update-tool-config [-t, --tool-description <toolDescription>] [-q, --query-description <queryDescription>] [-s, --system-prompt <systemPrompt>] |
| 90 | +``` |
| 91 | + |
| 92 | +This allows you to customize: |
| 93 | + |
| 94 | +- Tool description: Instructions for when the LLM should use the search tool |
| 95 | +- Query description: How the LLM should formulate search queries |
| 96 | +- System prompt: Custom system prompt for the AI assistant |
| 97 | + |
| 98 | +## Features |
| 99 | + |
| 100 | +- **🔒 Secure Configuration**: Local storage of API keys and configuration |
| 101 | +- **📤 File Uploads**: Upload documents to your Trieve dataset |
| 102 | +- **📋 Status Tracking**: Monitor the processing status of uploaded files |
| 103 | +- **🤔 Interactive Q&A**: Ask questions and receive answers based on your uploaded documents |
| 104 | +- **📚 Reference Display**: View source references for answers with expandable details |
| 105 | +- **🔧 Customizable RAG**: Configure system prompts and tool behavior |
| 106 | + |
| 107 | +## Examples |
| 108 | + |
| 109 | +### Upload a PDF and ask questions about it: |
| 110 | + |
| 111 | +```bash |
| 112 | +# Upload a document |
| 113 | +trieve upload ./documents/report.pdf |
| 114 | + |
| 115 | +# Check if processing is complete |
| 116 | +trieve check-upload-status |
| 117 | + |
| 118 | +# Ask a question about the content |
| 119 | +trieve ask "What are the key findings in the report?" |
| 120 | +``` |
| 121 | + |
| 122 | +### Customize the RAG behavior: |
| 123 | + |
| 124 | +```bash |
| 125 | +# Update the tool configuration for more specific search behavior |
| 126 | +trieve update-tool-config --query-description "Create precise search queries focusing on technical terms and definitions" |
| 127 | +``` |
| 128 | + |
| 129 | +## Development |
| 130 | + |
| 131 | +To build the CLI from source: |
| 132 | + |
| 133 | +```bash |
| 134 | +# Install dependencies |
| 135 | +npm install |
| 136 | + |
| 137 | +# Build the TypeScript code |
| 138 | +npm run build |
| 139 | + |
| 140 | +# Run locally |
| 141 | +npm start |
| 142 | +``` |
| 143 | + |
| 144 | +## License |
| 145 | + |
| 146 | +MIT |
0 commit comments