中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

鎮(zhèn)海官方網(wǎng)站建設(shè)網(wǎng)絡(luò)銷(xiāo)售怎么做才能有業(yè)務(wù)

鎮(zhèn)海官方網(wǎng)站建設(shè),網(wǎng)絡(luò)銷(xiāo)售怎么做才能有業(yè)務(wù),建設(shè)網(wǎng)站必須要配置apache嗎,徐州人才網(wǎng)最新徐州招聘信息分類(lèi)目錄:《自然語(yǔ)言處理從入門(mén)到應(yīng)用》總目錄 使用少量示例 本部分的內(nèi)容介紹了如何在聊天模型(Chat Models)中使用少量示例。關(guān)于如何最好地進(jìn)行少量示例提示尚未形成明確的共識(shí)。因此,我們尚未固定任何關(guān)于此的抽象概念&#…

分類(lèi)目錄:《自然語(yǔ)言處理從入門(mén)到應(yīng)用》總目錄


使用少量示例

本部分的內(nèi)容介紹了如何在聊天模型(Chat Models)中使用少量示例。關(guān)于如何最好地進(jìn)行少量示例提示尚未形成明確的共識(shí)。因此,我們尚未固定任何關(guān)于此的抽象概念,而是使用現(xiàn)有的抽象概念。

交替的人工智能/人類(lèi)消息

進(jìn)行少量示例提示的第一種方式是使用交替的人工智能/人類(lèi)消息。以下是一個(gè)示例:

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)# 從格式化的消息中獲取聊天完成結(jié)果
chain.run("I love programming.")

輸出:

"I be lovin' programmin', me hearty!"
系統(tǒng)消息

OpenAI提供了一個(gè)可選的name參數(shù),我們也建議與系統(tǒng)消息一起使用以進(jìn)行少量示例提示。以下是如何使用此功能的示例:

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)# 從格式化的消息中獲取聊天完成結(jié)果
chain.run("I love programming.")

輸出:

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

響應(yīng)流式傳輸

本部分介紹了如何在聊天模型中使用流式傳輸:

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

參考文獻(xiàn):
[1] LangChain 🦜?🔗 中文網(wǎng),跟著LangChain一起學(xué)LLM/GPT開(kāi)發(fā):https://www.langchain.com.cn/
[2] LangChain中文網(wǎng) - LangChain 是一個(gè)用于開(kāi)發(fā)由語(yǔ)言模型驅(qū)動(dòng)的應(yīng)用程序的框架:http://www.cnlangchain.com/

http://www.risenshineclean.com/news/43760.html

相關(guān)文章:

  • 做網(wǎng)站北京培訓(xùn)網(wǎng)絡(luò)營(yíng)銷(xiāo)的機(jī)構(gòu)
  • 裝修廣告做哪個(gè)網(wǎng)站最好看百度站長(zhǎng)平臺(tái)網(wǎng)頁(yè)版
  • 鹽城企業(yè)做網(wǎng)站多少錢(qián)網(wǎng)絡(luò)營(yíng)銷(xiāo)研究背景及意義
  • 國(guó)內(nèi)知名互聯(lián)網(wǎng)公司泉州seo按天計(jì)費(fèi)
  • 專(zhuān)業(yè)做展會(huì)網(wǎng)站網(wǎng)絡(luò)營(yíng)銷(xiāo)成功的品牌
  • 新鄉(xiāng)網(wǎng)站制作手機(jī)怎么做網(wǎng)站免費(fèi)的
  • WordPress短碼生成器廣州seo顧問(wèn)seocnm
  • 網(wǎng)站音樂(lè)播放器插件衡水網(wǎng)站優(yōu)化推廣
  • 可以看所有網(wǎng)站的瀏覽器線(xiàn)在成都網(wǎng)站推廣公司
  • 石家莊做家教網(wǎng)站win10優(yōu)化大師有用嗎
  • 網(wǎng)頁(yè)兼容性站點(diǎn)app注冊(cè)推廣拉人
  • 做網(wǎng)站的工資無(wú)限制訪(fǎng)問(wèn)國(guó)外的瀏覽器
  • 武昌專(zhuān)業(yè)的網(wǎng)絡(luò)推廣團(tuán)隊(duì)seo的特點(diǎn)是什么
  • 要做網(wǎng)站找誰(shuí)幫忙做百度快照客服電話(huà)
  • 網(wǎng)站建設(shè)項(xiàng)目計(jì)劃書(shū)如何寫(xiě)西地那非片能延時(shí)多久
  • 番禺區(qū)網(wǎng)站建設(shè)網(wǎng)絡(luò)營(yíng)銷(xiāo)師官網(wǎng)
  • 邢臺(tái)做網(wǎng)站的價(jià)格究竟多少錢(qián)?網(wǎng)站建設(shè)需求模板
  • JAVA做的小型網(wǎng)站有哪些今天新聞?lì)^條最新消息
  • 企業(yè)免費(fèi)郵箱注冊(cè)申請(qǐng)家庭優(yōu)化大師
  • 白城網(wǎng)站開(kāi)發(fā)為企業(yè)策劃一次網(wǎng)絡(luò)營(yíng)銷(xiāo)活動(dòng)
  • 美食網(wǎng)站建設(shè)畢業(yè)設(shè)計(jì)產(chǎn)品推廣計(jì)劃書(shū)怎么寫(xiě)
  • 外貿(mào)網(wǎng)站建站公司專(zhuān)業(yè)推廣圖片
  • 網(wǎng)站制作公司 番禺網(wǎng)站建設(shè)網(wǎng)絡(luò)營(yíng)銷(xiāo)
  • 營(yíng)口網(wǎng)站建設(shè)做網(wǎng)站seo推廣公司
  • 海珠區(qū)做網(wǎng)站的公司如何讓百度收錄自己的網(wǎng)站信息
  • 創(chuàng)建全國(guó)文明城市我們?cè)谛袆?dòng)繪畫(huà)優(yōu)化seo教程技術(shù)
  • 網(wǎng)站建設(shè)工作流程html互聯(lián)網(wǎng)營(yíng)銷(xiāo)師怎么做
  • 對(duì)網(wǎng)站排名沒(méi)有太大影響的因素網(wǎng)站備案查詢(xún)
  • 免費(fèi)微網(wǎng)站建站系統(tǒng)百度官方認(rèn)證
  • 免費(fèi)創(chuàng)辦網(wǎng)站印度疫情最新消息