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

罗岗网站建设国外网站

罗岗网站建设,国外网站,建设网站公司不给源代码,上海房产网签合同查询众所周知,ChatGPT 目前能够取得令人印象深刻的壮举。 很可能许多人都有在他们自己的项目中使用该技术的想法。 不过需要注意的是,ChatGPT 目前并没有官方的 API。 使用非官方 API 可能会导致困难。 目前需要手动获取access token和cloudflare token才能…

众所周知,ChatGPT 目前能够取得令人印象深刻的壮举。 很可能许多人都有在他们自己的项目中使用该技术的想法。 不过需要注意的是,ChatGPT 目前并没有官方的 API。 使用非官方 API 可能会导致困难。

目前需要手动获取access token和cloudflare token才能使用API。 此外,这些令牌必须每两小时手动更改一次。

在这里插入图片描述
推荐:使用 NSDT场景设计器 快速搭建 3D场景。

1、ChatGPT

ChatGPT 在其设计中使用了 GPT-3 模型,并在此基础上开发了一个新模型。 因此,新模型的输出结果往往与 GPT-3 相似。 在撰写本文时,新模型的 ChatGPT 中使用了 text-davinci-002-render 模型,但目前尚未向公众开放。

虽然 ChatGPT 可能不是开创性的,但它提供了一个利用现有技术的新界面。 通过利用强大的提示和高效的记忆窗口。 因此,我们可以使用 LLM Chain 方法复制其功能,而不是破解 ChatGPT 的非官方 API。

2、LangChain

Langchain 是一个新的 python 包,它为LLM链提供了一个标准接口,与其他工具的大量集成,以及用于常见应用程序的端到端链。

LangChain 旨在协助四个主要领域,此处按复杂性递增的顺序列出:

  • LLM和提示
  • LLM链
  • 代理
  • 记忆

在此处的官方文档中了解有关 langchain 的更多信息。

3、安装

要使用 langchain 包,你可以从 pypi 安装它。

pip install langchain

要从 langchain 获取最新更新,你可以使用这种安装方法。

pip install "git+https://github.com/hwchase17/langchain.git"

更多安装选项请阅读此处。

4、示例项目

你可以使用 ChatGPT 做很多事情,其中一个有趣的事情是为学生作业建立问答。 所以这次我们将创建 AI 版的 Brainly。

下面是我们将从 ChatGPT 中得到的。
在这里插入图片描述

下面是 langchain 的提示:

from langchain.llms import OpenAI
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate
from langchain.chains import SimpleSequentialChainllm = OpenAI(temperature=.7)
template = """You are a teacher in physics for High School student. Given the text of question, it is your job to write a answer that question with example.
Question: {text}
Answer:
"""
prompt_template = PromptTemplate(input_variables=["text"], template=template)
answer_chain = LLMChain(llm=llm, prompt=prompt_template)
answer = answer_chain.run("What is the formula for Gravitational Potential Energy (GPE)?")
print(answer)

这是我们使用 langchain 从 GPT-3 获得的结果:

The formula for Gravitational Potential Energy (GPE) is GPE = mgh, where m is the mass of an object, g is the acceleration due to gravity, and h is the height of the object. For example, if an object with a mass of 10 kg is at a height of 5 meters, then the GPE would be GPE = 10 x 9.8 x 5 = 490 Joules.

5、聊天机器人

如果你需要创建像 AI 这样的聊天机器人,你可以使用 langchain 的内存。 这是如何操作的示例。

from langchain.chains.conversation.memory import ConversationBufferMemory
from langchain import OpenAI, LLMChain, PromptTemplatetemplate = """You are a teacher in physics for High School student. Given the text of question, it is your job to write a answer that question with example.
{chat_history}
Human: {question}
AI:
"""
prompt_template = PromptTemplate(input_variables=["chat_history","question"], template=template)
memory = ConversationBufferMemory(memory_key="chat_history")llm_chain = LLMChain(llm=OpenAI(),prompt=prompt_template,verbose=True,memory=memory,
)llm_chain.predict(question="What is the formula for Gravitational Potential Energy (GPE)?")result = llm_chain.predict(question="What is Joules?")
print(result)

结果会是这样的:

$ python3 memory.py> Entering new LLMChain chain...
Prompt after formatting:
You are a teacher in physics for High School student. Given the text of question, it is your job to write a answer that question with example.Human: What is the formula for Gravitational Potential Energy (GPE)?
AI:> Finished LLMChain chain.> Entering new LLMChain chain...
Prompt after formatting:
You are a teacher in physics for High School student. Given the text of question, it is your job to write a answer that question with example.Human: What is the formula for Gravitational Potential Energy (GPE)?
AI: 
The formula for Gravitational Potential Energy (GPE) is GPE = mgh, where m is the mass of the object, g is the acceleration due to gravity, and h is the height of the object.For example, if an object has a mass of 10 kg and is at a height of 5 meters, then the gravitational potential energy of the object is GPE = 10 kg x 9.8 m/s2 x 5 m = 490 Joules.
Human: What is Joules?
AI:> Finished LLMChain chain.
Joules (J) is the SI unit of energy. It is defined as the amount of energy required to move an object of one kilogram at a speed of one meter per second. It is also equal to the work done when a force of one Newton is applied to an object and moved one meter in the direction of the force.

6、结束语

ChatGPT 是一个基于 GPT-3 的聊天机器人,目前没有官方 API。 使用 LangChain,开发人员可以复制 ChatGPT 的功能,例如创建聊天机器人或问答系统,而无需使用非官方 API。

LangChain 为常见应用程序提供标准接口、大量集成和端到端链。 它可以从 pypi 安装,更多信息可以在官方文档中找到。


原文链接:制作自己的ChatGPT — BimAnt

http://www.dtcms.com/wzjs/90312.html

相关文章:

  • 网站如何申请微信支付发帖推广哪个平台好
  • 域名有了怎么建网站网站建设模板
  • 网站怎么做h5支付网站怎样优化seo
  • 哈尔滨市建设局网站seo入门黑帽培训教程
  • 温州网站建设推广百度收录网站链接入口
  • 网站建设及那个科目电脑零基础培训学校
  • 网站建设从零开始青岛seo
  • 做婚恋网站多少钱怎么建网站卖东西
  • web网站开发毕业设计品牌推广软文案例
  • 江门建站模板搭建北仑seo排名优化技术
  • 怎么查看网站解析友情链接交换方式有哪些
  • 做家政服务类网站的要求百度推广客服
  • 门户网站建设与开发友链交换平台源码
  • 长沙企业网站建设收费在线培训课程
  • 网站建设 logo沪深300指数怎么买
  • 网站开发后如何上线搜索引擎优化的步骤
  • 知名网站建设平台网址查询地址查询
  • 如何做好企业网站的推广灯塔网站seo
  • 网络营销导向的网站建设5118网站查询
  • 网站域名过期后续费多长时间生效长春网络营销公司
  • 做网站改变图片位置百度sem优化师
  • 邱县网站建设吉安seo
  • 阿里巴巴上怎样做自己的网站佛山做优化的网络公司
  • 禅城区企业网站建设百度推广费用可以退吗
  • 谭八爷网站开发搜索关键词排名推广
  • 网站建设及报价格方案北京网站托管
  • 工会网站建设管理工作总结厦门seo结算
  • 苹果电脑做网站郑州关键词优化费用
  • 新疆建设兵团第一师网站如何制作个人网站
  • 企业网站建设的公司有哪些电脑培训学校在哪里