OpenAI (Independent Publisher) (#1583)
* Created folder and required files for the OpenAI independent connector * Updated OpenAI json definitions * Deleted the "engines" action, because it wasn't useful at all and changed the "logprobs" description in the response * Changed response from default to 200 and added description * Changed the "Best_of" description * Renamed file to "apiDefinition.swagger.json"
This commit is contained in:
Родитель
1de3ca6c63
Коммит
dd000d9216
|
@ -0,0 +1,34 @@
|
|||
# OpenAI
|
||||
|
||||
OpenAI is an artificial intelligence research laboratory. The company conducts research in the field of AI with the stated goal of promoting and developing friendly AI in a way that benefits humanity as a whole.
|
||||
Through this connector you can access the Generative Pre-trained Transformer 3 (GPT-3), an autoregressive language model that uses deep learning to produce human-like text.
|
||||
|
||||
## Publisher: Robin Rosengrün | R2Power
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You need an OpenAI account and available tokens. The account comes with a 3 month trial and enough tokens for testing the service.
|
||||
|
||||
## Supported Operations
|
||||
|
||||
The connector supports the following operations:
|
||||
|
||||
- `List engines`: This action will return all available GPT-3 engines.
|
||||
- `Completion`: This action will complete your prompt and is the main action you will use.
|
||||
|
||||
## Obtaining Credentials
|
||||
|
||||
In your account you can create an API key [here](https://beta.openai.com/account/api-keys)
|
||||
|
||||
## API Documentation
|
||||
|
||||
Visit [the OpenAI documentation page](https://beta.openai.com/docs/api-reference/introduction) for further details.
|
||||
|
||||
## Known issues and limitations
|
||||
|
||||
When entering your API key in the Power Platform, you need to type it as: "Bearer YOUR_API_KEY" (the word "Bearer" a blank and the actual API_KEY)
|
||||
Only the "Completion" action is supported right now, feel free to add other actions.
|
||||
|
||||
## Deployment Instructions
|
||||
|
||||
When entering your API key in the Power Platform, you need to type it as: "Bearer YOUR_API_KEY" (the word "Bearer" a blank and the actual API_KEY)
|
|
@ -0,0 +1,213 @@
|
|||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "OpenAI",
|
||||
"description": "Connect to the OpenAI API and use the Power of GPT3, API key must be entered as \"Bearer YOUR_API_KEY\"",
|
||||
"version": "1.0"
|
||||
},
|
||||
"host": "api.openai.com",
|
||||
"basePath": "/",
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"consumes": [],
|
||||
"produces": [],
|
||||
"paths": {
|
||||
"/v1/engines/{engine}/completions": {
|
||||
"post": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "GPT3 completed your prompt",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "id"
|
||||
},
|
||||
"object": {
|
||||
"type": "string",
|
||||
"description": "object"
|
||||
},
|
||||
"created": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "created"
|
||||
},
|
||||
"model": {
|
||||
"type": "string",
|
||||
"description": "Which GPT3 Engine was used",
|
||||
"title": "Model",
|
||||
"x-ms-visibility": "internal"
|
||||
},
|
||||
"choices": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"text": {
|
||||
"type": "string",
|
||||
"description": "Completion text",
|
||||
"title": "Text"
|
||||
},
|
||||
"index": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "Number of completion",
|
||||
"title": "Index"
|
||||
},
|
||||
"logprobs": {
|
||||
"type": "string",
|
||||
"description": "Include the log probabilities on the logprobs most likely tokens, as well the chosen tokens. For example, if logprobs is 3, the API will return a list of the 3 most likely tokens.",
|
||||
"title": "Logprobs"
|
||||
},
|
||||
"finish_reason": {
|
||||
"title": "Finish reason",
|
||||
"type": "string",
|
||||
"description": "Reason why the text finished (stop condition / natural end / length)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Returned Completion(s)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"summary": "GPT3 Completes your prompt",
|
||||
"description": "GPT3 Completes your prompt",
|
||||
"operationId": "Completion",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "engine",
|
||||
"in": "path",
|
||||
"type": "string",
|
||||
"description": "The used engine, choose between text-davinci-002, text-curie-001, text-babbage-001, text-ada-001",
|
||||
"required": true,
|
||||
"default": "text-davinci-002",
|
||||
"x-ms-visibility": "important",
|
||||
"x-ms-summary": "Engine",
|
||||
"enum": [
|
||||
"text-davinci-002",
|
||||
"text-curie-001",
|
||||
"text-babbage-001",
|
||||
"text-ada-001"
|
||||
],
|
||||
"x-ms-enum-values": [
|
||||
{
|
||||
"displayName": "DaVinci - most expensive",
|
||||
"value": "text-davinci-002"
|
||||
},
|
||||
{
|
||||
"displayName": "Curie",
|
||||
"value": "text-curie-001"
|
||||
},
|
||||
{
|
||||
"displayName": "Babbage",
|
||||
"value": "text-babbage-001"
|
||||
},
|
||||
{
|
||||
"displayName": "Ada - cheapest",
|
||||
"value": "text-ada-001"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"prompt": {
|
||||
"type": "string",
|
||||
"description": "Text that will be completed by GPT3",
|
||||
"title": "prompt",
|
||||
"default": "What is your favorite animal and why? Tell me also about the size and weight of this animal."
|
||||
},
|
||||
"n": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "How many completions to generate for each prompt",
|
||||
"default": 1
|
||||
},
|
||||
"best_of": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "If set to more than 1, generates multiple completions server-side and returns the \"best\". Must be greater than \"n\". Use with caution, can consume a lot of tokens.",
|
||||
"default": 1
|
||||
},
|
||||
"temperature": {
|
||||
"type": "number",
|
||||
"format": "float",
|
||||
"description": "Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. Use this OR top p",
|
||||
"title": "temperature",
|
||||
"default": 1
|
||||
},
|
||||
"max_tokens": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "One token equals roughly 4 characters of text (up to 4000 tokens between prompt and completion)",
|
||||
"title": "max tokens",
|
||||
"default": 100
|
||||
},
|
||||
"top_p": {
|
||||
"type": "number",
|
||||
"format": "float",
|
||||
"description": "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.",
|
||||
"title": "top p"
|
||||
},
|
||||
"frequency_penalty": {
|
||||
"type": "number",
|
||||
"format": "float",
|
||||
"description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the models likelihood to repeat the same line verbatim.",
|
||||
"title": "frequency penalty",
|
||||
"default": 0
|
||||
},
|
||||
"presence_penalty": {
|
||||
"type": "number",
|
||||
"format": "float",
|
||||
"description": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the models likelihood to talk about new topics.",
|
||||
"title": "presence penalty",
|
||||
"default": 0
|
||||
},
|
||||
"user": {
|
||||
"type": "string",
|
||||
"title": "user",
|
||||
"description": "A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse"
|
||||
},
|
||||
"stop": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"prompt"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"x-ms-visibility": "important"
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {},
|
||||
"parameters": {},
|
||||
"responses": {},
|
||||
"securityDefinitions": {
|
||||
"API Key": {
|
||||
"type": "apiKey",
|
||||
"in": "header",
|
||||
"name": "Authorization"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"API Key": []
|
||||
}
|
||||
],
|
||||
"tags": []
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"properties": {
|
||||
"connectionParameters": {
|
||||
"api_key": {
|
||||
"type": "securestring",
|
||||
"uiDefinition": {
|
||||
"displayName": "API Key",
|
||||
"description": "Enter API Key as as \"Bearer YOUR_API_KEY\"",
|
||||
"tooltip": "Provide your API Key",
|
||||
"constraints": {
|
||||
"tabIndex": 2,
|
||||
"clearText": false,
|
||||
"required": "true"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"iconBrandColor": "#da3b01",
|
||||
"capabilities": [],
|
||||
"publisher": "Robin Rosengrün",
|
||||
"stackOwner": "OpenAI"
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче