Include chat, weather, image, travel, streaming ASR and text examples, shared model initialization, documentation, and existing tests. Co-authored-by: TRAE CLI <traecli@bytedance.com>
24 lines
507 B
Go
24 lines
507 B
Go
package llm
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/cloudwego/eino-ext/components/model/openai"
|
|
)
|
|
|
|
func MustNewChatModel(ctx context.Context, model string) *openai.ChatModel {
|
|
chat, err := openai.NewChatModel(ctx, &openai.ChatModelConfig{
|
|
APIKey: os.Getenv("AI_KEY"),
|
|
BaseURL: "https://ai.loveuer.com/v1",
|
|
Model: model,
|
|
ReasoningEffort: openai.ReasoningEffortLevelLow,
|
|
})
|
|
if err != nil {
|
|
log.Panicf("new openai chat model failed: %v", err)
|
|
}
|
|
|
|
return chat
|
|
}
|