Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat: remove tool choice in model callback input" #46

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions components/model/callback_extra.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ type CallbackInput struct {
Messages []*schema.Message
// Tools is the tools to be used in the model.
Tools []*schema.ToolInfo
// ToolChoice is the tool choice, which controls the tool to be used in the model.
ToolChoice any // string / *schema.ToolInfo
// Config is the config for the model.
Config *Config
// Extra is the extra information for the callback.
Expand Down
13 changes: 0 additions & 13 deletions components/model/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package model

import "github.com/cloudwego/eino/schema"

// Options is the common options for the model.
type Options struct {
// Temperature is the temperature for the model, which controls the randomness of the model.
Expand All @@ -30,8 +28,6 @@ type Options struct {
TopP *float32
// Stop is the stop words for the model, which controls the stopping condition of the model.
Stop []string
// ToolChoice controls which tool is called by the model.
ToolChoice *schema.ToolChoice
}

// Option is the call option for ChatModel component.
Expand Down Expand Up @@ -86,15 +82,6 @@ func WithStop(stop []string) Option {
}
}

// WithToolChoice is the option to set tool choice for the model.
func WithToolChoice(toolChoice schema.ToolChoice) Option {
return Option{
apply: func(opts *Options) {
opts.ToolChoice = &toolChoice
},
}
}

// WrapImplSpecificOptFn is the option to wrap the implementation specific option function.
func WrapImplSpecificOptFn[T any](optFn func(*T)) Option {
return Option{
Expand Down
5 changes: 0 additions & 5 deletions components/model/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package model
import (
"testing"

"github.com/cloudwego/eino/schema"
"github.com/smartystreets/goconvey/convey"
)

Expand All @@ -34,8 +33,6 @@ func TestOptions(t *testing.T) {
defaultTemperature float32 = 1.0
defaultMaxTokens = 1000
defaultTopP float32 = 0.5

toolChoiceForbidden = schema.ToolChoiceForbidden
)

opts := GetCommonOptions(
Expand All @@ -50,7 +47,6 @@ func TestOptions(t *testing.T) {
WithMaxTokens(maxToken),
WithTopP(topP),
WithStop([]string{"hello", "bye"}),
WithToolChoice(schema.ToolChoiceForbidden),
)

convey.So(opts, convey.ShouldResemble, &Options{
Expand All @@ -59,7 +55,6 @@ func TestOptions(t *testing.T) {
MaxTokens: &maxToken,
TopP: &topP,
Stop: []string{"hello", "bye"},
ToolChoice: &toolChoiceForbidden,
})
})
}
Expand Down
34 changes: 0 additions & 34 deletions schema/tool_choice.go

This file was deleted.

Loading