Skip to content

Commit edcb55a

Browse files
committed
Updated
1 parent 8b8f93d commit edcb55a

File tree

8 files changed

+48
-11
lines changed

8 files changed

+48
-11
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ docker run \
2626
chat claude-3-5-haiku-20241022
2727
```
2828

29+
See below for more information on how to use the command-line tool.
30+
2931
## Programmatic Usage
3032

3133
See the documentation [here](https://pkg.go.dev/github.com/mutablelogic/go-llm)
@@ -183,6 +185,40 @@ The options are as follows:
183185
| `antropic.WithCitations()` | No | Yes | No | - | Attachments should be used in citations |
184186
| `antropic.WithUser(string)` | No | Yes | No | - | Indicate the user name for the request, for debugging |
185187

188+
## The Command Line Tool
189+
190+
You can use the command-line tool to interact with the API. To build the tool, you can use the following command:
191+
192+
```bash
193+
go install github.com/mutablelogic/go-llm/cmd/llm@latest
194+
llm --help
195+
```
196+
197+
The output is something like:
198+
199+
```text
200+
Usage: llm <command> [flags]
201+
202+
LLM agent command line interface
203+
204+
Flags:
205+
-h, --help Show context-sensitive help.
206+
--debug Enable debug output
207+
--verbose Enable verbose output
208+
--ollama-endpoint=STRING Ollama endpoint ($OLLAMA_URL)
209+
--anthropic-key=STRING Anthropic API Key ($ANTHROPIC_API_KEY)
210+
--news-key=STRING News API Key ($NEWSAPI_KEY)
211+
212+
Commands:
213+
agents Return a list of agents
214+
models Return a list of models
215+
tools Return a list of tools
216+
download Download a model
217+
chat Start a chat session
218+
219+
Run "llm <command> --help" for more information on a command.
220+
```
221+
186222
## Contributing & Distribution
187223

188224
*This module is currently in development and subject to change*. Please do file
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

context.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ type Completion interface {
1515
// If this is a completion, the role is usually 'assistant'
1616
Role() string
1717

18-
// Return the text for the last completion. If multiple completions are not
18+
// Return the text for the last completion, with the argument as the
19+
// completion index (usually 0). If multiple completions are not
1920
// supported, the argument is ignored.
2021
Text(int) string
2122

2223
// Return the current session tool calls given the completion index.
23-
// Will return nil if no tool calls were returned
24+
// Will return nil if no tool calls were returned.
2425
ToolCalls(int) []ToolCall
2526
}
2627

etc/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ RUN apt update -y && apt install -y ca-certificates
2525
LABEL org.opencontainers.image.source=https://${SOURCE}
2626

2727
# Entrypoint when running the server
28-
ENTRYPOINT [ "/usr/local/bin/agent" ]
28+
ENTRYPOINT [ "/usr/local/bin/llm" ]

opt.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ type Opt func(*Opts) error
1313

1414
// set of options
1515
type Opts struct {
16-
agents map[string]Agent // Set of agents
17-
toolkit ToolKit // Toolkit for tools
18-
callback func(ContextContent) // Streaming callback
19-
attachments []*Attachment // Attachments
20-
system string // System prompt
21-
options map[string]any // Additional options
16+
agents map[string]Agent // Set of agents
17+
toolkit ToolKit // Toolkit for tools
18+
callback func(Completion) // Streaming callback
19+
attachments []*Attachment // Attachments
20+
system string // System prompt
21+
options map[string]any // Additional options
2222
}
2323

2424
////////////////////////////////////////////////////////////////////////////////
@@ -46,7 +46,7 @@ func (o *Opts) ToolKit() ToolKit {
4646
}
4747

4848
// Return the stream function
49-
func (o *Opts) StreamFn() func(ContextContent) {
49+
func (o *Opts) StreamFn() func(Completion) {
5050
return o.callback
5151
}
5252

@@ -150,7 +150,7 @@ func WithToolKit(toolkit ToolKit) Opt {
150150
}
151151

152152
// Set chat streaming function
153-
func WithStream(fn func(ContextContent)) Opt {
153+
func WithStream(fn func(Completion)) Opt {
154154
return func(o *Opts) error {
155155
o.callback = fn
156156
return nil

0 commit comments

Comments
 (0)