Introduce "agents"
An agent is currently a name given to a system prompt and a set of tools which the agent has access to. This resolves the previous issue of the set of configured tools being available in *all* contexts, which wasn't always desired. Tools are now only available when an agent is explicitly requested using the `-a/--agent` flag. Agents are expected to be expanded on: the concept of task-specilized agents (e.g. coding), the ability to define a set of files an agent should always have access to for RAG purposes, etc. Other changes: - Removes the "tools" top-level config structure (though this is expected to come back along with the abillity to define custom tools). - Renamed `pkg/agent` to `pkg/agents`
This commit is contained in:
@@ -51,6 +51,12 @@ func applyGenerationFlags(ctx *lmcli.Context, cmd *cobra.Command) {
|
||||
return ctx.GetModels(), cobra.ShellCompDirectiveDefault
|
||||
})
|
||||
|
||||
// -a, --agent
|
||||
f.StringVarP(&ctx.Config.Defaults.Agent, "agent", "a", ctx.Config.Defaults.Agent, "Which agent to interact with")
|
||||
cmd.RegisterFlagCompletionFunc("agent", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
|
||||
return ctx.GetAgents(), cobra.ShellCompDirectiveDefault
|
||||
})
|
||||
|
||||
// --max-length
|
||||
f.IntVar(ctx.Config.Defaults.MaxTokens, "max-length", *ctx.Config.Defaults.MaxTokens, "Maximum response tokens")
|
||||
// --temperature
|
||||
@@ -65,14 +71,21 @@ func applyGenerationFlags(ctx *lmcli.Context, cmd *cobra.Command) {
|
||||
|
||||
func validateGenerationFlags(ctx *lmcli.Context, cmd *cobra.Command) error {
|
||||
f := cmd.Flags()
|
||||
|
||||
model, err := f.GetString("model")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing --model: %w", err)
|
||||
}
|
||||
if !slices.Contains(ctx.GetModels(), model) {
|
||||
if model != "" && !slices.Contains(ctx.GetModels(), model) {
|
||||
return fmt.Errorf("Unknown model: %s", model)
|
||||
}
|
||||
|
||||
agent, err := f.GetString("agent")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing --agent: %w", err)
|
||||
}
|
||||
if agent != "" && !slices.Contains(ctx.GetAgents(), agent) {
|
||||
return fmt.Errorf("Unknown agent: %s", agent)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user