Git Product home page Git Product logo

chatglm's People

Contributors

tangshuang avatar

Watchers

 avatar  avatar

chatglm's Issues

集成到typescript(NestJS)项目进行调用 依赖库似乎加载有问题

你好,最近在对接智谱的AI接口,尝试调用官方API,想学习借鉴你的写法,在本地跑起来出现这个问题,请问是否可以帮忙定位下。

执行npm i chatglm

调用

import { ChatGLM } from 'chatglm';
// 加载apikey
api_key = process.env.ZHIPUAI_API_KEY;
const chat = new ChatGLM(this.api_key);
  // 发起请求
  const { data } = await chat.completions.careate({
    model: 'chatglm-4',
    stream: true,
    messages: [
      { role: 'system', content: '你是一个聪明且富有创造力的小说作家' },
      {
        role: 'user',
        content:
          '请你作为童话故事大王,写一篇短篇童话故事,故事的主题是要永远保持一颗善良的心,要能够激发儿童的学习兴趣和想象力,同时也能够帮助儿童更好地理解和接受故事中所蕴含的道理和价值观。',
      },
    ],
});

const stream = ChatGLM.adapt(data); // 通过adapt方法让数据抛出的更好用
stream.on('data', (chunk) => {
  console.log(chunk);
});

运行报错:

const { data } = await chat.completions.careate({
                                            ^
TypeError: chat.completions.careate is not a function
    at ZhipuService.callChatGLM (...\zhipu.service.ts:16:45)

o1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.