Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions adk/chatmodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type chatModelAgentRunOptions struct {
// run
chatModelOptions []model.Option
toolOptions []tool.Option
toolList []tool.BaseTool
agentToolOptions map[ /*tool name*/ string][]AgentRunOption // todo: map or list?

// resume
Expand All @@ -73,6 +74,13 @@ func WithToolOptions(opts []tool.Option) AgentRunOption {
})
}

// WithToolListOptions sets the runtime tool list for the chat model agent.
func WithToolListOptions(tools []tool.BaseTool) AgentRunOption {
return WrapImplSpecificOptFn(func(t *chatModelAgentRunOptions) {
t.toolList = tools
})
}

// WithAgentToolRunOptions specifies per-tool run options for the agent.
func WithAgentToolRunOptions(opts map[string] /*tool name*/ []AgentRunOption) AgentRunOption {
return WrapImplSpecificOptFn(func(t *chatModelAgentRunOptions) {
Expand Down Expand Up @@ -985,6 +993,9 @@ func getComposeOptions(opts []AgentRunOption) []compose.Option {
if len(to) > 0 {
co = append(co, compose.WithToolsNodeOption(compose.WithToolOption(to...)))
}
if len(o.toolList) > 0{
co = append(co,compose.WithToolsNodeOption(compose.WithToolList(o.toolList...)))
}
if o.historyModifier != nil {
co = append(co, compose.WithStateModifier(func(ctx context.Context, path compose.NodePath, state any) error {
s, ok := state.(*State)
Expand Down