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

python openai playground使用教程

文章目录

        • playground介绍
        • Playground特点
        • 模型设置和参数选择
          • 四种语言模型介绍
        • playground应用
        • 构建自己的playground应用
        • playground python使用

playground介绍

OpenAI Playground是一个基于Web的工具,旨在帮助开发人员测试和尝试OpenAI的语言模型,如GPT-3。通过Playground,用户可以在不编写任何代码的情况下与AI模型进行交互,并了解其工作原理。

在这里插入图片描述

playground地址:https://platform.openai.com/playground

Playground特点
  • 灵活性:Playground提供一个交互式界面,以便用户自定义输入和修改模型参数。
  • 定制性:用户可以根据自己的需求选择不同的语言模型和模型设置,以满足特定的应用场景。
  • 易用性:Playground的用户界面简洁直观,无需编写复杂的代码,即可快速上手和进行实验
模型设置和参数选择

Web界面分为左中右三部分

  • 左侧:System,You are a helpful assistant.(定义gpt模型的角色)
  • 中间:USER,Enter a user meaasge here.(输入想问的问题,或者想要补全的句子),submit即可产出回答。
  • 右侧:模型设置和参数选择
    • Mode:模式选择,chat、Complete and Edit。
    • Model:turbo、davinci、curie、babbage、ada。
    • Temperature:介于0-1之间,越接近1,模型生成的回答越有不确定性(创造性),越接近0,模型的答案越确定。
      在这里插入图片描述
四种语言模型介绍
  • AdaAda是一种基础模型,适合用于提示和短对话。
  • BabbageBabbage是一个中等规模的模型,适合于更长的对话和创造性写作。
  • CurieCurie是一个大型模型,适用于复杂的对话和生成性任务。
  • DavinciDavinciOpenAI提供的最先进的语言模型,适合处理长篇大论、技术文档和创造性写作等。
playground应用

examples:https://platform.openai.com/examples

OpenAI官网的examples中提供了许多有用的示例,可以了解OpenAI的使用。

  • Emoji Translation(一个表情包翻译器)
    作用是将文字转为emoji

  • 设置Prompt
  • SYSTEM:You will be provided with text, and your task is to translate it into emojis. Do not use any regular text. Do your best with emojis only.
  • USER:Artificial intelligence is a technology with great promise.
  • Open in playground
    在这里插入图片描述
    点击submit即可生成对应的转化结果。
构建自己的playground应用
  • 定义System
  • 定义user
  • 点击submit输出结果
  • 右上角点击”Save"保存
    在这里插入图片描述
  • Save preset
    This will save the current Playground state as a preset which you can access later or share with others.
  • 点击 Your presets,即可看到自己的playground列表
    在这里插入图片描述
playground python使用

一个情感分析playground
在这里插入图片描述

  • 点击View code
    You can use the following code to start integrating your current prompt and settings into your application.
  • copy复制python代码
    在这里插入图片描述
  • 本地python中使用
    question:“To be or not to be, this is a question.”
    response:
{"id": "chatcmpl-89lIKZt8UG1aVVBkB9Wo3ECiPoZ9M","object": "chat.completion","created": 1697337444,"model": "gpt-3.5-turbo-0613","choices": [{"index": 0,"message": {"role": "assistant","content": "Sentiment: NEUTRAL\nProbability: 0.50"},"finish_reason": "stop"}],"usage": {"prompt_tokens": 130,"completion_tokens": 13,"total_tokens": 143}
}

包含rolecontenttotal_tokens等完整输出。

可见的是这种方法相当消耗tokenmoney),因此之后我们会选择微调fine-tuning的形式,OpenAI也已经提供了简便的微调方式。

http://www.lryc.cn/news/193285.html

相关文章:

  • DOCKER本地仓库
  • python写着玩
  • K8s Kubernetes Namespave Pod Label Deployment Service 实战
  • SpringBoot使用随机端口启动
  • NewStarCTF2023week2-ez_sql
  • 力扣-434.字符串中的单词数
  • 【ALO-BP预测】基于蚁狮算法优化BP神经网络回归预测研究(Matlab代码实现)
  • 分布式存储系统Ceph应用详解
  • 人工智能轨道交通行业周刊-第63期(2023.10.9-10.15)
  • OJ项目——统一数据格式返回,我是如何处理的?
  • Open CV 3D Python 环境搭建
  • C#中lock 和 ReaderWriterLock 的使用总结
  • Mac下通过nvm管理node
  • 易点易动固定资产管理系统:RFID出入监控,保障固定资产安全
  • Vue封装组件并发布到npm仓库
  • python+深度学习+opencv实现植物识别算法系统 计算机竞赛
  • 基于springboot实现医院急诊平台系统项目【项目源码】
  • 【02】基础知识:React - jsx语法规则
  • C语言 —— 指针
  • 淘宝店铺所有商品数据接口,淘宝整店所有商品数据接口,淘宝店铺商品接口,淘宝API接口
  • 【Redis】Java客户端使用zset命令
  • 记录一个@Transaction注解引发的bug
  • 解决docker使用pandarallel报错OSError: [Errno 28] No space left on device
  • Javascript自定义页面复制事件
  • Nginx:反向代理(示意图+配置)
  • macbook笔记本电脑内存怎么清理才能干净流畅?
  • spark 与 mapreduce 对比
  • kafka 相关概念
  • Ubuntu下vscode配置OpenCV以及Libtorch
  • 关于共识算法Raft的常见误解