MCPcopy Create free account
hub / github.com/cloudwego/eino-examples / createOpenAIChatModel

Function createOpenAIChatModel

quickstart/chat/openai.go:28–41  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

26)
27
28func createOpenAIChatModel(ctx context.Context) model.ToolCallingChatModel {
29 key := os.Getenv("OPENAI_API_KEY")
30 modelName := os.Getenv("OPENAI_MODEL_NAME")
31 baseURL := os.Getenv("OPENAI_BASE_URL")
32 chatModel, err := openai.NewChatModel(ctx, &openai.ChatModelConfig{
33 BaseURL: baseURL,
34 Model: modelName,
35 APIKey: key,
36 })
37 if err != nil {
38 log.Fatalf("create openai chat model failed, err=%v", err)
39 }
40 return chatModel
41}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected