- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 openai.ChatCompletion.create
编写了一个 Python 程序来连接 ChatGPT API。我使用的 messages
具有两个角色:user
,用户提示符为 content
,以及加载当前内容的 assistant
传感器数据为 content
,这是我使用 MQTT 从一组传感器获取的。传感器数据是原始的 JSON,但我将其格式化为这样:
Temperature: 22.07 ºC
Humidity: 62.64 %RH
TVOC: 0 ppb
CO2: 400 ppm
PM1: 0 µg/m3
PM2.5: 0 µg/m3
PM10: 1 µg/m3
我的想法是使用清晰的语言询问温度是多少?
和露点是多少?
并期望ChatGPT只给我第一个并计算第二个基于数据中可用的温度和湿度。
我不想训练模型,因为数据不断变化。
有没有办法将传感器数据提供给 ChatGPT API?(我也尝试过使用角色system
,顺便说一句)
最佳答案
好吧,我通过一些尝试和错误设法解决了这个问题:
我的 API 调用如下所示:
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
temperature=0.6,
messages=[
{
"role": "system",
"content": "You are a helful assistant that helps with sensor data as provided (temperatures all in ºC, humidity in %RH, light in lux and cloud base in meters). You can assist with calculating other values based on the sensor data. You can put the sensor data into context.",
},
{"role": "user", "content": prompt},
{"role": "assistant", "content": sensor_data},
],
)
提示
来自HTML输入,例如“干了吗?”
sensor_data
是一个文本字符串,其数据采用平面格式,如下所示:
Temperature: 15.21
Humidity: 82.97
Dew Point: 12.34
Heat Index: 14.96
Wet-Bulb Temperature: 13.27
Cloud Base: 350.38
Cloud Temperature: 11.77
Ambient Light: 30
UV Index: 0.02
对上述问题的回答如下:
Based on the provided data, the humidity is relatively high at 82.97%RH, which suggests that the air contains a significant amount of moisture. However, without additional information, it is difficult to determine if the conditions are considered dry.
sensor_data
变量每 5 秒从 MQTT 服务器更新一次,但可以来自任何地方。
关于openai-api - OpenAI ChatGPT API - 使用传感器数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76946561/
我收到以下错误:模块“openai”没有属性“ChatCompletion” 我检查了其他帖子。都在说升级OpenAI Python包或者升级Python。我都做了,但没有修复它。 Python:3.
我收到以下错误:模块“openai”没有属性“ChatCompletion” 我检查了其他帖子。都在说升级OpenAI Python包或者升级Python。我都做了,但没有修复它。 Python:3.
我有一个用例,非常需要来自 OpenAI API 的完全确定性响应。然而,玩弄温度似乎无法产生完全的决定论。 import openai openai.organization = "org-..."
OpenAI api 包含一个微调服务,将任务分为“提示”和“完成” https://platform.openai.com/docs/guides/fine-tuning 文档说准确度指标是根据完成
我通过openai的text-davinci-003可以正常返回对话信息,但是目前无法实现上下文关联功能。我搜索了一下,发现有一个“conversation_id”参数,但是添加该参数后,API返回“
我有一个用例,非常需要来自 OpenAI API 的完全确定性响应。然而,玩弄温度似乎无法产生完全的决定论。 import openai openai.organization = "org-..."
OpenAI api 包含一个微调服务,将任务分为“提示”和“完成” https://platform.openai.com/docs/guides/fine-tuning 文档说准确度指标是根据完成
我通过openai的text-davinci-003可以正常返回对话信息,但是目前无法实现上下文关联功能。我搜索了一下,发现有一个“conversation_id”参数,但是添加该参数后,API返回“
我想使用 openai.embeddings_utils import get_embeddings所以已经安装了openai Name: openai Version: 0.26.5 Summary
当我使用 GPT3 的 playground 时,我经常得到带有编号列表和段落格式的结果,如下所示: Here's what the above class is doing: 1. It creat
当我使用 GPT3 的 playground 时,我经常得到带有编号列表和段落格式的结果,如下所示: Here's what the above class is doing: 1. It creat
我想使用 openai.embeddings_utils import get_embeddings所以已经安装了openai Name: openai Version: 0.26.5 Summary
OpenAI/chat GPT也支持docx/pdf文件上传吗?。我想上传多个文件到openAI/chatGPT。我在https://platform.openai.com/docs/api-refe
openAI/chatGPT也支持docx/pdf文件上传吗? 我想上传多个文件到 openAI/chatGPT。我尝试了 https://platform.openai.com/docs/api-r
openAI/chatGPT也支持docx/pdf文件上传吗? 我想上传多个文件到 openAI/chatGPT。我尝试了 https://platform.openai.com/docs/api-r
如果我们查看环境的预览,它们会在右下角的动画中显示剧集的增加。 https://gym.openai.com/envs/CartPole-v1/ .是否有明确显示的命令? 最佳答案 我认为 Ope
是否有人从使用 text-embedding-ada-002 的 Azure OpenAI 嵌入部署中获得的结果与 OpenAI 的结果不同?相同的文本,相同的模型,结果在向量空间中相差相当远。 对于
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
我正在学习gpt微调 我成功运行了这个命令:pip install --upgrade openai 我无法运行此命令:export OPENAI_API_KEY="sk-xxxxxxxxxxxxxx
如何解决Openai API 不断输出的问题,比如让gpt api 写一篇文章。如果内容中断,可以继续提问,从而继续输出以上内容。这在ChatGPT中很容易做到,但是Openai API加上上面的提示
我是一名优秀的程序员,十分优秀!