-
Notifications
You must be signed in to change notification settings - Fork 1.4k
OpenAI (Independent Publisher) #1583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cc6e5f1
Created folder and required files for the OpenAI independent connector
PowerRobin ac34f9e
Updated OpenAI json definitions
PowerRobin 2b76677
Deleted the "engines" action, because it wasn't useful at all and cha…
PowerRobin 0e250ad
Changed response from default to 200 and added description
PowerRobin 405929c
Changed the "Best_of" description
PowerRobin 83f07f6
Renamed file to "apiDefinition.swagger.json"
PowerRobin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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) |
213 changes: 213 additions & 0 deletions
213
independent-publisher-connectors/OpenAI/apiDefinition.swagger.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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": [] | ||
| } | ||
23 changes: 23 additions & 0 deletions
23
independent-publisher-connectors/OpenAI/apiProperties.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @PowerRobin,
I hope you are doing well.
Can you please add the Contact section? Please see below.
"contact": {
"name": "Your Name",
"url": "Your URL/ Connector/ api URL",
"email": "Your email address"
}
We have a weekly connector telemetry report for our independent publishers. To start getting this report, please add your email in the swagger file and submit a quick update.
Please let me know if you have any questions.
Thank you so much for you hard work with us.
Best regards,
Amjed Ayoub