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

柳州正规网站制作公司哪家好全自动推广软件

柳州正规网站制作公司哪家好,全自动推广软件,只用html5做网站,网站建设案例代理商分类目录:《自然语言处理从入门到应用》总目录 使用少量示例 本部分的内容介绍了如何在聊天模型(Chat Models)中使用少量示例。关于如何最好地进行少量示例提示尚未形成明确的共识。因此,我们尚未固定任何关于此的抽象概念&#…

分类目录:《自然语言处理从入门到应用》总目录


使用少量示例

本部分的内容介绍了如何在聊天模型(Chat Models)中使用少量示例。关于如何最好地进行少量示例提示尚未形成明确的共识。因此,我们尚未固定任何关于此的抽象概念,而是使用现有的抽象概念。

交替的人工智能/人类消息

进行少量示例提示的第一种方式是使用交替的人工智能/人类消息。以下是一个示例:

from langchain.chat_models import ChatOpenAI
from langchain import PromptTemplate, LLMChain
from langchain.prompts.chat import (ChatPromptTemplate,SystemMessagePromptTemplate,AIMessagePromptTemplate,HumanMessagePromptTemplate,
)
from langchain.schema import (AIMessage,HumanMessage,SystemMessage
)chat = ChatOpenAI(temperature=0)template="You are a helpful assistant that translates english to pirate."
system_message_prompt = SystemMessagePromptTemplate.from_template(template)
example_human = HumanMessagePromptTemplate.from_template("Hi")
example_ai = AIMessagePromptTemplate.from_template("Argh me mateys")
human_template="{text}"
human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)chat_prompt = ChatPromptTemplate.from_messages([system_message_prompt, example_human, example_ai, human_message_prompt])chain = LLMChain(llm=chat, prompt=chat_prompt)# 从格式化的消息中获取聊天完成结果
chain.run("I love programming.")

输出:

"I be lovin' programmin', me hearty!"
系统消息

OpenAI提供了一个可选的name参数,我们也建议与系统消息一起使用以进行少量示例提示。以下是如何使用此功能的示例:

template="You are a helpful assistant that translates english to pirate."
system_message_prompt = SystemMessagePromptTemplate.from_template(template)
example_human = SystemMessagePromptTemplate.from_template("Hi", additional_kwargs={"name": "example_user"})
example_ai = SystemMessagePromptTemplate.from_template("Argh me mateys", additional_kwargs={"name": "example_assistant"})
human_template="{text}"
human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)chat_prompt = ChatPromptTemplate.from_messages([system_message_prompt, example_human, example_ai, human_message_prompt])
chain = LLMChain(llm=chat, prompt=chat_prompt)# 从格式化的消息中获取聊天完成结果
chain.run("I love programming.")

输出:

"I be lovin' programmin', me hearty!"

响应流式传输

本部分介绍了如何在聊天模型中使用流式传输:

from langchain.chat_models import ChatOpenAI
from langchain.schema import (HumanMessage,
)
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
chat = ChatOpenAI(streaming=True, callbacks=[StreamingStdOutCallbackHandler()], temperature=0)
resp = chat([HumanMessage(content="Write me a song about sparkling water.")])

输出:

Verse 1:
Bubbles rising to the top
A refreshing drink that never stops
Clear and crisp, it's pure delight
A taste that's sure to exciteChorus:
Sparkling water, oh so fine
A drink that's always on my mind
With every sip, I feel alive
Sparkling water, you're my vibeVerse 2:
No sugar, no calories, just pure bliss
A drink that's hard to resist
It's the perfect way to quench my thirst
A drink that always comes firstChorus:
Sparkling water, oh so fine
A drink that's always on my mind
With every sip, I feel alive
Sparkling water, you're my vibeBridge:
From the mountains to the sea
Sparkling water, you're the key
To a healthy life, a happy soul
A drink that makes me feel wholeChorus:
Sparkling water, oh so fine
A drink that's always on my mind
With every sip, I feel alive
Sparkling water, you're my vibeOutro:
Sparkling water, you're the one
A drink that's always so much fun
I'll never let you go, my friend
Sparkling

参考文献:
[1] LangChain 🦜️🔗 中文网,跟着LangChain一起学LLM/GPT开发:https://www.langchain.com.cn/
[2] LangChain中文网 - LangChain 是一个用于开发由语言模型驱动的应用程序的框架:http://www.cnlangchain.com/

http://www.ds6.com.cn/news/157.html

相关文章:

  • wordpress手机h5主题seo云优化外包
  • 椒江住房和城乡建设规划局网站网站推广优化的方法
  • 绿化公司网站建设百度最怕哪个部门去投诉
  • 天津做一个简单的网站天津关键词排名推广
  • 在家做十字绣兼职网站宁波seo整体优化公司
  • 如何制作网页图片素材百度seo搜索排名
  • 单页网站如何做排名培训机构哪家最好
  • 什么是响应式网站设计北京推广服务
  • 网站如何备案流程小红书怎么做关键词排名优化
  • 高端h5网站建设 上海跨境电商seo是什么意思
  • 北京做电商网站2024年新闻时事热点论文
  • 做网站的素材都在哪里下载视频号视频怎么看下载链接
  • 达州网站制作写一篇推广商品的软文
  • 专门做旅游的视频网站有哪些长春网站关键词推广
  • 广东移动网站bt蚂蚁磁力搜索天堂
  • 怎样创业白手起家开公司宁波seo关键词费用
  • 做网站维护要学些什么·江东seo做关键词优化
  • 南京网站制作费用网页模板代码
  • 刷赞网站怎么做的外贸网站建设推广
  • 做网站便宜网络广告图片
  • 做神马网站优化排名建站流程新手搭建网站第一步
  • 网站制作公司交接网站网站广告费一般多少钱
  • wordpress网站搭建教程微信营销模式
  • flash网站制作公司百度官方人工客服电话
  • 高要区公路建设规划局网站公司网站制作教程
  • 西宁设计网站建设网站运营推广
  • 浙江省工程建设协会网站女教师遭网课入侵直播录屏曝光se
  • 水利网站建设中国建设网官方网站
  • 长沙的最新疫情通报轨迹广州网站优化推广方案
  • 凯里网站制作网文推广怎么做