feat: allow selecting chat models in ASR and weather examples
Parse --model in main with mini-chat as the default, and pass the selected model to the OpenAI chat model configuration. Keep argument parsing out of init so entrypoint tests can initialize their own flags. Co-authored-by: TRAE CLI <traecli@bytedance.com>
This commit is contained in:
1 parent
1512f0516f
commit
587f61bc03
4 files changed
+24
-6
No files matched your search
+10
-1
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
@@ -20,7 +21,15 @@ import (
|
||||
"github.com/cloudwego/eino/schema"
|
||||
)
|
||||
|
||||
var (
|
||||
modelName string
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.StringVar(&modelName, "model", "mini-chat", "聊天模型名称")
|
||||
flag.Parse()
|
||||
|
||||
log.Printf("[D] use model = %s", modelName)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
signals := make(chan os.Signal, 1)
|
||||
@@ -40,7 +49,7 @@ func main() {
|
||||
assistant, err := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{
|
||||
Name: "terminal_chat",
|
||||
Instruction: opt.SYSTEM_PROMPT,
|
||||
Model: internal.MustNewChatModel(ctx),
|
||||
Model: internal.MustNewChatModel(ctx, modelName),
|
||||
MaxIterations: 10,
|
||||
ToolsConfig: adk.ToolsConfig{
|
||||
ToolsNodeConfig: compose.ToolsNodeConfig{
|
||||
|
||||
Reference in new issue
Block a user