chatgpt API扫盲贴

2024-05-31 22:04
文章标签 chatgpt ai api 扫盲

本文主要是介绍chatgpt API扫盲贴,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

temperature 是什么?

温度(Temperature)是一个介于 0 和 1 之间的值,基本上可以让你控制模型在进行这些预测时的置信度。降低温度(Temperature)意味着它将承担更少的风险,并且完成将更加准确和确定。提高温度(Temperature)将导致更多样化的完成。

token 限制?

在给定的 API 请求中处理的 Token 数量取决于您的输入和输出长度。对于英文文本,1 个Token大约相当于 4 个字符或 0.75 个单词。要记住的一个限制是,您的文本提示词和生成的补全合起来不能超过模型的最大上下文长度(对于大多数模型,这是 2048 个 Token,或大约 1500 个单词)。

官方提示词

语法更正:You will be provided with statements, and your task is to convert them to standard English.

解释复杂代码:You will be provided with a piece of code, and your task is to explain it in a concise way.

计算代码的时间复杂度:You will be provided with Python code, and your task is to calculate its time complexity.

从非结构化文本创建表格:You will be provided with unstructured data, and your task is to parse it into CSV format.

提取关键字:You will be provided with a block of text, and your task is to extract a list of keywords from it.

产品名称生成器:You will be provided with a product description and seed words, and your task is to generate product names.

创建面试问题:Create a list of 8 questions for an interview with a science fiction author.

像苏格拉底一样回复学生:

You are a Socratic tutor. Use the following principles in responding to students:

- Ask thought-provoking, open-ended questions that challenge students' preconceptions and encourage them to engage in deeper reflection and critical thinking.
- Facilitate open and respectful dialogue among students, creating an environment where diverse viewpoints are valued and students feel comfortable sharing their ideas.
- Actively listen to students' responses, paying careful attention to their underlying thought processes and making a genuine effort to understand their perspectives.
- Guide students in their exploration of topics by encouraging them to discover answers independently, rather than providing direct answers, to enhance their reasoning and analytical skills.
- Promote critical thinking by encouraging students to question assumptions, evaluate evidence, and consider alternative viewpoints in order to arrive at well-reasoned conclusions.
- Demonstrate humility by acknowledging your own limitations and uncertainties, modeling a growth mindset and exemplifying the value of lifelong learning.

将自然语言转换为 SQL 查询:

Given the following SQL tables, your job is to write queries given a user’s request.

CREATE TABLE Orders (OrderID int,CustomerID int,OrderDate datetime,OrderTime varchar(8),PRIMARY KEY (OrderID)
);CREATE TABLE OrderDetails (OrderDetailID int,OrderID int,ProductID int,Quantity int,PRIMARY KEY (OrderDetailID)
);CREATE TABLE Products (ProductID int,ProductName varchar(50),Category varchar(50),UnitPrice decimal(10, 2),Stock int,PRIMARY KEY (ProductID)
);CREATE TABLE Customers (CustomerID int,FirstName varchar(50),LastName varchar(50),Email varchar(100),Phone varchar(20),PRIMARY KEY (CustomerID)
);

总结会议记录,包括总体讨论、行动项目和未来主题:

You will be provided with meeting notes, and your task is to summarize the meeting as follows:

-Overall summary of discussion
-Action items (what needs to be done and who is doing it)
-If applicable, a list of topics that need to be discussed more fully in the next meeting.

分析给定主题的优缺点:Analyze the pros and cons of remote work vs. office work。

chat Completitions API 调用示例:

from openai import OpenAI
client = OpenAI()response = client.chat.completions.create(model="gpt-3.5-turbo",messages=[{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Who won the world series in 2020?"},{"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},{"role": "user", "content": "Where was it played?"}]
)
  • 主要输入是 messages 参数。消息必须是消息对象的数组,其中每个对象都有一个角色(“系统”、“用户”或“助手”)和内容。对话可以短至一条消息,也可以是多次来回切换。
  • 通常,对话的格式首先使用系统消息,然后是交替的用户和助手消息。
  • 系统消息有助于设置助手的行为。例如,您可以修改助手的个性,或提供有关其在整个对话中应如何表现的具体说明。但是,请注意,系统消息是可选的,没有系统消息的模型的行为可能类似于使用通用消息,例如“你是一个有用的助手”。
  • -用户消息提供请求或评论,供助手响应。助理消息存储以前的助理回复,但也可以由您编写,以提供所需行为的示例

这篇关于chatgpt API扫盲贴的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1019155

相关文章

基于Flask框架添加多个AI模型的API并进行交互

《基于Flask框架添加多个AI模型的API并进行交互》:本文主要介绍如何基于Flask框架开发AI模型API管理系统,允许用户添加、删除不同AI模型的API密钥,感兴趣的可以了解下... 目录1. 概述2. 后端代码说明2.1 依赖库导入2.2 应用初始化2.3 API 存储字典2.4 路由函数2.5 应

Spring AI ectorStore的使用流程

《SpringAIectorStore的使用流程》SpringAI中的VectorStore是一种用于存储和检索高维向量数据的数据库或存储解决方案,它在AI应用中发挥着至关重要的作用,本文给大家介... 目录一、VectorStore的基本概念二、VectorStore的核心接口三、VectorStore的

Spring AI集成DeepSeek三步搞定Java智能应用的详细过程

《SpringAI集成DeepSeek三步搞定Java智能应用的详细过程》本文介绍了如何使用SpringAI集成DeepSeek,一个国内顶尖的多模态大模型,SpringAI提供了一套统一的接口,简... 目录DeepSeek 介绍Spring AI 是什么?Spring AI 的主要功能包括1、环境准备2

Spring AI集成DeepSeek实现流式输出的操作方法

《SpringAI集成DeepSeek实现流式输出的操作方法》本文介绍了如何在SpringBoot中使用Sse(Server-SentEvents)技术实现流式输出,后端使用SpringMVC中的S... 目录一、后端代码二、前端代码三、运行项目小天有话说题外话参考资料前面一篇文章我们实现了《Spring

Spring AI与DeepSeek实战一之快速打造智能对话应用

《SpringAI与DeepSeek实战一之快速打造智能对话应用》本文详细介绍了如何通过SpringAI框架集成DeepSeek大模型,实现普通对话和流式对话功能,步骤包括申请API-KEY、项目搭... 目录一、概述二、申请DeepSeek的API-KEY三、项目搭建3.1. 开发环境要求3.2. mav

C#集成DeepSeek模型实现AI私有化的流程步骤(本地部署与API调用教程)

《C#集成DeepSeek模型实现AI私有化的流程步骤(本地部署与API调用教程)》本文主要介绍了C#集成DeepSeek模型实现AI私有化的方法,包括搭建基础环境,如安装Ollama和下载DeepS... 目录前言搭建基础环境1、安装 Ollama2、下载 DeepSeek R1 模型客户端 ChatBo

Java调用DeepSeek API的最佳实践及详细代码示例

《Java调用DeepSeekAPI的最佳实践及详细代码示例》:本文主要介绍如何使用Java调用DeepSeekAPI,包括获取API密钥、添加HTTP客户端依赖、创建HTTP请求、处理响应、... 目录1. 获取API密钥2. 添加HTTP客户端依赖3. 创建HTTP请求4. 处理响应5. 错误处理6.

Spring AI集成DeepSeek的详细步骤

《SpringAI集成DeepSeek的详细步骤》DeepSeek作为一款卓越的国产AI模型,越来越多的公司考虑在自己的应用中集成,对于Java应用来说,我们可以借助SpringAI集成DeepSe... 目录DeepSeek 介绍Spring AI 是什么?1、环境准备2、构建项目2.1、pom依赖2.2

Deepseek R1模型本地化部署+API接口调用详细教程(释放AI生产力)

《DeepseekR1模型本地化部署+API接口调用详细教程(释放AI生产力)》本文介绍了本地部署DeepSeekR1模型和通过API调用将其集成到VSCode中的过程,作者详细步骤展示了如何下载和... 目录前言一、deepseek R1模型与chatGPT o1系列模型对比二、本地部署步骤1.安装oll

浅析如何使用Swagger生成带权限控制的API文档

《浅析如何使用Swagger生成带权限控制的API文档》当涉及到权限控制时,如何生成既安全又详细的API文档就成了一个关键问题,所以这篇文章小编就来和大家好好聊聊如何用Swagger来生成带有... 目录准备工作配置 Swagger权限控制给 API 加上权限注解查看文档注意事项在咱们的开发工作里,API