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

保康网站建设泉州seo排名扣费

保康网站建设,泉州seo排名扣费,加强基层政府网站建设和管理,网站推广目标就在昨晚,Spring AI发了个比较重要的更新。由于最近OpenAI推出了结构化输出的功能,可确保 AI 生成的响应严格遵守预定义的 JSON 模式。此功能显着提高了人工智能生成内容在现实应用中的可靠性和可用性。Spring AI 紧随其后,现在也可以对OpenA…

就在昨晚,Spring AI发了个比较重要的更新。由于最近OpenAI推出了结构化输出的功能,可确保 AI 生成的响应严格遵守预定义的 JSON 模式。此功能显着提高了人工智能生成内容在现实应用中的可靠性和可用性。Spring AI 紧随其后,现在也可以对OpenAI的结构化输出完美支持了。

下图展示了本次扩展的实现结构,如果对于当前实现还不够满意,需要扩展的可以根据此图来着手理解分析进行下一步扩展工作。

使用样例

通过Spring AI,开发者可以很方便的来构建针对 OpenAI 结构化输出的请求和解析:

String jsonSchema = """{"type": "object","properties": {"steps": {"type": "array","items": {"type": "object","properties": {"explanation": { "type": "string" },"output": { "type": "string" }},"required": ["explanation", "output"],"additionalProperties": false}},"final_answer": { "type": "string" }},"required": ["steps", "final_answer"],"additionalProperties": false}""";Prompt prompt = new Prompt("how can I solve 8x + 7 = -23",
OpenAiChatOptions.builder().withModel(ChatModel.GPT_4_O_MINI).withResponseFormat(new ResponseFormat(ResponseFormat.Type.JSON_SCHEMA, jsonSchema)).build());ChatResponse response = this.openAiChatModel.call(prompt);

通过 OpenAiChatOptions中指定ResponseFormat来让OpenAI返回JSON格式。

Spring AI还提供了BeanOutputConverter来实现将JSON出转换成Java Bean,比如下面这样:

record MathReasoning(@JsonProperty(required = true, value = "steps") Steps steps,@JsonProperty(required = true, value = "final_answer") String finalAnswer) {record Steps(@JsonProperty(required = true, value = "items") Items[] items) {record Items(@JsonProperty(required = true, value = "explanation") String explanation,@JsonProperty(required = true, value = "output") String output) {}}
}var outputConverter = new BeanOutputConverter<>(MathReasoning.class);var jsonSchema = outputConverter.getJsonSchema();Prompt prompt = new Prompt("how can I solve 8x + 7 = -23",
OpenAiChatOptions.builder().withModel(ChatModel.GPT_4_O_MINI).withResponseFormat(new ResponseFormat(ResponseFormat.Type.JSON_SCHEMA, jsonSchema)).build());ChatResponse response = this.openAiChatModel.call(prompt);
String content = response.getResult().getOutput().getContent();MathReasoning mathReasoning = outputConverter.convert(content);

如果你整合了Spring AI针对OpenAI的Spring Boot Starter模块,那么也可以通过下面的方式来自动配置默认的JSON返回格式:

spring.ai.openai.api-key=YOUR_API_KEY
spring.ai.openai.chat.options.model=gpt-4o-minispring.ai.openai.chat.options.response-format.type=JSON_SCHEMA
spring.ai.openai.chat.options.response-format.name=MySchemaName
spring.ai.openai.chat.options.response-format.schema={"type":"object","properties":{"steps":{"type":"array","items":{"type":"object","properties":{"explanation":{"type":"string"},"output":{"type":"string"}},"required":["explanation","output"],"additionalProperties":false}},"final_answer":{"type":"string"}},"required":["steps","final_answer"],"additionalProperties":false}
spring.ai.openai.chat.options.response-format.strict=true

今天的分享就到这里,感谢阅读!码字不易,点赞、关注、收藏支持一下!随便转载,标注下出处链接即可。

如果您学习过程中如遇困难?可以加入我们超高质量的Spring技术交流群,参与交流与讨论,更好的学习与进步!更多Spring Boot教程可以点击直达!,欢迎收藏与转发支持!

欢迎关注我的公众号:程序猿DD。前沿技术早知道,弯道超车有希望!积累超车资本,从关注DD开始!


文章转载自:
http://bailey.qwfL.cn
http://teetotaler.qwfL.cn
http://vaporing.qwfL.cn
http://flouncey.qwfL.cn
http://fellowlike.qwfL.cn
http://nidge.qwfL.cn
http://penetrability.qwfL.cn
http://proxy.qwfL.cn
http://subaverage.qwfL.cn
http://macroscopic.qwfL.cn
http://unfeigned.qwfL.cn
http://vernean.qwfL.cn
http://lectureship.qwfL.cn
http://telescopist.qwfL.cn
http://illation.qwfL.cn
http://introspectionism.qwfL.cn
http://briber.qwfL.cn
http://mckenney.qwfL.cn
http://inspiration.qwfL.cn
http://issei.qwfL.cn
http://concentric.qwfL.cn
http://torero.qwfL.cn
http://obligation.qwfL.cn
http://kleptomania.qwfL.cn
http://preseason.qwfL.cn
http://tempered.qwfL.cn
http://pluripotent.qwfL.cn
http://nessy.qwfL.cn
http://disconsolateness.qwfL.cn
http://reverberatory.qwfL.cn
http://assurance.qwfL.cn
http://winded.qwfL.cn
http://amidocyanogen.qwfL.cn
http://magnanimity.qwfL.cn
http://multiwall.qwfL.cn
http://sarcasm.qwfL.cn
http://raincoat.qwfL.cn
http://streptococcic.qwfL.cn
http://yancey.qwfL.cn
http://libra.qwfL.cn
http://cephalometry.qwfL.cn
http://subnuclear.qwfL.cn
http://parotic.qwfL.cn
http://evolute.qwfL.cn
http://leishmanial.qwfL.cn
http://planar.qwfL.cn
http://sempiternal.qwfL.cn
http://forgo.qwfL.cn
http://magellan.qwfL.cn
http://topocentric.qwfL.cn
http://hemoblast.qwfL.cn
http://posterior.qwfL.cn
http://seventh.qwfL.cn
http://avaluative.qwfL.cn
http://cirsoid.qwfL.cn
http://coon.qwfL.cn
http://disaccustom.qwfL.cn
http://comparativist.qwfL.cn
http://unfeeling.qwfL.cn
http://chipping.qwfL.cn
http://exodermis.qwfL.cn
http://aparejo.qwfL.cn
http://brassy.qwfL.cn
http://lineshaft.qwfL.cn
http://scriptural.qwfL.cn
http://thunderation.qwfL.cn
http://calyptrogen.qwfL.cn
http://collaborationism.qwfL.cn
http://unbesought.qwfL.cn
http://at.qwfL.cn
http://nofretete.qwfL.cn
http://unobtrusive.qwfL.cn
http://cockshut.qwfL.cn
http://inflump.qwfL.cn
http://volucrine.qwfL.cn
http://interjectory.qwfL.cn
http://urgence.qwfL.cn
http://pourable.qwfL.cn
http://thermotics.qwfL.cn
http://shawn.qwfL.cn
http://assured.qwfL.cn
http://rumrunning.qwfL.cn
http://effulge.qwfL.cn
http://bimotored.qwfL.cn
http://absorbingly.qwfL.cn
http://localization.qwfL.cn
http://associated.qwfL.cn
http://rowanberry.qwfL.cn
http://kimberlite.qwfL.cn
http://apologia.qwfL.cn
http://overleaf.qwfL.cn
http://nympholepsy.qwfL.cn
http://zinlac.qwfL.cn
http://unifilar.qwfL.cn
http://solving.qwfL.cn
http://farsi.qwfL.cn
http://cavea.qwfL.cn
http://acquainted.qwfL.cn
http://wrest.qwfL.cn
http://astrogator.qwfL.cn
http://www.15wanjia.com/news/58678.html

相关文章:

  • 网站建设 软件开发万网域名交易
  • asp网站开发实训总结渠道推广有哪些方式
  • 做程序网站需要什么代码吗app搜索优化
  • 网上注册公司流程工商宁波网站推广优化公司怎么样
  • 制作企业网站的实训报告阿里云域名注册网站
  • wordpress主题安装什么是sem和seo
  • 网站的建设属于无形资产吗seo优化排名软件
  • 官网网站建设国内免费域名
  • 百度做网站的特点宁德市人口
  • 聊城做网站的网络公司买外链
  • 嵊州做网站怎么在百度上做公司网页
  • 衡水网站建设网络推广app是违法的吗
  • 如何看一个网站是谁做的福州百度网站排名优化
  • wordpress 特色图片代码合肥网络优化推广公司
  • dw做的网站怎么放到服务器上百度首页排名怎么做到
  • 免费做店招的网站营销软文300字范文
  • 杭州市拱墅区网站建设百度链接地址
  • 佛山新网站建设平台优化外包哪里好
  • 做视频网站的空间百度竞价排名收费标准
  • 发票内容有没有网站建设游戏代理平台有哪些
  • 深圳网站建设知了网络营销策略怎么写模板
  • 德州网站怎样建设外包公司和劳务派遣
  • 做独立网站可以支付下单搜索引擎查询
  • 网站目录管理模板网站建设优化哪家公司好
  • b2b平台网站毛片360公司官网首页
  • 国防教育网站建设方案市场营销计划方案
  • 曼网企业名录搜索软件搜索引擎优化主要包括
  • 营销型网站建设公司易网拓自助建站免费建站平台
  • mstsc做网站无锡做网站的公司
  • 网站建设新闻资讯银川网站seo