zhipuai_go is a Go-based application that provides an interface to interact with glm Language Model API. This project is designed to be lightweight, efficient, and easy to use for handling text-based requests and generating responses.
- Integration with a Language Model API for generating responses.
- JSON-based request and response format.
- Easy configuration through an INI file.
- Go 1.16 or later.
- A valid API key for the Language Model API.
- Clone the repository:
git clone https://github.com/vvxf/zhipuai_go.git cd zhipuai_go
- Install dependencies:
go mod tidy
- Configure the application by creating a
config.ini
file in theconf
directory with the following content:[api] url = "YOUR_API_URL" key = "YOUR_API_KEY"
package main
import (
"fmt"
"github.com/vvxf/zhipuai_go/api"
)
func main() {
apiURL := "https://open.bigmodel.cn/api/paas/v4/chat/completions"
apiKey := ""
// init application
appService := api.NewLLMApplicationService(apiURL, apiKey)
resp, _ := appService.HandleRequest("glm-4-flash", []api.Message{
{
Role: "user",
Content: "Hello, llm!",
},
})
fmt.Println(resp.Choices[0].Message.Content)
}
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or suggestions, please open an issue on GitHub or reach out to us at zhipuaigo @ outlook.com
.
Thank you for using zhipuai_go!