{"id":29085188,"url":"https://github.com/open-technology-foundation/dejavu2-cli","last_synced_at":"2025-06-27T22:32:15.357Z","repository":{"id":270427151,"uuid":"910349058","full_name":"Open-Technology-Foundation/dejavu2-cli","owner":"Open-Technology-Foundation","description":"Terminal interface for interacting with various Large Language Models (LLMs) and YaTTI Knowledgebases..","archived":false,"fork":false,"pushed_at":"2025-06-22T10:06:07.000Z","size":464,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T11:19:18.711Z","etag":null,"topics":["ai","ai-agents","llm","terminal-based","yatti"],"latest_commit_sha":null,"homepage":"https://yatti.id/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Open-Technology-Foundation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"AUDIT-EVALUATE.md","citation":null,"codeowners":null,"security":"security.py","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-31T03:38:35.000Z","updated_at":"2025-06-22T10:06:09.000Z","dependencies_parsed_at":"2024-12-31T04:33:03.797Z","dependency_job_id":"c8759767-0715-4145-9846-2a2fc83c788d","html_url":"https://github.com/Open-Technology-Foundation/dejavu2-cli","commit_stats":null,"previous_names":["open-technology-foundation/dejavu2-cli"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Open-Technology-Foundation/dejavu2-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fdejavu2-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fdejavu2-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fdejavu2-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fdejavu2-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Open-Technology-Foundation","download_url":"https://codeload.github.com/Open-Technology-Foundation/dejavu2-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Open-Technology-Foundation%2Fdejavu2-cli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262343640,"owners_count":23296367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-agents","llm","terminal-based","yatti"],"created_at":"2025-06-27T22:30:57.104Z","updated_at":"2025-06-27T22:32:15.341Z","avatar_url":"https://github.com/Open-Technology-Foundation.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dejavu2-cli \n\nA powerful command-line interface for interacting with various Large Language Models (LLMs) including OpenAI, Anthropic Claude, Google Gemini, and local models via Ollama.\n\n## Overview\n\n`dejavu2-cli` (`dv2` for short) is a versatile command-line tool designed for executing one-shot queries to multiple language models, including those from OpenAI, Anthropic, Google, and local models via the Ollama server.\n\nThe `dv2` tool allows users to interact with LLMs efficiently by providing a range of customizable options, and supports context inclusion through reference files and `customKB` knowledge bases. The tool seamlessly handles different model APIs, response formats, and maintains conversation history for contextual interactions.\n\n## Features\n\n- **Multi-Model Support**: Seamlessly switch between different LLMs such as GPT-4, Claude variants, Gemini models, and LLaMA models by specifying the model name or using predefined aliases.\n- **Conversation History**: Maintain context across multiple interactions with saved conversation history, allowing for follow-up questions and continued discussions.\n- **Customizable Parameters**: Fine-tune responses by adjusting parameters like temperature, maximum tokens, and system prompts directly from the command line.\n- **Contextual Inputs**: Enhance queries by including content from reference text files or customKB knowledge bases, allowing for richer and more informed responses.\n- **Template Management**: Utilize user-defined templates in JSON format to initialize query parameters, ensuring consistency and saving time on repetitive tasks.\n- **Configuration Loading**: Automatically load default settings and user-specific configurations from YAML files, with the ability to override them via command-line options.\n- **Listing and Editing Tools**: List available models, templates, customKB knowledge bases, and conversations. Edit configuration and template files directly from the command line.\n- **Status Display**: Preview the current state of all arguments, options, and conversation context before executing a query.\n- **Model-Specific Parameter Handling**: Automatically adjusts parameters for different model types (like OpenAI's O1/O3 models) to ensure compatibility.\n- **Robust API Integration**: Handles various API response formats, particularly for Ollama chat endpoints, with graceful fallback mechanisms for different JSON structures.\n- **Metadata Tracking**: Captures and logs useful metadata from model responses for performance monitoring and debugging.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Command-Line Options](#command-line-options)\n- [Configuration](#configuration)\n- [Templates](#templates)\n- [Examples](#examples)\n- [Development](#development)\n- [Contributing](#contributing)\n- [License](#license)\n- [Authors](#authors)\n\n## Installation\n\n### Prerequisites\n\n- **Python 3.7** or higher (Python 3.8+ recommended for best compatibility)\n- **pip** package manager\n- **Git** (for cloning the repository)\n- One or more LLM provider API keys (see Environment Variables section below)\n\n### Steps\n\n1. **Clone the Repository**:\n\n   ```bash\n   git clone https://github.com/Open-Technology-Foundation/dejavu2-cli.git\n   cd dejavu2-cli\n   ```\n\n2. **Install Dependencies**:\n\n   Strongly recommended to set up a virtual environment first.\n   \n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. **Set Up Environment Variables**:\n\n   Create environment variables for your API keys:\n\n   ```bash\n   # Required for Anthropic models (claude-*)\n   export ANTHROPIC_API_KEY=\"your_anthropic_api_key\"\n   \n   # Required for OpenAI models (gpt-*, o1-*, o3-*, etc.)\n   export OPENAI_API_KEY=\"your_openai_api_key\"\n   \n   # Required for Google/Gemini models (gemini-*)\n   export GOOGLE_API_KEY=\"your_google_api_key\"\n   \n   # No key needed for local Ollama models (llama-*)\n   # Ensure Ollama server is running locally\n   ```\n\n   You can add these to your shell profile (`.bashrc`, `.zshrc`, etc.) for persistence.\n   \n   **Important**: Never store API keys in code or configuration files for security reasons.\n   \n   ### Special Note on Model Handling\n\n   Models in different categories may have specific requirements or behaviors:\n\n   - **OpenAI Models** (gpt-3.5-turbo, gpt-4, etc.): Standard approach with system and user prompts.\n   - **OpenAI O1/O3 Models**: Use a different messaging format and require special parameter handling (`max_completion_tokens` instead of `max_tokens`; no temperature parameter).\n   - **Claude Models**: Similar to OpenAI but with some differences in prompt handling.\n   - **Google/Gemini Models**: Requires Google API key and uses a different client library.\n   - **Local Models via Ollama**: Requires the Ollama server to be running locally on port 11434.\n   - **Remote Ollama Models**: Can connect to remote Ollama instances with special handling for models with colons in their names (like \"gemma3:4b\").\n\n#### Ollama API Integration\n\nThe tool includes robust handling for Ollama API responses, particularly for the chat endpoint:\n\n- Supports both local (http://localhost:11434/api/chat) and remote (https://ai.okusi.id/api/chat) Ollama servers\n- Handles streaming and non-streaming JSON responses with appropriate parsing\n- Processes various response formats from the chat endpoint:\n  ```json\n  {\n    \"model\": \"llama3.2\",\n    \"message\": {\n      \"role\": \"assistant\",\n      \"content\": \"Response text...\"\n    },\n    \"done\": true\n  }\n  ```\n- Extracts and logs metadata from completed responses:\n  - `total_duration`: Total processing time in milliseconds\n  - `load_duration`: Time taken to load the model\n  - `prompt_eval_count`: Number of tokens in the prompt\n  - `eval_count`: Number of tokens generated\n- Provides graceful error handling for various Ollama API error responses\n\n4. **Ensure Ollama Server is Running** (Optional):\n\n   - If you plan to use local LLaMA-based models, make sure the [Ollama](https://ollama.ai) server is installed and running.\n\n5. **Run the Script**:\n\n   ```bash\n   dejavu2-cli \"Your query here\"\n   # Or use the shorthand\n   dv2 \"Your query here\"\n   ```\n\n## Usage\n\nRun `dv2` with your query and desired options:\n\n```bash\ndv2 \"Your query here\" [options]\n```\n\nTo view all available options:\n\n```bash\ndv2 --help\n```\n\n## Command-Line Options\n\n### Main Options\n\n- `-V, --version`  \n  Show version information and exit.\n\n- `-T, --template TEXT`  \n  Use a template to initialize arguments (defined in `Agents.json`).\n\n- `-m, --model TEXT`  \n  Specify the LLM model to use (e.g., \"gpt-4o\", \"claude-3-7-sonnet-latest\", \"llama3.1\"). Aliases like \"sonnet\" or \"gpt4o\" can also be used.\n\n- `-s, --systemprompt TEXT`  \n  Set the system prompt for the AI assistant (e.g., \"You are a helpful assistant.\").\n\n- `-t, --temperature FLOAT`  \n  Set the sampling temperature for the LLM (e.g., `0.7`); higher values make output more random.\n\n- `-M, --max-tokens INTEGER`  \n  Define the maximum number of tokens for the LLM to generate.\n\n### Conversation Options\n\n- `-c, --continue`  \n  Continue the most recent conversation, maintaining context from previous exchanges.\n\n- `-C, --conversation TEXT`  \n  Load a specific conversation by ID to continue an earlier interaction.\n\n- `-x, --list-conversations`  \n  List all saved conversations with their IDs, titles, and other metadata.\n\n- `-X, --delete-conversation TEXT`  \n  Delete a specific conversation by ID.\n\n- `-n, --new-conversation`  \n  Start a new conversation even when continuing would be possible.\n  \n- `-i, --title TEXT`  \n  Set a title for a new conversation (otherwise one will be auto-generated).\n  \n- `-e, --export-conversation TEXT`  \n  Export a conversation to markdown format. Use \"current\" for the active conversation or specify a conversation ID.\n\n- `-f, --export-path TEXT`  \n  Specify the path to save the exported markdown file (defaults to current directory).\n  \n- `-O, --stdout`  \n  Output the exported conversation directly to stdout instead of saving to a file.\n  \n- `-W, --list-messages CONVERSATION_ID`  \n  List all messages in a conversation with their indices and content previews, useful for identifying specific messages to remove.\n\n- `--remove-message ('CONVERSATION_ID', 'MESSAGE_INDEX')`  \n  Remove a single message from a conversation. Use `--list-messages` first to find the correct indices.\n\n- `--remove-pair ('CONVERSATION_ID', 'USER_MESSAGE_INDEX')`  \n  Remove a user-assistant message pair. The index must point to a user message that is followed by an assistant message.\n\n### Context Options\n\n- `-r, --reference TEXT`  \n  Include content from reference text files as context (comma-separated list of file paths).\n\n- `-k, --knowledgebase TEXT`  \n  Specify a customKB knowledge base to query for additional context.\n\n- `-Q, --knowledgebase-query TEXT`  \n  Define a query to send to the customKB knowledge base (defaults to the main query if not provided).\n\n### Status and Information\n\n- `-S, --status`  \n  Display the current state of all arguments and options.\n\n- `-P, --print-systemprompt`  \n  Print the full system prompt when using `--status`.\n\n### Listing Options\n\n- `-a, --list-models`  \n  List all available LLM models as defined in the `Models.json` file.\n\n- `-A, --list-models-details`  \n  List all available models with detailed information.\n\n- `-l, --list-template TEXT`  \n  List details of all templates or a specific template.\n\n- `-L, --list-template-names`  \n  List the names of all available templates.\n\n- `-K, --list-knowledge-bases`  \n  List all available customKB knowledge bases.\n\n### Editing Options\n\n- `-E, --edit-templates`  \n  Edit the `Agents.json` file using the default editor or 'p'.\n\n- `-D, --edit-defaults`  \n  Edit the `defaults.yaml` configuration file.\n  \n- `-d, --edit-models`  \n  Edit the `Models.json` file.\n\n### Output Options\n\n- `-p, --project-name TEXT`  \n  The project name for recording conversations.\n\n- `-o, --output-dir TEXT`  \n  Directory to output conversation results to.\n\n- `-g, --message \u003cTEXT TEXT\u003e...`  \n  Add message pairs in the form: `-g role \"message\"` (e.g., `-g user \"hello\" -g assistant \"hi\"`).\n\n## Configuration\n\n### Configuration Files\n\nThe system uses three main configuration files:\n\n1. **defaults.yaml**: Default settings and paths\n2. **Models.json**: Model definitions and aliases\n3. **Agents.json**: Template definitions\n\n### Conversation Storage\n\nConversations are stored as JSON files in:\n\n```\n~/.config/dejavu2-cli/conversations/\n```\n\nEach JSON file contains:\n- Conversation metadata (id, title, created/updated timestamps)\n- Model configuration (model, temperature, max_tokens)\n- Complete message history (including system prompts)\n\nThis allows for persistent context across sessions and detailed conversation tracking.\n\n### defaults.yaml\n\nContains default settings, paths, and logging configurations.\n\n```yaml\n# defaults.yaml\n\n# Command line defaults\ndefaults:\n  template: Dejavu2 # This template, when specified, will override the values below\n  systemprompt: You are a friendly and helpful AI Assistant.\n  reference: \"\"\n  model: sonnet\n  temperature: 0.1\n  max_tokens: 4000\n  completions: 1\n  knowledgebase: \"\"\n\n# Paths\npaths:\n  prgdir: \"\"  # Will be set programmatically at runtime\n  template_path: Agents.json\n  customkb: /ai/scripts/customkb/customkb\n\n# Logging\nlogging:\n  level: DEBUG\n  format: \"%(levelname)s: %(message)s\"\n\n# Vector database path\nvectordbs_path: /var/lib/vectordbs\n```\n\n### Models.json\n\nDefines available models and their aliases. Each model entry contains:\n\n```json\n\"claude-3-7-sonnet-latest\": {\n  \"model\": \"claude-3-7-sonnet-latest\",\n  \"alias\": \"sonnet\",\n  \"parent\": \"Anthropic\",\n  \"model_category\": \"LLM\",\n  \"family\": \"claude3\",\n  \"series\": \"claude3\",\n  \"description\": \"Highest level of intelligence and capability with toggleable extended thinking\",\n  \"training_data\": \"2024-10\",\n  \"data_cutoff_date\": \"2024-10\",\n  \"url\": \"https://api.anthropic.com/v1\",\n  \"apikey\": \"ANTHROPIC_API_KEY\",\n  \"context_window\": 200000,\n  \"max_output_tokens\": 128000,\n  \"token_costs\": \"$3.00/$15.00\",\n  \"vision\": 1,\n  \"available\": 9,\n  \"enabled\": 1\n}\n```\n\nThe `alias` field allows you to use shorthand names like \"sonnet\" instead of the full model name.\n\n### Agents.json\n\nDefines templates for initializing query parameters.\n\n```json\n{\n  \"DéjàVu2 - Helpful AI\": {\n    \"category\": \"General\",\n    \"knowledgebase\": \"\",\n    \"max_tokens\": 4000,\n    \"model\": \"claude-3-5-sonnet-latest\", \n    \"monospace\": false,\n    \"systemprompt\": \"Your name is DéjàVu2. You are a friendly and helpful general AI assistant.\",\n    \"temperature\": 0.35\n  }\n}\n\n```\n\n## Templates\n\nTemplates allow you to predefine sets of parameters for common tasks. This is especially useful if you frequently use the same settings.\n\n### Example Template Definition\n\n```json\n{\n  \"Summariser - Summary Machine\": {\n    \"category\": \"Edit-Summarize\",\n    \"knowledgebase\": \"\",\n    \"max_tokens\": 8000,\n    \"model\": \"claude-3-5-sonnet-latest\",\n    \"monospace\": false,\n    \"systemprompt\": \"You are a summarization machine. Summarize the key points of the user's text in a concise and insightful manner.\",\n    \"temperature\": 0.3\n  }\n}\n```\n\n### Using a Template\n\n```bash\ndv2 \"Explain quantum computing in simple terms.\" -T \"DéjàVu2 - Helpful AI\"\n```\n\n## Examples\n\n### Basic Query\n\n```bash\ndv2 \"What is the capital of France?\"\n```\n\n### Using a Template\n\n```bash\ndv2 \"Provide a summary of the latest news.\" -T \"Summariser - Summary Machine\"\n```\n\n### Specifying a Model and Adjusting Temperature\n\n```bash\ndv2 \"Generate a creative story about a flying car.\" -m gpt4o -t 0.9\n```\n\n### Including Reference Files\n\n```bash\ndv2 \"Analyze the following code.\" -r \"script.py,helpers.py\"\n```\n\n### Using Conversation History\n\nConversations keep track of your interactions with the model, including system prompts, queries, responses, and configuration details. Each conversation automatically stores metadata about the model, temperature, and other settings.\n\n#### Starting Conversations\n\nStart a new conversation:\n```bash\ndv2 \"Tell me about quantum computing.\"\n```\n\nStart a new conversation with a specific title:\n```bash\ndv2 \"Let's discuss space exploration.\" --title \"Space Exploration Discussion\"\n```\n\n#### Managing Conversations\n\nList all saved conversations to see their IDs, titles, and message counts:\n```bash\ndv2 --list-conversations\n```\n\nExample output:\n```\n=== SAVED CONVERSATIONS ===\nID: 550e8400-e29b-41d4-a716-446655440000\nTitle: Quantum Computing Discussion\nMessages: 4\nCreated: 2025-03-01 15:04\nUpdated: 2025-03-01 15:14\n---\nID: 663a4911-c38b-42e5-9f23-889735512111\nTitle: Space Exploration Discussion\nMessages: 2\nCreated: 2025-02-28 10:23\nUpdated: 2025-02-28 10:25\n```\n\nExamining a conversation with `--status` shows detailed information including metadata:\n```\n=== CONVERSATION ===\nID: 550e8400-e29b-41d4-a716-446655440000\nTitle: Quantum Computing Discussion\nMessages: 4\nCreated: 2025-03-01 15:04\nLast Updated: 2025-03-01 15:14\n\nMetadata:\n  model: claude-3-7-sonnet-latest\n  temperature: 0.7\n  max_tokens: 4000\n  template: Dejavu2 - Helpful AI\n\nPreview of last exchanges:\n  User: Tell me about quantum computing\n  Assistant: Quantum computing is a type of computing that...\n  User: How does quantum entanglement work?\n```\n\nView or access a specific conversation by ID:\n```bash\ndv2 --conversation 550e8400-e29b-41d4-a716-446655440000 --status\n```\n\nDelete a conversation when you no longer need it:\n```bash\ndv2 --delete-conversation 550e8400-e29b-41d4-a716-446655440000\n```\n\nView all messages in a conversation with their indices and content previews:\n```bash\ndv2 --list-messages 550e8400-e29b-41d4-a716-446655440000\n```\n\nExample output:\n```\n=== MESSAGES IN CONVERSATION ===\nID: 550e8400-e29b-41d4-a716-446655440000\nTitle: Quantum Computing Discussion\n\nIndex: 0 | Role: system | 2025-03-01 15:04:00\nContent: You are Dejavu2, a friendly and helpful general AI assistant...\n\nIndex: 1 | Role: user | 2025-03-01 15:04:10\nContent: Tell me about quantum computing\n\nIndex: 2 | Role: assistant | 2025-03-01 15:04:15\nContent: Quantum computing is a type of computing that...\n\nIndex: 3 | Role: user | 2025-03-01 15:14:22\nContent: How does quantum entanglement work?\n\nIndex: 4 | Role: assistant | 2025-03-01 15:14:30\nContent: Quantum entanglement is a phenomenon where two particles...\n```\n\nRemove a specific message from a conversation:\n```bash\ndv2 --remove-message 550e8400-e29b-41d4-a716-446655440000 3\n```\n\nRemove a user-assistant message pair (must specify the user message index):\n```bash\ndv2 --remove-pair 550e8400-e29b-41d4-a716-446655440000 1\n```\n\n#### Continuing Conversations\n\nContinue the most recent conversation:\n```bash\ndv2 \"How does quantum entanglement work?\" -c\n```\n\nContinue a specific conversation by ID:\n```bash\ndv2 \"I have more questions about this topic.\" --conversation 550e8400-e29b-41d4-a716-446655440000\n```\n\nStart a new conversation even if you have a recent one:\n```bash\ndv2 \"Let's talk about something different.\" --new-conversation\n```\n\n#### Changing Parameters Mid-Conversation\n\nYou can change models or parameters while continuing a conversation:\n```bash\n# Continue with a different model\ndv2 \"Can you explain this more creatively?\" -c -m \"gpt4o\" -t 0.7\n```\n\nThe conversation metadata will automatically update to track these changes.\n\n#### Exporting Conversations\n\nExport a conversation to markdown format for sharing or archiving:\n```bash\n# Export the most recent conversation to a file\ndv2 -e current\n\n# Export a specific conversation by ID\ndv2 -e 550e8400-e29b-41d4-a716-446655440000\n\n# Export to a specific path/filename\ndv2 -e current -f \"~/Documents/quantum_discussion.md\"\n\n# Output directly to stdout (for piping or viewing)\ndv2 -e current -O\n\n# Output to stdout and pipe to less for paging\ndv2 -e current -O | less\n\n# Output to stdout and pipe to grep to search for specific content\ndv2 -e current -O | grep \"quantum\"\n```\n\nThe markdown export includes:\n- Conversation metadata (title, ID, creation date)\n- Model configuration (model, temperature, etc.)\n- Complete message history with timestamps\n- System prompts in collapsible sections\n- Clear separation between message pairs with horizontal rules\n- Proper formatting of role headers and timestamps\n\nThis improved formatting makes it easy to share conversations with others or store them in a more readable and visually organized format.\n\n### Querying with a Knowledge Base\n\n```bash\ndv2 \"Explain the company's financial position.\" -k \"financial_reports\"\n```\n\n### Displaying Full Status Information\n\n```bash\ndv2 \"Your query here\" --status -P\n```\n\n### Listing All Available Information\n\n```bash\n# List models with basic information\ndv2 --list-models\n\n# List models with detailed information\ndv2 -A\n\n# List all templates\ndv2 -l all\n\n# List template names only (concise)\ndv2 -L\n\n# List available knowledge bases\ndv2 -K\n```\n\n### Editing Configuration Files\n\n```bash\n# Edit templates file\ndv2 -E\n\n# Edit defaults configuration\ndv2 -D\n\n# Edit models configuration\ndv2 -d\n```\n\n### Using Different Model Types\n\n```bash\n# Using OpenAI GPT-4o model\ndv2 \"Explain quantum physics\" -m gpt4o\n\n# Using Anthropic Claude model\ndv2 \"Write a poem about nature\" -m sonnet\n\n# Using OpenAI o1-preview model\ndv2 \"Analyze this data\" -m o1-preview\n\n# Using local Ollama model (with Ollama server running)\ndv2 \"Translate to French\" -m llama3\n```\n\n## Development\n\n### Code Structure\n\nThe codebase has been modularized for better maintainability:\n\n- **main.py**: Main CLI interface that connects all modules\n- **utils.py**: General utility functions for string processing and date/time handling\n- **config.py**: Configuration loading and file editing\n- **templates.py**: Template management and display\n- **models.py**: Model information handling and selection\n- **context.py**: Reference files and knowledge base handling\n- **llm_clients.py**: API client initialization and query functions for different LLM providers\n- **display.py**: Status information display\n- **conversations.py**: Conversation history storage and management\n\nThis modular approach makes the code easier to maintain, test, and extend with new features.\n\n### Notable Components\n\n#### LLM Clients Module\n\nThe `llm_clients.py` module is responsible for handling all interactions with LLM APIs:\n\n- **OpenAI Client**: Handles both standard and O1/O3 models with their specific requirements\n- **Anthropic Client**: Manages Claude model interactions with appropriate headers\n- **Google Client**: Interfaces with Gemini models through the Google API\n- **Ollama Client**: Supports both local and remote Ollama instances with robust response parsing\n\nThe Ollama client was recently updated to:\n- Handle various response formats from the chat endpoint\n- Support models with special naming patterns (like \"gemma3:4b\")\n- Extract and log useful metadata from responses\n- Provide meaningful error messages for different failure modes\n- Handle both streaming and non-streaming responses\n\n#### Conversations Module\n\nThe `conversations.py` module provides a sophisticated conversation management system:\n\n- **Message Storage**: Stores conversations as JSON files with message history\n- **State Management**: Tracks metadata like model, temperature, and creation time\n- **Export Capabilities**: Convert conversations to markdown format for sharing\n- **Context Maintenance**: Preserve context across multiple interactions\n\n### Coding Standards\n\nAll Python code in this project follows these standards:\n- **Indentation**: ALWAYS use 2-space indentation (never tabs or 4 spaces)\n- **Line Length**: Maximum 100 characters per line\n- **Naming**: snake_case for variables/functions, PascalCase for classes\n- **Documentation**: Docstrings for all public functions, modules, and classes\n- **Error Handling**: Consistent approach with meaningful error messages\n- **Logging**: Structured logging with appropriate levels\n\n### Testing\n\nRun tests using the provided script:\n\n```bash\n./run_tests.sh\n```\n\nThis will run unit, integration, and functional tests using pytest.\n\nThe test suite includes:\n- **Unit Tests**: Testing individual functions and classes\n- **Integration Tests**: Testing interactions between components\n- **Functional Tests**: Testing end-to-end functionality\n\n## License\n\nThis project is licensed under the GPL-3 License - see the [LICENSE](LICENSE) file for details.\n\n## Authors and Contributors\n\n- **Gary Dean** - Lead Developer\n- **Claude Code** - Documentation and Code Enhancement\n- **AI Community Contributors** - Feature requests, bug reports, and improvements\n\n### Contributing\n\nWe welcome contributions! Please see the [CLAUDE.md](CLAUDE.md) file for development guidelines and coding standards.\n\n### Support\n\nIf you encounter issues or have feature requests:\n- Check existing issues on GitHub\n- Create a new issue with detailed information\n- Follow the project for updates\n\n## Project Status\n\n**Current Version**: 0.8.22 (Active Development)\n\nThis project is in active development with regular updates and improvements. Check the [GitHub repository](https://github.com/Open-Technology-Foundation/dejavu2-cli) for the latest releases and features.\n\n### Recent Updates\n- Enhanced conversation management system\n- Improved error handling and security validation\n- Extended LLM provider support\n- Better Ollama integration for local models\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-technology-foundation%2Fdejavu2-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopen-technology-foundation%2Fdejavu2-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopen-technology-foundation%2Fdejavu2-cli/lists"}