openAI介绍

76次阅读

本文档转载自

1. 背景

openAi 刚公布出来一两周,世面异常火爆,刚开始的时候 openAi 官网是不用注册账号就可以体验官方的 ChatGPT 聊天机器人,不过现在由于访问量大增,目前官方需要注册账号登录之后才能体验该功能。
根据官方文档的描述,OpenAI API 几乎可以应用于任何涉及理解或生成自然语言或实现代码等场景。提供一系列具有不同学习训练的模型,适用于处理不同的任务,并且自己能够自定义学习模型,通过大样本数据去喂养该模型,使其能实现自己的应用场景。这些模型可用于从内容生成到语义搜索和分类的所有领域。

2. 关键概念

在一个非常简洁的界面上,只要有一个文本输入框,输入你想查询的文本,提交后台后,系统就能根据指定的模型去生成你查询文本相关的上下文内容

类似描述的文本长度限制,要求输入和输出的文本总长度不能超过各模型限定的 Tokens 长度。要记住的一个限制是,您的文本提示和生成的完成组合不能超过模型的最大上下文长度(对于大多数模型,这是 2048 个标记,或大约 1500 个单词)。可以查官方的tokenizer tool,了解有关文本如何转换为分词的更多信息。

模型,官方提供了很多模型集,如下三种

开发人员可以在官网查询模型的详细信息,了解各模型集下面有哪些子模型,基于使用的场景来选择合适的模型。

3. 快速入门

注册成功后,登录个人中心,拿到开发者 API keys 后,就能开始开发对接 openAi 接口

有了上面三个步骤,就可以进行开发自己的小应用了。其他关于 openAi 接口的详细内容,需要访问官方接口文档进一步了解学习

4. 其他说明

  • 目前使用的人数较多,官方每天都在调整策略进行限制,不稳定,搜索时长超过 60s 自动断开并报“Network error”,体验不好
  • 中国区无法正常注册账号访问,需走代理 ip 进行访问,不过注册成功之后可以调 openAi 接口直接访问(不需代理 ip)
  • 根据描述写代码,写出来的代码能跑起来,执行结果也对,但跟预期存在一定偏差,可以用来借鉴编程思路、或基于其代码进行扩展,再或者重新组织准确的描述重新提交让 openAi 再提供一份代码

注册过程较长,用的美国 ip 代理、接码平台选的 google 服务下的美国虚拟卡号码来接收注册账号用的验证码,注册成功之后,api 的调用

  • Q&A —— Answer questions based on existing knowledge.
  • Grammar correction —— Corrects sentences into standard English.
  • Summarize for a 2nd grader —— Translates difficult text into simpler concepts.
  • Natural language to OpenAI API —— Create code to call to the OpenAI API using a natural language instruction.
  • Text to command —— Translate text into programmatic commands.
  • English to other languages —— Translates English text into French, Spanish and Japanese.
  • Natural language to Stripe API —— Create code to call the Stripe API using natural language.
  • SQL translate —— Translate natural language to SQL queries.
  • Parse unstructured data —— Create tables from long form text
  • Classification —— Classify items into categories via example.
  • Python to natural language —— Explain a piece of Python code in human understandable language.
  • Movie to Emoji —— Convert movie titles into emoji.
  • Calculate Time Complexity —— Find the time complexity of a function.
  • Translate programming languages —— Translate from one programming language to another
  • Advanced tweet classifier —— Advanced sentiment detection for a piece of text.
  • Explain code —— Explain a complicated piece of code.
  • Keywords —— Extract keywords from a block of text.
  • Factual answering —— Guide the model towards factual answering by showing it how to respond to questions that fall outside its knowledge base. Using a '?' to indicate a response to words and phrases that it doesn't know provides a natural response that seems to work better than more abstract replies.
  • Ad from product description —— Turn a product description into ad copy.
  • Product name generator —— Create product names from examples words. Influenced by a community prompt.
  • TL;DR summarization —— Summarize text by adding a 'tl;dr:' to the end of a text passage. It shows that the API understands how to perform a number of tasks with no instructions.
  • Python bug fixer —— Find and fix bugs in source code.
  • Spreadsheet creator —— Create spreadsheets of various kinds of data. It's a long prompt but very versatile. Output can be copy+pasted into a text file and saved as a .csv with pipe separators.
  • JavaScript helper chatbot —— Message-style bot that answers JavaScript questions
  • ML/AI language model tutor —— Bot that answers questions about language models
  • Science fiction book list maker —— Create a list of items for a given topic.
  • Tweet classifier —— Basic sentiment detection for a piece of text.
  • Airport code extractor —— Extract airport codes from text.
  • SQL request —— Create simple SQL queries.
  • Extract contact information —— Extract contact information from a block of text.
  • JavaScript to Python —— Convert simple JavaScript expressions into Python.
  • Friend chat —— Emulate a text message conversation.
  • Mood to color —— Turn a text description into a color.
  • Write a Python docstring —— An example of how to create a docstring for a given Python function. We specify the Python version, paste in the code, and then ask within a comment for a docstring, and give a characteristic beginning of a docstring (""").
  • Analogy maker —— Create analogies. Modified from a community prompt to require fewer examples.
  • JavaScript one line function —— Turn a JavaScript function into a one liner.
  • Micro horror story creator —— Creates two to three sentence short horror stories from a topic input.
  • Third-person converter —— Converts first-person POV to the third-person. This is modified from a community prompt to use fewer examples.
  • Notes to summary —— Turn meeting notes into a summary.
  • VR fitness idea generator —— Create ideas for fitness and virtual reality games.
  • ESRB rating —— Categorize text based upon ESRB ratings.
  • Essay outline —— Generate an outline for a research topic.
  • Recipe creator (eat at your own risk) —— Create a recipe from a list of ingredients.
  • Chat —— Open ended conversation with an AI assistant.
  • Marv the sarcastic chat bot —— Marv is a factual chatbot that is also sarcastic.
  • Turn by turn directions —— Convert natural language to turn-by-turn directions.
  • Restaurant review creator —— Turn a few words into a restaurant review.
  • Create study notes —— Provide a topic and get study notes.
  • Interview questions —— Create interview questions.

原文链接:https://zhuanlan.zhihu.com/p/604524454

正文完
 
不知道
版权声明:本站原创文章,由 不知道 2023-08-02发表,共计4500字。
转载说明:声明:本站内容均来自互联网,归原创作者所有,如有侵权必删除。 本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。