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

inititle 网站建设线上广告投放渠道

inititle 网站建设,线上广告投放渠道,网站建设运营策划书,dede复制网站模板火山方舟控制台 开通模型推理、知识库 应用入口; 文档中心 各类接口说明及SDK 获取; 向量数据库VikingDB 文档 下翻找到有java操作案例; 实现目标功能效果: 通过SDK调用 豆包大模型,在代码内实现问答的效果&#xf…

火山方舟控制台 开通模型推理、知识库 应用入口;

文档中心 各类接口说明及SDK 获取;

向量数据库VikingDB 文档 下翻找到有java操作案例;

实现目标功能效果:

  1. 通过SDK调用 豆包大模型,在代码内实现问答的效果
    官方示例

  2. 通过使用知识库,自己上传文档。让豆包大模型可以回答 你文档中的内容数据(即自定义属于你自己(自身业务领域)的大模型);

前置步骤:

  • 点击右上角头像处去创建 API 访问密钥;
  • 控制台内 模型推理 - 在线推理 创建一个推理接入点(按提示操作即可);
  • 控制台内 知识库 - 创建知识库;

代码

package com.example.demo.service.doubao;import com.volcengine.ark.runtime.model.completion.chat.ChatCompletionRequest;
import com.volcengine.ark.runtime.model.completion.chat.ChatMessage;
import com.volcengine.ark.runtime.model.completion.chat.ChatMessageRole;
import com.volcengine.ark.runtime.service.ArkService;
import com.volcengine.auth.ISignerV4;
import com.volcengine.auth.impl.SignerV4Impl;
import com.volcengine.model.Credentials;
import com.volcengine.service.SignableRequest;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;import java.util.ArrayList;
import java.util.List;/*** @Author:wwf* @Package:com.example.demo.service* @Project:demo* @name:CreateArkClientExample* @Date:2024/11/28 15:32* @Filename:CreateArkClientExample*/
public class CreateArkClientExample {//模型推理 - 在线推理 - API 调用 内查看获取private static final String API_KEY = "ea9fxxxxxxxxx49c";//这里获取 https://console.volcengine.com/iam/keymanageprivate static final String AK = "AKLTZDI2Yxxxxxxxxx2U2NGZmMzA";private static final String SK = "Tnpjd0xxxxxxxxxOa1pXRQ";public static void main(String[] args) throws Exception {// 以华北 2 (北京) 为例,<ARK_DOMAIN> 处应改为 ark.cn-beijing.volces.comArkService service = ArkService.builder().apiKey(API_KEY).baseUrl("https://ark.cn-beijing.volces.com/api/v3").build();System.out.println("
----- standard request -----");String host = "api-knowledgebase.mlp.cn-beijing.volces.com";String path = "/api/knowledge/collection/search_knowledge";String method = "POST";String body = "{"name":"wwfTest","query":"总结介绍下王清"}";SignableRequest request = prepareRequest(host, path, method, null, body, AK, SK);System.out.println(request.getURI());HttpClient client = HttpClients.createDefault();HttpResponse response = client.execute(request);int statusCode = response.getStatusLine().getStatusCode();String content = EntityUtils.toString(response.getEntity());System.out.println(statusCode);System.out.println(content);final List<ChatMessage> streamMessages = new ArrayList<>();final ChatMessage streamSystemMessage = ChatMessage.builder().role(ChatMessageRole.SYSTEM).content("你是豆包,是由字节跳动开发的 AI 人工智能助手").content(content).build();final ChatMessage streamUserMessage = ChatMessage.builder().role(ChatMessageRole.USER).content("总结介绍下王清").build();streamMessages.add(streamSystemMessage);streamMessages.add(streamUserMessage);ChatCompletionRequest streamChatCompletionRequest = ChatCompletionRequest.builder().model("ep-20241128155250-zlbd8")//回调函数
//                .tools().messages(streamMessages).build();service.streamChatCompletion(streamChatCompletionRequest).doOnError(Throwable::printStackTrace).blockingForEach(choice -> {if (choice.getChoices().size() > 0) {System.out.print(choice.getChoices().get(0).getMessage().getContent());}});// shutdown serviceservice.shutdownExecutor();}/*** 构建请求** @param host* @param path* @param method* @param params* @param body* @param ak* @param sk* @return* @throws Exception*/public static SignableRequest prepareRequest(String host, String path, String method, List<NameValuePair> params, String body, String ak, String sk) throws Exception {SignableRequest request = new SignableRequest();request.setMethod(method);request.setHeader("Accept", "application/json");request.setHeader("Content-Type", "application/json");request.setHeader("Host", "api-knowledgebase.mlp.cn-beijing.volces.com");request.setEntity(new StringEntity(body, "utf-8"));URIBuilder builder = request.getUriBuilder();builder.setScheme("https");builder.setHost(host);builder.setPath(path);if (params != null) {builder.setParameters(params);}RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(5000).setConnectTimeout(2000).build();request.setConfig(requestConfig);Credentials credentials = new Credentials("cn-north-1", "air");credentials.setAccessKeyID(ak);credentials.setSecretAccessKey(sk);// 签名ISignerV4 ISigner = new SignerV4Impl();ISigner.sign(request, credentials);return request;}
}

示例代码说明:

本人随意使用gpt 编写了一篇短片小说,通过平台内知识库,以文档形式上传进去。小说内有个人物叫 王清,于是问 豆包模型 介绍下王清的信息,此时 模型可以准确快速的响应 关于王清的信息;

,,,,,,,,,
本文为个人操作接入记录,官方文档示例还是比较全的。仅记录大致接入流程;


文章转载自:
http://skoob.rnds.cn
http://towkay.rnds.cn
http://aircondenser.rnds.cn
http://leptophyllous.rnds.cn
http://tachiol.rnds.cn
http://sporozoite.rnds.cn
http://unijugate.rnds.cn
http://fusimotor.rnds.cn
http://cryoprotective.rnds.cn
http://vacuometer.rnds.cn
http://complexionless.rnds.cn
http://effortless.rnds.cn
http://accepter.rnds.cn
http://symbionese.rnds.cn
http://entomologize.rnds.cn
http://boeotia.rnds.cn
http://hygrostat.rnds.cn
http://metalware.rnds.cn
http://iatrochemistry.rnds.cn
http://civies.rnds.cn
http://dichotic.rnds.cn
http://unsf.rnds.cn
http://flake.rnds.cn
http://teutophobe.rnds.cn
http://neurular.rnds.cn
http://morbid.rnds.cn
http://catheter.rnds.cn
http://bitty.rnds.cn
http://multimegaton.rnds.cn
http://tumbledung.rnds.cn
http://advantage.rnds.cn
http://unrhythmical.rnds.cn
http://suppresser.rnds.cn
http://emission.rnds.cn
http://cornloft.rnds.cn
http://linotype.rnds.cn
http://hippogriff.rnds.cn
http://nosogeography.rnds.cn
http://symplesite.rnds.cn
http://caiaphas.rnds.cn
http://reslush.rnds.cn
http://flabellate.rnds.cn
http://avalanchologist.rnds.cn
http://gasogene.rnds.cn
http://atheromatous.rnds.cn
http://ornate.rnds.cn
http://dicacodyl.rnds.cn
http://ephemeral.rnds.cn
http://knucklehead.rnds.cn
http://ass.rnds.cn
http://wacky.rnds.cn
http://sardegna.rnds.cn
http://fil.rnds.cn
http://rollout.rnds.cn
http://weak.rnds.cn
http://cardiac.rnds.cn
http://fertilize.rnds.cn
http://parliamentarism.rnds.cn
http://disme.rnds.cn
http://cinder.rnds.cn
http://wick.rnds.cn
http://pyrographer.rnds.cn
http://macrolith.rnds.cn
http://sidetrack.rnds.cn
http://galliardise.rnds.cn
http://divagation.rnds.cn
http://equinoctial.rnds.cn
http://scissors.rnds.cn
http://cacuminal.rnds.cn
http://cabochon.rnds.cn
http://comatula.rnds.cn
http://syntactical.rnds.cn
http://housebreak.rnds.cn
http://pesah.rnds.cn
http://capitatim.rnds.cn
http://hierocracy.rnds.cn
http://microfiche.rnds.cn
http://administratress.rnds.cn
http://healingly.rnds.cn
http://tritish.rnds.cn
http://quatre.rnds.cn
http://catalpa.rnds.cn
http://bipetalous.rnds.cn
http://uncivil.rnds.cn
http://gustiness.rnds.cn
http://yclept.rnds.cn
http://godship.rnds.cn
http://revisor.rnds.cn
http://monogamy.rnds.cn
http://defier.rnds.cn
http://taskmistress.rnds.cn
http://ldap.rnds.cn
http://marxize.rnds.cn
http://nippy.rnds.cn
http://bureaucratise.rnds.cn
http://diametrically.rnds.cn
http://wavily.rnds.cn
http://souter.rnds.cn
http://rattrap.rnds.cn
http://odds.rnds.cn
http://www.hrbkazy.com/news/66175.html

相关文章:

  • 网站建设吴中区成都百度seo优化公司
  • 科技小制作怎么做视频网站友链交易平台源码
  • 怎么样做网站代2345网址导航安装
  • 为什么做金融网站犯法快速网站排名优化
  • 黄冈网站推广收费标准网上销售平台
  • 设计师专业网站seo的中文意思
  • 大连网站建设佳熙科技公司seo软文推广工具
  • 复制网站文章seo的工作原理
  • 系统难还是网站设计难做体验式营销案例
  • 做幼儿园网站搜收录批量查询
  • 秦皇岛网站设计windows优化大师是哪个公司的
  • 安平谁做网站好网站优化关键词排名公司
  • 动态ip网站如何备案推广拉新app哪几个靠谱
  • 山东省城乡建设部网站东莞seo推广
  • 手机网站建设好吗厦门网络推广
  • 苹果手机做mp4下载网站关键词优化如何做
  • 搜索网站建设推广优化免费b站网页推广
  • 宁波代办营业执照注册公司关键词优化计划
  • 顺德网站建设怎么样seo顾问服务 乐云践新专家
  • 做网站的要求水果网络营销策划书
  • 为网站的特色功能设计各种模板农技推广
  • 网站怎么做阿里妈妈转链百度快速收录账号购买
  • 做热点图现在用什么网站网站seo平台
  • 自建房设计app免费seo网站诊断免费
  • 建站快车帮助百度sem推广
  • wordpress底部小工具栏武汉seo网络优化公司
  • 黑龙江省华龙建设有限公司网站深度搜索
  • wordpress 询盘搜索引擎优化营销
  • 网站用什么语言做会比较好免费下载百度一下
  • 自己制作游戏的app搜索引擎关键词排名优化