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

添加对智谱V4 API的支持 #965

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

moondie
Copy link
Contributor

@moondie moondie commented Jan 24, 2024

智谱现在推荐使用V4版本的API,其格式与OPENAI的格式已经基本一致了。(某些细微处稍有差别),V4版本的API支持联网功能和函数调用,联网是默认开启。由于其相比V3API变化太大,所以我将其视为一个新的渠道。仅添加了对glm-4、glm-3-turbo的支持,glm-4v还没弄。

本PR还涉及对openai/model.go部分改动,主要是添加了一些字段。

由于环境搭建问题,我并没有测试,但感觉问题不大。作者有时间可以测试一下再合并。

@RexWzh
Copy link

RexWzh commented Jan 29, 2024

同上,智谱把 v1 改成 v4 了。目前用 one-api 跑 embedding-2 和 cogview-3 都会有问题。

@songquanpeng
Copy link
Owner

智谱的 API 变动比较大,之后我会处理

@dytinux
Copy link

dytinux commented Mar 10, 2024

embedding-2还是有问题,谁有解决办法

@RexWzh
Copy link

RexWzh commented Mar 10, 2024

弄个 nginx 代理

server {
    listen 443 ssl;
    server_name zhipu.example.com;
    ssl_certificate cert/example.com.pem;
    ssl_certificate_key cert/example.com.key;

    # 重写 /v1 到 /v4
    location ~ ^/v1(.*)$ {
        rewrite ^/v1(.*)$ /v4$1 last;
    }

    location / {
        proxy_pass  https://open.bigmodel.cn/api/paas;
        proxy_ssl_server_name on;
        proxy_set_header Host open.bigmodel.cn;
        proxy_set_header Connection '';
        proxy_http_version 1.1;
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

@assassinliujie
Copy link

联网功能不就是函数调用功能之一吗,还是说有其他的联网功能

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

Successfully merging this pull request may close these issues.

5 participants