Categorygithub.com/leverly/ChatGLM
modulepackage
1.2.0
Repository: https://github.com/leverly/chatglm.git
Documentation: pkg.go.dev

# README

ChatGLM-golang

ChatGLM golang restapi sdk

client init

proxy = client.NewChatGLMClient("XXX.XXX", 30*time.Second)

Sync Method Invoke

prompt := []client.Message{ {Role: "user", Content: "hello world"}, }

response, err := proxy.Invoke("chatglm_6b", 0.2, prompt)

Async Method Invoke

submit a task

taskId, err := proxy.AsyncInvoke("chatglm_6b", 0.2, prompt)

query the task status and result

response, err := proxy.AsyncInvokeTask("chatglm_6b", taskId)

Stream Invoke

callback definition

type StreamCallback struct { }

func (s *StreamCallback) OnData(data *client.SSEInvokeResponse) { fmt.Print(data.Data) }

func (s *StreamCallback) OnFinish(data *client.SSEInvokeResponse) { fmt.Println(data.Data) }

stream method invoke

err := proxy.SSEInvoke("chatglm_6b", 0.2, prompt, &StreamCallback{})

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author

# Structs

No description provided by the author