MCPcopy Create free account
hub / github.com/FloatTech/ZeroBot-Plugin / llmchat

Function llmchat

plugin/llm/main.go:230–246  ·  view source on GitHub ↗

llmchat 调用大模型API包装

(prompt string, temp float32)

Source from the content-addressed store, hash-verified

228
229// llmchat 调用大模型API包装
230func llmchat(prompt string, temp float32) (string, error) {
231 topp, maxn := chat.AC.MParams()
232
233 x := deepinfra.NewAPI(chat.AC.API, string(chat.AC.Key))
234
235 mod, err := chat.AC.Type.Protocol(chat.AC.ModelName, temp, topp, maxn)
236 if err != nil {
237 return "", nil
238 }
239
240 data, err := x.Request(mod.User(model.NewContentText(prompt)))
241 if err != nil {
242 return "", err
243 }
244
245 return strings.TrimSpace(data), nil
246}

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected