You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can append options to the agent creation to set the client/server communication options,
99
+
such as user agent strings, timeouts, debugging, rate limiting, adding custom headers, etc. See [here](https://pkg.go.dev/github.com/mutablelogic/go-client#readme-basic-usage) for more information.
100
+
101
+
There is also an _aggregated_ agent which can be used to interact with multiple providers at once. This is useful if you want
102
+
to use models from different providers simultaneously.
103
+
104
+
```go
105
+
import (
106
+
"github.com/mutablelogic/go-llm/pkg/agent"
107
+
)
108
+
109
+
funcmain() {
110
+
// Create a new agent which aggregates multiple providers
|`llm.WithTemperature(float64)`| Yes | Yes | Yes | - | What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.7 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. |
197
+
|`llm.WithTopP(float64)`| Yes | Yes | Yes | - | Nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. |
198
+
|`llm.WithTopK(uint64)`| Yes | Yes | No | - | Reduces the probability of generating nonsense. A higher value (e.g. 100) will give more diverse answers, while a lower value (e.g. 10) will be more conservative. |
199
+
|`llm.WithMaxTokens(uint64)`| No | Yes | Yes | - | The maximum number of tokens to generate in the response. |
200
+
|`llm.WithStream(func(llm.Completion))`| Can be enabled when tools are not used | Yes | Yes | - | Stream the response to a function. |
201
+
|`llm.WithToolChoice(string, string, ...)`| No | Yes | Use `auto`, `any`, `none`, `required` or a function name. Only the first argument is used. | - | The tool to use for the model. |
202
+
|`llm.WithToolKit(llm.ToolKit)`| Cannot be combined with streaming | Yes | Yes | - | The set of tools to use. |
203
+
|`llm.WithStopSequence(string, string, ...)`| Yes | Yes | Yes | - | Stop generation if one of these tokens is detected. |
204
+
|`llm.WithSystemPrompt(string)`| No | Yes | Yes | - | Set the system prompt for the model. |
205
+
|`llm.WithSeed(uint64)`| Yes | Yes | Yes | - | The seed to use for random sampling. If set, different calls will generate deterministic results. |
206
+
|`llm.WithFormat(string)`| Use `json`| Yes | Use `json_format` or `text`| - | The format of the response. For Mistral, you must also instruct the model to produce JSON yourself with a system or a user message. |
207
+
|`llm.WithPresencePenalty(float64)`| Yes | No | Yes | - | Determines how much the model penalizes the repetition of words or phrases. A higher presence penalty encourages the model to use a wider variety of words and phrases, making the output more diverse and creative. |
208
+
|`llm.WithFequencyPenalty(float64)`| Yes | No | Yes | - | Penalizes the repetition of words based on their frequency in the generated text. A higher frequency penalty discourages the model from repeating words that have already appeared frequently in the output, promoting diversity and reducing repetition. |
209
+
|`mistral.WithPrediction(string)`| No | No | Yes | - | Enable users to specify expected results, optimizing response times by leveraging known or predictable content. This approach is especially effective for updating text documents or code files with minimal changes, reducing latency while maintaining high-quality results. |
210
+
|`llm.WithSafePrompt()`| No | No | Yes | - | Whether to inject a safety prompt before all conversations. |
211
+
|`llm.WithNumCompletions(uint64)`| No | No | Yes | - | Number of completions to return for each request. |
212
+
|`llm.WithAttachment(io.Reader)`| Yes | Yes | Yes | - | Attach a file to a user prompt. It is the responsibility of the caller to close the reader. |
213
+
|`antropic.WithEphemeral()`| No | Yes | No | - | Attachments should be cached server-side |
214
+
|`antropic.WithCitations()`| No | Yes | No | - | Attachments should be used in citations |
215
+
|`antropic.WithUser(string)`| No | Yes | No | - | Indicate the user name for the request, for debugging |
216
+
217
+
## The Command Line Tool
218
+
219
+
You can use the command-line tool to interact with the API. To build the tool, you can use the following command:
220
+
221
+
```bash
222
+
go install github.com/mutablelogic/go-llm/cmd/llm@latest
0 commit comments