Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文档可以再写详细一点吗,例如怎么在代码里设置apikey #7

Open
infomore opened this issue Apr 29, 2024 · 4 comments

Comments

@infomore
Copy link

No description provided.

@infomore
Copy link
Author

还有glm-4v模型的调用示例

@chaosll
Copy link

chaosll commented Jul 29, 2024

你好, 这个问题你解决了吗? 我现在只能在http中调用, nodejs的案例调不通, 不知道如何设置apiKey😂

@infomore
Copy link
Author

你好, 这个问题你解决了吗? 我现在只能在http中调用, nodejs的案例调不通, 不知道如何设置apiKey😂

我已经解决了,可以看我的博客。btw,谷歌的vertex模型比这个好用。https://blog.csdn.net/Duang2001/article/details/139502203

@chaishenAI
Copy link

const ZhipuAI = require('zhipuai-sdk-nodejs-v4'); // 确保路径正确

// 配置选项
const options = {
apiKey: 'xxx', // 替换为你的实际API密钥
};

const dialogue = async () => {
const ai = new ZhipuAI.ZhipuAI(options)
const data = await ai.createCompletions({
model: "glm-4",
messages: [
{"role": "user", "content": "你好"},
{"role": "assistant", "content": "我是人工智能助手"},
{"role": "user", "content": "你叫什么名字"},
{"role": "assistant", "content": "我叫chatGLM"},
{"role": "user", "content": "你都可以做些什么事"}
],
stream: false,
})
console.log(data, "message")
}

dialogue()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants