首页 > 其他分享 >冰橙GPT提供开放接口 。提供与OPENAI官方一致的体验效果(同步返回数据,同时支持流式及非流式内容加载)

冰橙GPT提供开放接口 。提供与OPENAI官方一致的体验效果(同步返回数据,同时支持流式及非流式内容加载)

时间:2023-04-22 17:44:33浏览次数:53  
标签:completion turbo 冰橙 流式 3.5 OPENAI gpt model 0301

冰橙GPT chatGPT开放接口使用说明 【接入了腾讯云内容安全检测】

冰橙GPT稳定提供API接口服务

定时有人进行问题排查处理

1小时内问题响应

接入了腾讯云的内容安全检测

有任何疑问请加入QQ交流群:310872519                    冰橙GPT交流群2

 


1.请求地址:https://gpt.bcwhkj.cn/api/v2.Gptliu/search   

2.请求方式: POST  

3.body格式:json

4.请求内容(sse 流式请求,输出效果较好,响应速度快)(非流式请求,可不加stream这一行):

{
       "messages" : [{"role":"user","content":"你是谁?"}],
       "model": "gpt-3.5-turbo",
       "stream":true //非SSE流式请求,这一行可不加
}

  

5.请求头

{
    "Content-Type": application/json,
    "Authorization": "Bearer 这段中文换成你自己的TOKEN(注意前面有个英文空格需保留)"
}

 

 

说明:

token获取方式:访问公众号《冰橙文化科技》进入菜单冰橙GPT后,访问右上角 / 个人(首次访问免费赠送10000字符,可通过充值增加字符数)可查看 token

 

SSE流式请求与非流式请求的区别:
    流式POST请求:内容将进行逐家响应和返回,响应速度快。
    普通POST请求:将等待OPENAI的CHATGPT官方接口全部内容都响应完成后,服务器这边才会将内容将通过接口回复给前端,速度较慢。


也可通过微信扫以下图片进入:

 

5.响应体格式:json

6.响应内容(非流式请求时的响应内容):

{
    "id": "chatcmpl-77dQj73rIl0GJyTpAH4QlcSnhOFKp",
    "object": "chat.completion",
    "created": 1682054221,
    "model": "gpt-3.5-turbo-0301",
    "usage": {
        "prompt_tokens": 13,
        "completion_tokens": 30,
        "total_tokens": 43
    },
    "choices": [
        {
            "message": {
                "role": "assistant",
                "content": "我是一个人工智能语言模型,可以根据用户提供的输入进行回答和交流。"
            },
            "finish_reason": "stop",
            "index": 0
        }
    ]
}

 

 

6.响应内容(流式请求时的响应内容):

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"role":"assistant"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"我"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"是"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"一个"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"AI"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"语"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"言"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"模"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"型"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":","},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"专"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"门"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"用"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"来"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"回"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"答"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"问题"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"和"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"提"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"供"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"帮"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"助"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"的"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"content":"。"},"index":0,"finish_reason":null}]}

data: {"id":"chatcmpl-783jPdq1a1ZG6KQc9pq98FDRSqNmp","object":"chat.completion.chunk","created":1682155323,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{},"index":0,"finish_reason":"stop"}]}

data: [DONE]

 

 

 

image.png

 

 

 

特别说明【连续对话功能】:

如果需要有上下文语境,请把之前问的问题和答案一起通过Q参数传过来,其中问题和答案前面分别加上“ Q:” 和 “ A:”参数 ,Q和A前面有空格,举例:

Q = "你好!"

A : 你好,有什么可以帮助你的。

Q: "今天天气怎么样?"

那么第二次提交带上之前的问题和答案,请求体里面的Q就是:

keyword = " Q:你好! A:你好,有什么可以帮助你的。 Q:今天天气怎么样?"

JS方法如下:

keyword='';                
that.list={   
    wen:'老婆和妈妈同时掉水里,我要先救谁?',   
    da:'这种情况下,是理所当然应该先救妈妈的。救人的原则是先救生命危险的人,有可能先救老婆,这取决于老婆和妈妈的实际情况,而且也要考虑到逃生的可能性。假如老婆游泳能力很强,可能先救老婆,能在短时间内将她救出水面,否则,先救妈妈也是明智之举。 '
};        

//新问题
newQ:'我不同意?';        

//将之前的所有问答列表进行循环
that.list.forEach((v,k)=>{  
    //将问和答案组合,<|endoftext|>是用于给OPENAI官方接口进行分段识别的  
    keyword=keyword+' Q: '+v.wen + ' A: '+v.da+'。 <|endoftext|> ';
})        

//将新的问题组合          
keyword=keyword+'Q: '+newQ + 'A: ';

 

 

这样获取的答案就是支持上下文语境了哈~

 

 

标签:completion,turbo,冰橙,流式,3.5,OPENAI,gpt,model,0301
From: https://www.cnblogs.com/bingcheng/p/17343575.html

相关文章

  • 我的OpenAI库发布了!!!
    chatGPT正式发布已经有段时间了,这段时间我也深度体验了chatGPT的魅力。OpenAI除了提供网页版的chatGPT,还通过api的形式提供了很多其它服务,包括文字纠错、图片生成、音频转换等等。作为程序员,即使有现成的openai库,但还是免不了想自己造轮子,所以就有这个openai库。当前这个库刚刚......
  • 3D Diffusion模型来了!OpenAI出品,已开源
    文|天于刀刀2022年不愧是AIGC行业元年。伴随着ChatGPT的大火使得谷歌一周之内改口“会认真评估ChatGPT对搜索引擎的影响”,OpenAI在3D图像生成领域进一步放出了大招开源项目“Point-E”[1],可玩程度不下于ChatGPT!简单来说,用户可以输入一连串文字prompt内容,只需要短短18......
  • ChatGPT闲谈——火出圈的为什么是 OpenAI?
    ChatGPT走入大众视野之后,AIGC行业迎来了爆发,尤其是上个月,仿佛每一天都可能是「历史性」的一天。现在各大网站已经有非常多的优秀创作者进行总结和分析,都是值得一阅的好文。今天本文也分享了关于ChatGPT的看法,有谈到技术,也有关于ChatGPT的闲谈,看完这篇文章,相信你会对ChatGPT有......
  • 低延迟流式语音识别技术在人机语音交互场景中的实践
    美团语音交互部针对交互场景下的低延迟语音识别需求,提出了一种全新的低出字延迟流式语音识别方案。本方法将降低延迟问题转换成一个知识蒸馏过程,极大地简化了延迟优化的难度,仅通过一个正则项损失函数就使得模型在训练过程中自动降低出字延迟。在实验测试集上,本方法能够获得最高近2......
  • 论文解读:基于 OpenMLDB 的流式特征计算优化
    近期,数据库领域的顶级学术会议ICDE2023在迪斯尼主题公园的故乡-美国的安纳海姆(Anaheim)举办。由OpenMLDB开源社区和新加坡科技设计大学(SingaporeUniversityofTechnologyandDesign)联合完成的研究工作在ICDE2023上作为工业界的常规论文发表。该项研究工作增强了OpenM......
  • OpenAI API
    OpenAIAPIDocumentationhttps://platform.openai.com/docs/models/overviewGPT迭代过程版本发布时间训练方案参数量是否开放接口GPT(GPT-1)2018年6月无监督学习1.17亿是GPT-22019年2月多任务学习15亿是GPT-32020年5月海量参数1,750亿......
  • [Linux]流式传输和块传输
    在计算机中,流和块(Block)是用于数据传输和处理的两种不同的处理方式,两者之间的主要区别如下:1.数据单位不同流是一系列按顺序排列的数据字符组成的序列,数据以字节为单位进行传输和处理,适用于逐个传递字符流的应用程序。相比之下,块以块为单位进行传输和处理,每个块包含多个字节,可以......
  • Flex| 流式 布局 ,让元素两端居左,居右,别再用float:right了
    主要代码是.parent{ justify-content:space-between; }}完整代码案例.tasklist{height:calc(80vh);overflow-y:auto;overflow-x:hidden;border:1pxsolid#ccc;border-radius:4px;}.taskhead{display:flex;height:50px;......
  • 万字详解 | Java 流式编程
    概述StreamAPI是Java中引入的一种新的数据处理方法。它提供了一种高效且易于使用的方法来处理数据集合。StreamAPI支持函数式编程,可以让我们以简洁、优雅的方式进行数据操作,还有使用Stream的两大原因:在大多数情况下,将对象存储在集合中就是为了处理它们,因此你会发现你把编程......
  • 纯前端仿GPT流式打字效果的js库,类似通义千问或者其他AI界面的打字效果
    因为GPT以及国内各大模型的发布,很多官网都设计的是,仿造流式打字效果,下面这个js库就能轻松实现。typed.js  具体实现代码参考下面:<spanid="subTitle"></span><scriptsrc="https://unpkg.com/[email protected]/dist/typed.umd.js"></script><script>vartyped=......