展示型网站有哪些功能,深圳市8号公告,鹰潭做网站的,简历上作品展示网站链接怎么做百度简介
百度#xff08;Baidu#xff09;是拥有强大互联网基础的领先AI公司。百度愿景是#xff1a;成为最懂用户#xff0c;并能帮助人们成长的全球顶级高科技公司。
“百度”二字#xff0c;来自于八百年前南宋词人辛弃疾的一句词#xff1a;众里寻他千百度。这句话…百度简介
百度Baidu是拥有强大互联网基础的领先AI公司。百度愿景是成为最懂用户并能帮助人们成长的全球顶级高科技公司。
“百度”二字来自于八百年前南宋词人辛弃疾的一句词众里寻他千百度。这句话描述了词人对理想的执着追求。1999年底身在美国硅谷的李彦宏看到了中国互联网及中文搜索引擎服务的巨大发展潜力抱着技术改变世界的梦想他毅然辞掉硅谷的高薪工作携搜索引擎专利技术于2000年1月1日在中关村创建了百度公司。
百度拥有数万名研发工程师这是中国乃至全球都顶尖的技术团队。这支队伍掌握着世界上领先的搜索引擎技术使百度成为掌握世界尖端科学核心技术的中国高科技企业也使中国成为美国、俄罗斯和韩国之外全球仅有的4个拥有搜索引擎核心技术的国家之一。 该简介引自百度百科百度百度公司_百度百科 简单实现千帆 ModelBuilder API的调用
1、注册百度云
进入百度智能云-云智一体深入产业官网完成注册 注意注册完成后一定要完成个人认证不然无法使用 2、获取API接口
完成注册后点击立即体验即可进入千帆大模型平台进入应用接入页面后点击创建应用输入该应用名称和描述后点击确定即可完成创建可以看到这里就会有我刚创建完毕的应用我们就可以在我们的程序中通过API key和Secret Key来调用该应用具体使用方式可见推理服务API介绍 - ModelBuilder官方API使用文档
3、简单的案例实现
在pom.xml文件中导入下列依赖 dependencygroupIdcom.squareup.okhttp3/groupIdartifactIdokhttp/artifactIdversion4.9.1/version !-- 请检查最新版本 --/dependencydependencygroupIdcom.google.code.gson/groupIdartifactIdgson/artifactIdversion2.8.8/version !-- 请检查最新版本 --/dependencydependencygroupIdorg.json/groupIdartifactIdjson/artifactIdversion20231013/version/dependency 创建一个简单的案例
import okhttp3.*;
import java.io.IOException;
import java.util.Scanner;import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonArray;public class BaiduAIChat {private static final OkHttpClient client new OkHttpClient();public static String getAccessToken() throws IOException {//格式为https://aip.baidubce.com/oauth/2.0/token?grant_typeclient_credentialsclient_idAPI Keyclient_secretSecret Key//注意这里更换为自己的API Key和Secret KeyString url https://aip.baidubce.com/oauth/2.0/token?grant_typeclient_credentialsclient_idDJufZMEjworMMvTcCgukat4zclient_secretLlEz19TXicOg5xxuwnjHS46IShdHtZ2W;Request request new Request.Builder().url(url).post(RequestBody.create(null, new byte[0])).build();try (Response response client.newCall(request).execute()) {String responseBody response.body().string();JsonObject jsonObject new Gson().fromJson(responseBody, JsonObject.class);return jsonObject.get(access_token).getAsString();}}public static void main(String[] args) throws IOException {Scanner scanner new Scanner(System.in);System.out.print(请输入您的问题);String userInput scanner.nextLine();scanner.close();String accessToken getAccessToken();//百度云api https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/自己需要使用的服务//服务名称可在应用详情页面查看String url https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/ernie-speed-128k?access_token accessToken;JsonObject payload new JsonObject();JsonArray messages new JsonArray();JsonObject message new JsonObject();message.addProperty(role, user);message.addProperty(content, userInput);messages.add(message);payload.add(messages, messages);payload.addProperty(stream, false);payload.addProperty(temperature, 0.9);payload.addProperty(top_p, 0.7);payload.addProperty(penalty_score, 1);payload.addProperty(system, 高等数学老师);payload.addProperty(max_output_tokens, 4096);payload.addProperty(frequency_penalty, 0.1);payload.addProperty(presence_penalty, 0.0);RequestBody body RequestBody.create(payload.toString(), MediaType.get(application/json; charsetutf-8));Request request new Request.Builder().url(url).post(body).build();try (Response response client.newCall(request).execute()) {String responseBody response.body().string();JsonObject responseJson new Gson().fromJson(responseBody, JsonObject.class);if (responseJson.has(result)) {System.out.println(responseJson.get(result).getAsString());} else {System.out.println(没有返回结果或结果格式不正确。);}}}
} 具体如何选择API url中的服务可见API列表 - ModelBuilder官方介绍文档根据其中功能介绍选择适合自己程序的api 4、使用结果示例 这里只是一个简单的demo更加详细完善的功能可以自己去实现