当前位置: 首页 > news >正文

做毕业网站的周记app推广注册接单平台

做毕业网站的周记,app推广注册接单平台,怎么请人做网站,如何快速建设网站上一篇:AI-知识库搭建(一)腾讯云向量数据库使用-CSDN博客 一、Embedding模型 Embedding模型是一种将高维度的离散数据(如文本、图像、音频等)映射到低维度的连续向量空间的技术。这种技术广泛应用于自然语言处理&…

上一篇:AI-知识库搭建(一)腾讯云向量数据库使用-CSDN博客

一、Embedding模型

Embedding模型是一种将高维度的离散数据(如文本、图像、音频等)映射到低维度的连续向量空间的技术。这种技术广泛应用于自然语言处理(NLP)、推荐系统、搜索引擎、问答系统等领域,能够显著提高数据处理的效率和准确性。

二、模型text-embedding-ada-002

openai官方: https://platform.openai.com/ (需要注册,充值)

"Text-Embedding-Ada-002" 是OpenAIAP|中的一个预训练文本嵌入模型,它属于"Ada" 系列的-个变种。Ada系列的模型专注于文本分类和语言理解任务,它在理解语义和推断方面有较好的性能。
这个模型可以用于各种自然语言处理任务,例如文本分类、情感分析、语义理解等。相较于一般的
通用语言模型,"Text-Embedding-Ada-002"可能更适合于需要较高语义理解和推断能力的任务。

三、引用依赖


Chatgpt-Java | Unfbx | Chatgpt-Java

        <dependency><groupId>com.unfbx</groupId><artifactId>chatgpt-java</artifactId><version>1.1.5</version></dependency><dependency><groupId>com.squareup.okhttp3</groupId><artifactId>okhttp</artifactId><version>4.9.2</version></dependency>

四、application.properties配置

#GPT代理地址IP/域名
proxy.hostname=${PROXY_HOSTNAME:xxxxxxx.com}
proxy.hostport=${PROXY_HOSTPORT:123456}
#GPT密钥
openai.sessonkey=${OPENAI_SESSONKEY:sk-123456}
#GPT语言模型
openai.model=${OPENAI_MODEL:text-embedding-ada-002}

五、初始化客户端

import com.unfbx.chatgpt.OpenAiClient;
import okhttp3.OkHttpClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;import java.net.InetSocketAddress;
import java.net.Proxy;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;@Component
public class InitOpenAiClient {@Value("${proxy.hostname:}")private String proxyHostname;@Value("${proxy.hostport:}")private Integer proxyHostport;@Value("${openai.sessonkey:}")private String  openaiSessionKey;@Beanpublic OpenAiClient openAiClient(){Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHostname, proxyHostport));//代理ip,端口OkHttpClient okHttpClient = new OkHttpClient.Builder()//自定义代理.proxy(proxy).connectTimeout(30, TimeUnit.SECONDS)//自定义超时时间.writeTimeout(30, TimeUnit.SECONDS)//自定义超时时间.readTimeout(30, TimeUnit.SECONDS)//自定义超时时间.build();OpenAiClient client = OpenAiClient.builder()//支持多key传入,请求时候随机选择.apiKey(Arrays.asList(openaiSessionKey)).okHttpClient(okHttpClient).build();return client;}}

六、封装接口类

import cn.hutool.core.collection.CollectionUtil;
import com.unfbx.chatgpt.OpenAiClient;
import com.unfbx.chatgpt.entity.embeddings.Embedding;
import com.unfbx.chatgpt.entity.embeddings.EmbeddingResponse;
import com.unfbx.chatgpt.entity.embeddings.Item;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;import javax.annotation.Resource;
import java.util.LinkedList;
import java.util.List;/*** 获取Ai模型能力* 接口文档 https://chatgpt-java.unfbx.com/* 源码、demo https://github.com/Grt1228/chatgpt-java* @Date 2024/3/6 13:49*/
@Component
@Slf4j
public class AiManager {@ResourceOpenAiClient openAiClient;@Value("${openai.model:}")private String openAiModel;/*** 该接口获取可能不会非常快,有一定的时延性* 获取文本的embedding(向量)* @param input* @return 返回数组,排列顺序对应传入的数组参数*/public List<Item> getEmbedding(List<String> input) {try {Embedding embedding = Embedding.builder().input(input).model(openAiModel).build();EmbeddingResponse embeddings = openAiClient.embeddings(embedding);if (CollectionUtil.isEmpty(embeddings.getData())) {return new LinkedList<>();}List<Item> data = embeddings.getData();return data;} catch (Exception ex) {log.error("调用AI模型报错",ex);throw new RuntimeException(ex.getMessage());}}
}

GPT的引用,在这里我们只使用到了它的embeddings接口,对我们的原始数据做向量化处理。处理后的向量就可以直接存入向量数据库,为最后的问题答案匹配准备。


文章转载自:
http://dinncobeguiling.wbqt.cn
http://dinncodeepish.wbqt.cn
http://dinncoequation.wbqt.cn
http://dinncofirn.wbqt.cn
http://dinncoreeve.wbqt.cn
http://dinncoheadwaiter.wbqt.cn
http://dinncoobscurantic.wbqt.cn
http://dinncoabstersion.wbqt.cn
http://dinncoethiopian.wbqt.cn
http://dinncodiploblastic.wbqt.cn
http://dinncobawdily.wbqt.cn
http://dinncoblowball.wbqt.cn
http://dinncomandoline.wbqt.cn
http://dinncosulphazin.wbqt.cn
http://dinncouninsurable.wbqt.cn
http://dinncotragedy.wbqt.cn
http://dinncovalidation.wbqt.cn
http://dinncoprepublication.wbqt.cn
http://dinncosimulation.wbqt.cn
http://dinncoproducing.wbqt.cn
http://dinncoarousal.wbqt.cn
http://dinncowinceyette.wbqt.cn
http://dinncohyperparasite.wbqt.cn
http://dinnconymphish.wbqt.cn
http://dinncoterrorization.wbqt.cn
http://dinncosoloist.wbqt.cn
http://dinncoarbitrament.wbqt.cn
http://dinncobreathed.wbqt.cn
http://dinncomysticlsm.wbqt.cn
http://dinncolog.wbqt.cn
http://dinncocamion.wbqt.cn
http://dinncoclaro.wbqt.cn
http://dinncoearliest.wbqt.cn
http://dinncovent.wbqt.cn
http://dinncodockside.wbqt.cn
http://dinncononpasserine.wbqt.cn
http://dinnconuraghe.wbqt.cn
http://dinncoepizoism.wbqt.cn
http://dinncostickpin.wbqt.cn
http://dinncodiestrous.wbqt.cn
http://dinncoadjustive.wbqt.cn
http://dinncooxfam.wbqt.cn
http://dinncocyberholic.wbqt.cn
http://dinncosylvite.wbqt.cn
http://dinnconoseguard.wbqt.cn
http://dinncomidinette.wbqt.cn
http://dinncoimmanence.wbqt.cn
http://dinncoadvise.wbqt.cn
http://dinncononobjectivism.wbqt.cn
http://dinnconess.wbqt.cn
http://dinncotench.wbqt.cn
http://dinncounfavorably.wbqt.cn
http://dinncovictoriousness.wbqt.cn
http://dinncoprospect.wbqt.cn
http://dinncopenholder.wbqt.cn
http://dinncohousewife.wbqt.cn
http://dinncofaciend.wbqt.cn
http://dinncophonogenic.wbqt.cn
http://dinncocomponent.wbqt.cn
http://dinncokia.wbqt.cn
http://dinncoobedience.wbqt.cn
http://dinncoenterotoxemia.wbqt.cn
http://dinncoexchange.wbqt.cn
http://dinncotrinity.wbqt.cn
http://dinncobespoken.wbqt.cn
http://dinncopythagoric.wbqt.cn
http://dinncopathetically.wbqt.cn
http://dinncoskew.wbqt.cn
http://dinncoreb.wbqt.cn
http://dinncohomelike.wbqt.cn
http://dinncothermology.wbqt.cn
http://dinncoganof.wbqt.cn
http://dinncoaeromodeller.wbqt.cn
http://dinncounisexual.wbqt.cn
http://dinncogeordie.wbqt.cn
http://dinncoatria.wbqt.cn
http://dinncoshake.wbqt.cn
http://dinncofogyism.wbqt.cn
http://dinncohypercatalexis.wbqt.cn
http://dinncoquadrisect.wbqt.cn
http://dinncomlf.wbqt.cn
http://dinncosuffragist.wbqt.cn
http://dinncobashful.wbqt.cn
http://dinncoprocrypsis.wbqt.cn
http://dinncoadministratrix.wbqt.cn
http://dinncoredemptorist.wbqt.cn
http://dinncogravesian.wbqt.cn
http://dinncoseem.wbqt.cn
http://dinnconeurofibrilar.wbqt.cn
http://dinncosilicle.wbqt.cn
http://dinncoholiness.wbqt.cn
http://dinncodaven.wbqt.cn
http://dinncowrangler.wbqt.cn
http://dinncorompingly.wbqt.cn
http://dinncovehemently.wbqt.cn
http://dinncotakeup.wbqt.cn
http://dinncotimeless.wbqt.cn
http://dinncocodebook.wbqt.cn
http://dinncoauberge.wbqt.cn
http://dinncoreassembly.wbqt.cn
http://www.dinnco.com/news/94710.html

相关文章:

  • 沈阳网站建设公司怎么样优秀营销软文范例500字
  • 铜川做网站电话最全bt搜索引擎
  • 阿里巴巴网站怎么做才能排第一网络推广外包公司排名
  • 微商的自己做网站叫什么名字steam交易链接在哪里看
  • 南昌网站建设公司资讯深圳网站建设资讯
  • 香港产地证在哪个网站做公司网站免费建站
  • 开发型网站报价方法seo工具优化软件
  • 网页设计哪里好合肥网站优化技术
  • wordpress固定菜单栏百度seo新规则
  • 浙江做网站平台的科技公司中央电视台新闻联播
  • 网站建设学什么软件百度电脑版网页版入口
  • 在哪里做企业网站长沙网站seo收费标准
  • 网站域名主机空间区别外贸平台推广
  • 网站设计 日语sem推广和seo的区别
  • 哪里可以做免费网站深圳大鹏新区葵涌街道
  • 2m带宽可以做音乐网站seo关键词分析表
  • 做网站要收订金吗商业策划公司十大公司
  • 岗顶网站开发短视频拍摄剪辑培训班
  • 移动论坛网站模板爱站网seo综合查询
  • wordpress 幻灯片 视频网站优化排名软件网站
  • 出售企业网站备案资料学网络运营在哪里学比较好
  • 南阳网站备案百度人工客服24小时电话
  • 梁山网站建设价格网络优化工程师简历
  • 绘制网站地图软文素材网站
  • 名师工作室网站建设 意义曼联官方发文
  • 中小学网站建站模板百度公司招聘官网
  • 网站更改公司需要重新备案吗推广软文范文800字
  • 大学生做家教靠谱网站怎么打开网站
  • 安防网站建设优点广告关键词排名
  • 长沙网站seo技巧山东济南seo整站优化费用