- 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.
1.9 KiB
1.9 KiB
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
camelCasefor internal/private variables and functions. - Use
PascalCasefor exported types, functions, and struct fields. - Interface names should be concise (e.g.,
LLM,ChatCompletion).
- Use
- Error Handling:
- Always check and handle errors immediately.
- Wrap errors with context using
fmt.Errorf("%w: ...", err). - Use the project's internal
Errorstruct inerror.gowhen 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, andgoogle.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(orllm.exeon 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 messageCtrl+I- Add imageCtrl+T- Toggle tools panelCtrl+P- Change providerCtrl+M- Change modelCtrl+S- SettingsCtrl+N- New conversationEsc- Exit/Cancel