96SEO 2026-02-20 03:56 19
文字创作#xff1a;撰写故事、公文、邮件、剧本和诗歌…1.相关概念

是阿里云研发的大语言模型用于理解和分析用户输入的自然语言在不同领域和任务为用户提供服务和帮助。
翻译服务提供各类语言的翻译服务如英语、日语、法语或西班牙语等。
是阿里云推出的模型服务平台提供了包括通义千问在内的多种模型的服务接口建立在“模型即服务”Model-as-a-ServiceMaaS的理念基础之上围绕AI各领域模型通过标准化API接口提供模型推理等服务为用户打造一站式模型解决方案。
DashScope使用API-KEY作为调用API的密钥。
API-KEY承担了调用鉴权、计量计费等功能。
API-KEY被广泛应用于DashScope
参数指定。
DashScope中所有不同的模型API服务都可以使用一个API-KEY、以一致的编程方式进行调用方便开发者进行跨模态的、多个模型的接续调用。
API-KEY是访问DashScope的密钥请务必妥善保存。
不要以任何方式公开到外部渠道避免因未经授权的使用造成安全风险或资金损失。
推荐将API-KEY配置到环境变量中以降低API-KEY的泄漏风险
https://help.aliyun.com/zh/dashscope/developer-reference/acquisition-and-configuration-of-api-key?spma2c4g.11186623.0.0.42b6b400xOdsJb
如何获取通义千问API的KEY_模型服务灵积(DashScope)-阿里云帮助中心
上下文长度Token数最大输入Token数最大输出Token数输入成本每千Token输出成本每千Token8k6k2k0.04元0.12元
能力均衡推理效果和速度介于通义千问-Max和通义千问-Turbo之间适合中等复杂任务。
上下文长度Token数最大输入Token数最大输出Token数输入成本每千Token输出成本每千Token32k30k8k0.004元0.012元
上下文长度Token数最大输入Token数最大输出Token数输入成本每千Token输出成本每千Token8k6k1.5k0.002元0.006元
对于中文文本来说千问模型的1个token平均对应1.5-1.8个汉字
https://mvnrepository.com/artifact/com.alibaba/dashscope-sdk-java
dependencygroupIdcom.alibaba/groupIdartifactIddashscope-sdk-java/artifactIdversion2.16.2/version
com.alibaba.dashscope.aigc.generation.Generation;
com.alibaba.dashscope.aigc.generation.GenerationParam;
com.alibaba.dashscope.aigc.generation.GenerationResult;
com.alibaba.dashscope.common.Message;
com.alibaba.dashscope.common.Role;
com.alibaba.dashscope.exception.ApiException;
com.alibaba.dashscope.exception.InputRequiredException;
com.alibaba.dashscope.exception.NoApiKeyException;
com.alibaba.dashscope.utils.Constants;
com.alibaba.dashscope.utils.JsonUtils;
org.springframework.beans.factory.annotation.Value;
org.springframework.web.bind.annotation.RequestMapping;
org.springframework.web.bind.annotation.RequestParam;
org.springframework.web.bind.annotation.RestController;import
java.util.Arrays;RestController
{Value(${tongyi.api-key})private
apiKey;RequestMapping(/call/base)public
callWithMessage(message);System.out.println(JsonUtils.toJson(result));return
result.getOutput().getChoices().get(0).getMessage().getContent();}public
Message.builder().role(Role.SYSTEM.getValue()).content(你是一个乐于助人的AI助手.).build();//
Message.builder().role(Role.USER.getValue()).content(message).build();//
构建生成参数对象用于定制化生成请求GenerationParam
GenerationParam.builder().model(qwen-turbo)
选择使用的模型.messages(Arrays.asList(systemMsg,
设置消息列表包括系统消息和用户消息.resultFormat(GenerationParam.ResultFormat.MESSAGE)
设置Top-K参数控制生成结果的多样性.temperature(0.8f)
设置Top-P参数进一步控制生成结果的多样性.seed(1234)
调用生成对象的call方法执行生成请求并返回生成结果return
http://localhost:8081/tongyi/call/base?message你是谁HTTP/1.1
我是阿里云开发的一款超大规模语言模型我叫通义千问。
作为一个AI助手我的目标是帮助用户获得准确、有用的信息解决他们的问题和困惑。
无论是提供知识解答、创意建议还是进行信息查询我都致力于以最有效的方式提供帮助。
返回的结果
fbd59659-bf46-9bf8-9c9b-58934190e57d,usage:
我是阿里云开发的一款超大规模语言模型我叫通义千问。
作为一个AI助手我的目标是帮助用户获得准确、有用的信息解决他们的问题和困惑。
无论是提供知识解答、创意建议还是进行信息查询我都致力于以最有效的方式提供帮助。
}}]}
实现多轮对话的关键在于维护一个存放历史对话信息的列表并将更新后的列表作为大模型的输入从而使大模型可以参考历史对话信息进行回复。
如果对话轮数较多可能会超过大模型可以输入的token上限。
需要控制输入大模型的token数量。
com.alibaba.dashscope.aigc.generation.Generation;
com.alibaba.dashscope.aigc.generation.GenerationParam;
com.alibaba.dashscope.aigc.generation.GenerationResult;
com.alibaba.dashscope.common.Message;
com.alibaba.dashscope.common.Role;
com.alibaba.dashscope.exception.ApiException;
com.alibaba.dashscope.exception.InputRequiredException;
com.alibaba.dashscope.exception.NoApiKeyException;
com.alibaba.dashscope.utils.Constants;
org.springframework.beans.factory.annotation.Value;
org.springframework.web.bind.annotation.RequestMapping;
org.springframework.web.bind.annotation.RequestParam;
org.springframework.web.bind.annotation.RestController;import
{Value(${tongyi.api-key})private
ArrayList(List.of(createMessage(Role.SYSTEM,
10;RequestMapping(/call/many)public
用户输入的文本是UserMessagehistoryMessage.add(createMessage(Role.USER,
historyMessage.subList(historyMessage.size()
historyMessage.size());}System.out.println(模型输入
historyMessage);GenerationParam
createGenerationParam(historyMessage);GenerationResult
callGenerationWithMessages(param);System.out.println(模型输出
result.getOutput().getChoices().get(0).getMessage().getContent());historyMessage.add(result.getOutput().getChoices().get(0).getMessage());return
result.getOutput().getChoices().get(0).getMessage().getContent();}public
createGenerationParam(ListMessage
GenerationParam.builder().model(qwen-turbo).messages(messages).resultFormat(GenerationParam.ResultFormat.MESSAGE).topP(0.8).build();}public
callGenerationWithMessages(GenerationParam
Message.builder().role(role.getValue()).content(content).build();}}2.2.2.测试
http://localhost:8081/tongyi/call/many?message你现在的名字叫王小二###
http://localhost:8081/tongyi/call/many?message你是一名大学生###
http://localhost:8081/tongyi/call/many?message你的学习成绩很好,
http://localhost:8081/tongyi/call/many?message现在介绍一下你自己,
通过prompt方式调用时输入与输出的数据格式比messages方式简单更适合单轮问答等简单场景在更复杂的场景中推荐您通过messages方式调用。
com.alibaba.dashscope.aigc.generation.Generation;
com.alibaba.dashscope.aigc.generation.GenerationParam;
com.alibaba.dashscope.aigc.generation.GenerationResult;
com.alibaba.dashscope.aigc.generation.models.QwenParam;
com.alibaba.dashscope.common.Message;
com.alibaba.dashscope.common.ResultCallback;
com.alibaba.dashscope.common.Role;
com.alibaba.dashscope.exception.ApiException;
com.alibaba.dashscope.exception.InputRequiredException;
com.alibaba.dashscope.exception.NoApiKeyException;
com.alibaba.dashscope.utils.Constants;
com.alibaba.dashscope.utils.JsonUtils;
org.springframework.beans.factory.annotation.Value;
org.springframework.web.bind.annotation.RequestMapping;
org.springframework.web.bind.annotation.RequestParam;
org.springframework.web.bind.annotation.RestController;import
java.util.concurrent.Semaphore;RestController
{Value(${tongyi.api-key})private
apiKey;RequestMapping(/call/prompt)public
qwenQuickStart(message);qwenQuickStartCallback(message);System.out.println(JsonUtils.toJson(result));return
{System.out.println(String.format(Exception
创建Generation实例用于调用API生成文本Generation
QwenParam.builder().model(Generation.Models.QWEN_TURBO)
设置采样参数topP0.8表示在概率为0.8的范围内采样.build();//
打印生成结果的JSON格式System.out.println(JsonUtils.toJson(result));//
QwenParam.builder().model(Generation.Models.QWEN_TURBO)
ResultCallbackGenerationResult()
{System.out.println(message);}//
{System.out.println(ex.getMessage());semaphore.release();
{System.out.println(onComplete);semaphore.release();
作为专业的SEO优化服务提供商,我们致力于通过科学、系统的搜索引擎优化策略,帮助企业在百度、Google等搜索引擎中获得更高的排名和流量。我们的服务涵盖网站结构优化、内容优化、技术SEO和链接建设等多个维度。
| 服务项目 | 基础套餐 | 标准套餐 | 高级定制 |
|---|---|---|---|
| 关键词优化数量 | 10-20个核心词 | 30-50个核心词+长尾词 | 80-150个全方位覆盖 |
| 内容优化 | 基础页面优化 | 全站内容优化+每月5篇原创 | 个性化内容策略+每月15篇原创 |
| 技术SEO | 基本技术检查 | 全面技术优化+移动适配 | 深度技术重构+性能优化 |
| 外链建设 | 每月5-10条 | 每月20-30条高质量外链 | 每月50+条多渠道外链 |
| 数据报告 | 月度基础报告 | 双周详细报告+分析 | 每周深度报告+策略调整 |
| 效果保障 | 3-6个月见效 | 2-4个月见效 | 1-3个月快速见效 |
我们的SEO优化服务遵循科学严谨的流程,确保每一步都基于数据分析和行业最佳实践:
全面检测网站技术问题、内容质量、竞争对手情况,制定个性化优化方案。
基于用户搜索意图和商业目标,制定全面的关键词矩阵和布局策略。
解决网站技术问题,优化网站结构,提升页面速度和移动端体验。
创作高质量原创内容,优化现有页面,建立内容更新机制。
获取高质量外部链接,建立品牌在线影响力,提升网站权威度。
持续监控排名、流量和转化数据,根据效果调整优化策略。
基于我们服务的客户数据统计,平均优化效果如下:
我们坚信,真正的SEO优化不仅仅是追求排名,而是通过提供优质内容、优化用户体验、建立网站权威,最终实现可持续的业务增长。我们的目标是与客户建立长期合作关系,共同成长。
Demand feedback