- Add Bubble Tea-based CLI interface for LLM interactions. - Implement `.env.example` for environment variable setup. - Add provider, model, and tool selection screens. - Include support for API key configuration. - Enable chat interactions with optional image and tool support. - Introduce core utility functions: image handling, tool execution, chat request management, and response rendering. - Implement style customization with Lip Gloss.
48 lines
1.9 KiB
Markdown
48 lines
1.9 KiB
Markdown
# CLAUDE.md for go-llm
|
|
|
|
## Build and Test Commands
|
|
- Build project: `go build ./...`
|
|
- Run all tests: `go test ./...`
|
|
- Run specific test: `go test -v -run <TestName> ./...`
|
|
- Tidy dependencies: `go mod tidy`
|
|
|
|
## Code Style Guidelines
|
|
- **Indentation**: Use standard Go tabs for indentation.
|
|
- **Naming**:
|
|
- Use `camelCase` for internal/private variables and functions.
|
|
- Use `PascalCase` for exported types, functions, and struct fields.
|
|
- Interface names should be concise (e.g., `LLM`, `ChatCompletion`).
|
|
- **Error Handling**:
|
|
- Always check and handle errors immediately.
|
|
- Wrap errors with context using `fmt.Errorf("%w: ...", err)`.
|
|
- Use the project's internal `Error` struct in `error.go` when differentiating between error types is needed.
|
|
- **Project Structure**:
|
|
- `llm.go`: Contains core interfaces (`LLM`, `ChatCompletion`) and shared types (`Message`, `Role`, `Image`).
|
|
- Provider implementations are in `openai.go`, `anthropic.go`, and `google.go`.
|
|
- Schema definitions for tool calling are in the `schema/` directory.
|
|
- **Imports**: Organize imports into groups: standard library, then third-party libraries.
|
|
- **Documentation**: Use standard Go doc comments for exported symbols.
|
|
- **README.md**: The README.md file should always be kept up to date with any significant changes to the project.
|
|
|
|
## CLI Tool
|
|
- Build CLI: `go build ./cmd/llm`
|
|
- Run CLI: `./llm` (or `llm.exe` on Windows)
|
|
- Run without building: `go run ./cmd/llm`
|
|
|
|
### CLI Features
|
|
- Interactive TUI for testing all go-llm features
|
|
- Support for OpenAI, Anthropic, and Google providers
|
|
- Image input (file path, URL, or base64)
|
|
- Tool/function calling with demo tools
|
|
- Temperature control and settings
|
|
|
|
### Key Bindings
|
|
- `Enter` - Send message
|
|
- `Ctrl+I` - Add image
|
|
- `Ctrl+T` - Toggle tools panel
|
|
- `Ctrl+P` - Change provider
|
|
- `Ctrl+M` - Change model
|
|
- `Ctrl+S` - Settings
|
|
- `Ctrl+N` - New conversation
|
|
- `Esc` - Exit/Cancel
|