UNPKG

contaigents

Version:

Modular AI Content Ecosystem with Audio Generation

137 lines (104 loc) 3.43 kB
# Chat Command The Contaigents CLI now includes a `chat` command that provides a conversational AI interface for interactive assistance. ## Usage ```bash contaigents chat [options] ``` ## Options - `-p, --provider <provider>` - AI provider to use (openai, anthropic, google, etc.) - `-m, --model <model>` - Model to use for generation - `-t, --temperature <temperature>` - Temperature for response generation (0.0-1.0) - `--max-tokens <maxTokens>` - Maximum tokens for response - `--system-prompt <systemPrompt>` - Custom system prompt for the chat session - `--non-interactive` - Run in non-interactive mode (for testing) ## Examples ### Start an interactive chat session: ```bash contaigents chat --provider openai ``` ### Use a specific model and temperature: ```bash contaigents chat --provider openai --model gpt-4 --temperature 0.8 ``` ### Use a custom system prompt: ```bash contaigents chat --provider openai --system-prompt "You are a coding assistant specialized in JavaScript" ``` ### Non-interactive mode (for testing): ```bash contaigents chat --provider openai --non-interactive ``` ## Interactive Commands Once in the chat session: - Type your messages and press Enter to send - Type `exit` or `quit` to end the session - Press `Ctrl+C` to force quit ## HTTP API Endpoints The chat functionality is also available via HTTP API: ### Quick Chat (Single Message) ```bash POST /api/chat/quick Content-Type: application/json { "message": "Hello, what can you help me with?", "options": { "provider": "openai", "temperature": 0.7 } } ``` ### Session-Based Chat #### Create Session ```bash POST /api/chat/session Content-Type: application/json { "systemPrompt": "You are a helpful assistant", "provider": "openai" } ``` #### Send Message to Session ```bash POST /api/chat/message Content-Type: application/json { "sessionId": "chat_123456789_abcdef", "message": "What is 2+2?", "options": { "provider": "openai" } } ``` #### Get Session Messages ```bash GET /api/chat/session/{sessionId}/messages ``` #### List All Sessions ```bash GET /api/chat/sessions ``` #### Delete Session ```bash DELETE /api/chat/session/{sessionId} ``` ## Supported Providers The chat command works with any configured LLM provider: - **OpenAI** - GPT models (gpt-4, gpt-3.5-turbo, etc.) - **Anthropic** - Claude models - **Google** - Gemini models - **And more** - Any provider configured in your system ## Configuration Make sure you have at least one LLM provider configured before using the chat command. You can configure providers through the web interface or by manually editing the configuration files in `.config/llm_config/`. ## Features - **Conversation Memory** - Maintains context across messages in a session - **Multiple Providers** - Works with any configured LLM provider - **Flexible Configuration** - Customizable temperature, tokens, and system prompts - **Session Management** - Create, manage, and delete chat sessions - **Error Handling** - Graceful error handling and user feedback - **Interactive Interface** - User-friendly command-line chat experience ## Future Enhancements This basic conversational agent is designed to scale into a context-aware agent that can: - Create and modify markdown, MDX, and text files - Understand project context and structure - Perform file operations and content management - Integrate with the broader Contaigents ecosystem