From 40f9cafdba963e9be91d17f8b65e429b83a6d072 Mon Sep 17 00:00:00 2001 From: AutoPR Date: Wed, 3 May 2023 06:13:57 +0000 Subject: [PATCH 1/5] =?UTF-8?q?Add=20emojis=20to=20README.md=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 94adc06..e8562d5 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@ -# OpenAI Plugin Node.js Library +# OpenAI Plugin Node.js Library πŸš€ > PROJECT IN EARLY DEVELOPMENT A simple modification in the official OpenAI module that gives the possibility to use plugins that follow the OpenAI standards together with the API. -**Important note: this library is meant for server-side usage only, as using it in client-side browser code will expose your secret API key. [See here](https://platform.openai.com/docs/api-reference/authentication) for more details.** +**Important note: this library is meant for server-side usage only, as using it in client-side browser code will expose your secret API key. [See here](https://platform.openai.com/docs/api-reference/authentication) for more details.** πŸ”’ -## Installation +## Installation πŸ’» ```bash npm install openai-plugin ``` -## Usage +## Usage πŸ“– The library needs to be configured with your account's secret key, which is available on the [website](https://platform.openai.com/account/api-keys). We recommend setting as an environment variable. @@ -28,32 +28,32 @@ import dotenv from "dotenv"; dotenv.config(); const configuration = new Configuration({ - apiKey: process.env.OPENAI_API_KEY, +apiKey: process.env.OPENAI_API_KEY, }); const openai = new OpenAIPluginApi(configuration); (async () => { - var plugins = new Plugins([ - { - name: 'Calculator', - manifest: 'https://chat-calculator-plugin.supportmirage.repl.co/.well-known/ai-plugin.json' - } - ]) - - var completion = await openai.createChatCompletionPlugin({ - model: "gpt-3.5-turbo", - messages: [{role: "user", content: "How much is 3849 x 8394 ?"}], - plugins - }); - - console.log(completion.completions.map(completion => completion.message)); - +var plugins = new Plugins([ +{ +name: 'Calculator', +manifest: 'https://chat-calculator-plugin.supportmirage.repl.co/.well-known/ai-plugin.json' +} +]) + +var completion = await openai.createChatCompletionPlugin({ +model: "gpt-3.5-turbo", +messages: [{role: "user", content: "How much is 3849 x 8394 ?"}], +plugins +}); + +console.log(completion.completions.map(completion => completion.message)); + })(); ``` -Check out the [full API documentation](https://platform.openai.com/docs/api-reference?lang=node.js) for examples of all the available functions. +Check out the [full API documentation](https://platform.openai.com/docs/api-reference?lang=node.js) for examples of all the available functions. πŸ“š -## TODO +## TODO πŸ“ - support to auth - support to all openapi versions - support to predefined variables(like $userId) @@ -62,7 +62,6 @@ Check out the [full API documentation](https://platform.openai.com/docs/api-refe - Fix method in sdk generation - make tamplates and handles more modular - -## Thanks +## Thanks πŸ™ Thank you to [ceifa](https://github.com/ceifa) for creating and maintaining the original unofficial `openai` npm package before we released this official library! ceifa's original package has been renamed to [gpt-x](https://www.npmjs.com/package/gpt-x). From c9078690b061f1b736b74335a372e2db7c442fbd Mon Sep 17 00:00:00 2001 From: AutoPR Date: Wed, 3 May 2023 06:16:08 +0000 Subject: [PATCH 2/5] =?UTF-8?q?Reorganize=20content=20for=20enhanced=20rea?= =?UTF-8?q?dability=20in=20README.md=20=F0=9F=91=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e8562d5..bc470b1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,14 @@ A simple modification in the official OpenAI module that gives the possibility to use plugins that follow the OpenAI standards together with the API. -**Important note: this library is meant for server-side usage only, as using it in client-side browser code will expose your secret API key. [See here](https://platform.openai.com/docs/api-reference/authentication) for more details.** πŸ”’ +πŸ”’ **Important note**: this library is meant for server-side usage only, as using it in client-side browser code will expose your secret API key. [See here](https://platform.openai.com/docs/api-reference/authentication) for more details. + +## πŸ—ΊοΈ Table of Contents + +- [Installation](#installation-πŸ’») +- [Usage](#usage-πŸ“–) +- [TODO](#todo-πŸ“) +- [Thanks](#thanks-πŸ™) ## Installation πŸ’» @@ -17,9 +24,11 @@ npm install openai-plugin The library needs to be configured with your account's secret key, which is available on the [website](https://platform.openai.com/account/api-keys). We recommend setting as an environment variable. Create a `.env` file in the root of your project and add your secret key: + ``` OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx ``` + Here's an example of initializing the library with the API key loaded from an environment variable and creating a completion using a plugin: ```javascript @@ -51,17 +60,18 @@ console.log(completion.completions.map(completion => completion.message)); })(); ``` -Check out the [full API documentation](https://platform.openai.com/docs/api-reference?lang=node.js) for examples of all the available functions. πŸ“š +πŸ“š Check out the [full API documentation](https://platform.openai.com/docs/api-reference?lang=node.js) for examples of all the available functions. ## TODO πŸ“ -- support to auth -- support to all openapi versions -- support to predefined variables(like $userId) -- debug mode -- token management -- Fix method in sdk generation -- make tamplates and handles more modular + +- Support for auth +- Support for all OpenAPI versions +- Support for predefined variables (like $userId) +- Debug mode +- Token management +- Fix method in SDK generation +- Make templates and handles more modular ## Thanks πŸ™ -Thank you to [ceifa](https://github.com/ceifa) for creating and maintaining the original unofficial `openai` npm package before we released this official library! ceifa's original package has been renamed to [gpt-x](https://www.npmjs.com/package/gpt-x). +Thank you to [ceifa](https://github.com/ceifa) for creating and maintaining the original unofficial `openai` npm package before we released this official library! ceifa's original package has been renamed to [gpt-x](https://www.npmjs.com/package/gpt-x). \ No newline at end of file From 7513c94043885f8f7ffe18170ed867e511819e15 Mon Sep 17 00:00:00 2001 From: AutoPR Date: Wed, 3 May 2023 06:16:59 +0000 Subject: [PATCH 3/5] =?UTF-8?q?Remove=20unnecessary=20content=20to=20make?= =?UTF-8?q?=20README.md=20concise=20=F0=9F=93=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index bc470b1..ddcb75a 100644 --- a/README.md +++ b/README.md @@ -61,17 +61,7 @@ console.log(completion.completions.map(completion => completion.message)); ``` πŸ“š Check out the [full API documentation](https://platform.openai.com/docs/api-reference?lang=node.js) for examples of all the available functions. - ## TODO πŸ“ - -- Support for auth -- Support for all OpenAPI versions -- Support for predefined variables (like $userId) -- Debug mode -- Token management -- Fix method in SDK generation -- Make templates and handles more modular - ## Thanks πŸ™ Thank you to [ceifa](https://github.com/ceifa) for creating and maintaining the original unofficial `openai` npm package before we released this official library! ceifa's original package has been renamed to [gpt-x](https://www.npmjs.com/package/gpt-x). \ No newline at end of file From fdac6ef17138b92b84af507c8dcfed643e8f1ed5 Mon Sep 17 00:00:00 2001 From: AutoPR Date: Wed, 3 May 2023 06:17:59 +0000 Subject: [PATCH 4/5] =?UTF-8?q?Add=20a=20Table=20of=20Contents=20to=20READ?= =?UTF-8?q?ME.md=20=F0=9F=97=BA=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 391ba67e334719bf6a848d0aad6e08202a7106b8 Mon Sep 17 00:00:00 2001 From: AutoPR Date: Wed, 3 May 2023 06:18:20 +0000 Subject: [PATCH 5/5] =?UTF-8?q?Double-check=20README.md=20for=20good=20pra?= =?UTF-8?q?ctices=20and=20conventions=20=F0=9F=A7=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit