Skip to content

Commit

Permalink
added: more snippets, readme, changelog, license, gifs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesparzarom committed May 26, 2023
1 parent 36d2c39 commit 067ae51
Show file tree
Hide file tree
Showing 12 changed files with 661 additions and 194 deletions.
21 changes: 17 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# Change Log

All notable changes to the "py-gpt-turbo3-fragments" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
All notable changes to the "OpenAIPy Fragments" extension will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

- Initial release
- Initial release of OpenAIPy Fragments

## [1.0.0] - 2023-05-26

### Added

- Added the initial list of snippets for triggers and fragments.
- Included snippets for text in the OpenAI Python library.

### Future Additions (Pending)

- Will add snippets for working with images in the OpenAI Python library.
- Will add snippets for working with audio in the OpenAI Python library.
- More snippets related to other functionalities of the OpenAI Python library will be included.

Stay tuned for upcoming updates!
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Preamble:

This license governs the distribution and modification of the "OpenAIPy Fragments" project, including its associated snippets for Visual Studio Code.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION, AND MODIFICATION:

1. You are granted the freedom to use, copy, modify, and distribute the "OpenAIPy Fragments" project and its snippets, whether in source code or compiled form, for any purpose.

2. If you modify the "OpenAIPy Fragments" project, you must make the modified source code available under the terms of this license. Additionally, you must clearly indicate the modifications made, including the date and author of each modification.

3. If you distribute the "OpenAIPy Fragments" project or its snippets, whether in source code or compiled form, you must include a copy of this license with the distribution. You must also include the original copyright notice and a notice that states any changes made to the project.

4. Any derived work based on the "OpenAIPy Fragments" project must be distributed under the terms of this license. This includes snippets or extensions that incorporate or build upon the original "OpenAIPy Fragments" snippets.

5. The "OpenAIPy Fragments" project is provided "as is," without warranty of any kind. The authors or copyright holders of the project shall not be liable for any claim, damages, or other liability arising from the use, distribution, or modification of the project.

For more details about the GNU General Public License, please refer to the full text of the license at https://www.gnu.org/licenses/gpl-3.0.en.html.

219 changes: 184 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,214 @@
# py-gpt-turbo3-fragments README
# OpenAIPy Fragments

This is the README for your extension "py-gpt-turbo3-fragments". After writing up a brief description, we recommend including the following sections.
<!-- ![Versión](https://img.shields.io/visual-studio-marketplace/v/{publisher}.{extension-id}?color=green&style=flat)
![Descargas](https://img.shields.io/visual-studio-marketplace/d/{publisher}.{extension-id}?color=blue&style=flat)
![Instalaciones](https://img.shields.io/visual-studio-marketplace/i/{publisher}.{extension-id}?color=blue&style=flat) -->
![OpenAIPy](https://img.shields.io/badge/OpenAIPy-4D8FFD?style=square)
[![Python](https://img.shields.io/badge/Python-3776AB?style=flat&logo=python&logoColor=white)](https://www.python.org/)
[![OpenAI](https://img.shields.io/badge/OpenAI-FF66C4?style=flat)](https://openai.com/)

## Features

Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.

For example if there is an image subfolder under your extension project workspace:

\!\[feature X\]\(images/feature-x.png\)

> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
This is the README for the OpenAIPy Fragments extension, which provides helpful code snippets for developing with the OpenAI library.

## Requirements
# Usage
## ✨ Features

If you have any requirements or dependencies, add a section describing those and how to install and configure them.
OpenAIPy Fragments offers the following features:

## Extension Settings
- Code snippets to assist with OpenAI library development.
- Improved productivity and efficiency when working with the OpenAI library.
- Integration with Visual Studio Code for a seamless development experience.

Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.

For example:
## 📝 Shortcuts

This extension contributes the following settings:
### **◼ Setup import**
- `"setup basic"` - Imports the OpenAI library only.
- `"setup dotenv"` - Imports the OpenAI library, gets the API_KEY from the .env file.
- `"setup org"` - Imports the OpenAI library, gets the API_KEY from the .env file, and specifies the ORG ID.
![feature1](demos/init.gif)

* `myExtension.enable`: Enable/disable this extension.
* `myExtension.thing`: Set to `blah` to do something.
### **◼ Helper functions**

## Known Issues
#### chat_completion(...)
- `"defchat"` - Basic helper function for chat-based models.
- `"defchatfull"` - Full helper function for chat-based models, including all parameters.

#### text_completion(...)
- `"deftext"` - Basic helper function for text-based models.
- `"deftextfull"` - Full helper function for text-based models, including all parameters.

#### text_edit(...)
- `"defedit"` - Helper function for editing a completion, including all parameters (full option).


<img src="demos/def.gif" alt="feature2" width=100% >

>
#### Empty helper function:
> "get_completion()" is an empty helper function designed to set up completions from scratch.
> <img src="demos/getempty.gif" alt="feature2-1" width=100%>
### **◼ Parameters**
>
To fill in the parameters, follow these steps:

1. Write the parameter within the `.create(param...)` structure.
- Example: If you want to set the temperature, use `"temperature="`.

2. Choose the desired value for the parameter by typing `=` followed by the desired value.
- Example: To set the temperature value as 1, complete it as `temperature=1`.

Finding parameters:

- To search for a specific parameter, type `"param"` and review the available options.
- Select the desired parameter from the options to complete it in your code.

Additional notes:

- Parameters that come with a default value are written as `param=`.
- The `param` represents the name of the parameter and serves as a convenient shortcut.
<img src="demos/params.gif" alt="feature3" width=100%>

### **◼ Models**
To specify the model, use the following keywords:

- For text model options, use `chatmodel`.
- For chat model options, use `chatmodel`.
- For editing model options, use `editmodel`.

Example Usage:

- If you want to select from text model options, write `chatmodel` in your code.
- If you want to select from chat model options, also use `chatmodel`.
- If you're looking for editing model options, use `editmodel`.

By using these keywords, you will be presented with the relevant model options to choose from.

> Make sure to select the appropriate keyword based on your specific needs.
>
> Feel free to explore the available options and choose the model that best suits your requirements!
>
> If you have any further questions or need assistance, please let me know.
<img src="demos/models.gif" alt="feature4" width=100%>

### SNIPPETS LIST: TRIGGERS AND DESCRIPTIONS
| TRIGGER| DESCRIPTION |
|-----------|-------------|
| | <h3>INITIAL SETUP</h3> |
| `setup basic` | Basic import |
| `setup dotenv` | Imports and load env key |
| `setup org` | Imports and load env key for ORG |
| | <h3>HELPER FUNCTIONS</h3> |
| `get text_completion() [base]` | Text completion (basic parameters) helper function |
| `get text_completion() [full]` | Text completion (full parameters) helper function |
| `get chat_completion() [base]` | Chat completion (basic parameters) helper function |
| `get chat_completion() [full]` | Chat completion (full parameters) helper function |
| `get text_edit() [full]` | Edit helper function |
| | <h3>PARAMETERS WHIT DEFAULT VALUE</h3> |
| `model= [parameter]` | Specifies the GPT model to be used. (Default value) |
| `prompt= [parameter]` | Specifies the text prompt. (Default value) |
| `messages= [parameter]` | A list of messages exchanged in a conversation. (Default value) |
| `suffix= [parameter]` | The suffix that comes after a completion of inserted text. (Default value) |
| `max_tokens= [parameter]` | Limits the maximum number of tokens in the generated response. (Default value) |
| `temperature= [parameter]` | Controls the randomness of the generated output. (Default value) |
| `top_p= [parameter]` | Controls the diversity of the generated output. (Default value) |
| `n= [parameter]` | Specifies the number of responses to generate. (Default value) |
| `stream= [parameter]` | Indicates whether to stream the output or retrieve the entire response at once. (Default value) |
| `logprobs= [parameter]` | Include the log probabilities on the logprobs most likely tokens. (Default value) |
| `echo= [parameter]` | Echo back the prompt in addition to the completion. (Default value) |
| `stop= [parameter]` | Specifies a stopping condition for the generated response. (Default value) |
| `presence_penalty= [parameter]` | Controls the model's tendency to talk about specific topics. (Default value) |
| `frequency_penalty= [parameter]` | Controls the model's preference for repeating similar responses. (Default value) |
| `best_of= [parameter]` | Generates best_of completions server-side and returns the "best". (Default value) |
| `logit_bias= [parameter]` | Allows biasing the model's output towards a certain behavior or style. (Default value) |
| `user [parameter]` | A unique identifier representing your end-user. (Default value) |
| `role` | Role in a conversation message. (Default value) |
| | <h3>PARAMETERS NAMES</h3> |
| `model` | OpenAI model - OpenAI model |
| `prompt` | OpenAI prompt - Text prompt |
| `messages` | OpenAI messages - Text message |
| `suffix` | OpenAI suffix - Text suffix |
| `max_tokens` | OpenAI max_tokens - Maximum tokens |
| `temperature` | OpenAI temperature - Temperature value |
| `top_p` | OpenAI top_p - Top-p value |
| `n` | OpenAI n - Number |
| `stream` | OpenAI stream - Stream value |
| `logprobs` | OpenAI logprobs - Log probabilities |
| `echo` | OpenAI echo - Echo value |
| `presence_penalty` | OpenAI presence_penalty - Presence penalty |
| `frequency_penalty` | OpenAI frequency_penalty - Frequency penalty |
| `best_of` | OpenAI best_of - Best of |
| `logit_bias` | OpenAI logit_bias - Logit bias |
| `user` | OpenAI user - User |
| `role` | OpenAI role - Role |
| `content` | OpenAI content - Content |
| `def get_completion() [clean]` | OpenAI Function clean - Get OpenAI model list |
| | <h3>OPENAI LIB ACTIONS</h3> |
| `openai.Model.list()` | OpenAI models - Get OpenAI model list |
| `openai.api_key =` | OpenAI API Key - Set OpenAI API key |
| `openai.Model.retrieve()` | OpenAI Model retrieve - Retrieve an OpenAI model |
| `openai.Completion.create()` | OpenAI Completion create - Create an OpenAI completion |
| `openai.ChatCompletion.create()` | OpenAI ChatCompletion create - Create an OpenAI chat completion |
| `openai.Edit.create()` | OpenAI Edit create - Create an OpenAI edit |
| `choices[0].message` | OpenAI Choices - First Choice Message - Access the message of the first choice in OpenAI choices |
| `choices[0].message['content']` | OpenAI Choices - First Choice Message Content - Access the content of the message in the first choice of OpenAI choices |
| `choices[0].text` | OpenAI Choices - First Choice Text - Access the text of the first choice in OpenAI choices |
| `choices[0].text.split()` | OpenAI Choices - First Choice Text Split - Split the text of the first choice in OpenAI choices |
| | <h3>CHAT MODELS</h3> |
| `gpt-4 [chat model]` | OpenAI GPT-4 - Chat completion model - GPT-4. Advanced language model for generating human-like text in chat-based scenarios. |
| `gpt-4-0314 [chat model]` | OpenAI GPT-4 (0314) - Chat completion model - GPT-4 (0314). Upgraded version of GPT-4 trained with data from March 2014. |
| `gpt-4-32k [chat model]` | OpenAI GPT-4 (32k) - Chat completion model - GPT-4 (32k). Variant of GPT-4 with a vocabulary size of 32,000 tokens. |
| `gpt-4-32k-0314 [chat model]` | OpenAI GPT-4 (32k, 0314) - Chat completion model - GPT-4 (32k, 0314). Variant of GPT-4 with a vocabulary size of 32,000 tokens, trained with data from March 2014. |
| `gpt-3.5-turbo [chat model]` | OpenAI GPT-3.5 Turbo - Chat completion model - GPT-3.5 Turbo. Highly capable language model for chat-based applications, offering improved performance over previous versions. |
| `gpt-3.5-turbo-0301 [chat model]` | OpenAI GPT-3.5 Turbo (0301) - Chat completion model - GPT-3.5 Turbo (0301). Variant of GPT-3.5 Turbo trained with data from March 2021. |
| | <h3>TEXT MODELS</h3> |
| `text-davinci-003 [text model]` | OpenAI Text Davinci (003) - Completion model - Text Davinci (003). General-purpose language model for generating high-quality text in a wide range of contexts. |
| `text-davinci-002 [text model]` | OpenAI Text Davinci (002) - Completion model - Text Davinci (002). Variant of Text Davinci offering similar capabilities with minor differences. |
| `text-curie-001 [text model]` | OpenAI Text Curie (001) - Completion model - Text Curie (001). Powerful language model for generating text, designed for various creative and informative tasks. |
| `text-babbage-001 [text model]` | OpenAI Text Babbage (001) - Completion model - Text Babbage (001). Language model focused on generating text with specific prompts and instructions. |
| `text-ada-001 [text model]` | OpenAI Text Ada (001) - Completion model - Text Ada (001). Language model designed for specific use cases and industries, offering specialized text generation capabilities. |
| | <h3>TEXT EDIT MODELS</h3> |
| `text-davinci-edit-001 [edit model]` | OpenAI Text Davinci Edit (001) - Edit model - Text Davinci Edit (001). Language model optimized for assisting in editing and improving text, providing helpful suggestions and corrections. |
| `code-davinci-edit-001 [edit model]` | OpenAI Code Davinci Edit (001) - Edit model - Code Davinci Edit (001). Language model specialized in assisting with code editing tasks, offering suggestions and enhancements for programming languages. |

Calling out known issues can help limit users opening duplicate issues against your extension.

## Release Notes

Users appreciate release notes as you update your extension.

### 1.0.0
---

Initial release of ...

### 1.0.1
## 📢 Requirements

Fixed issue #.
- `openai-python` library (Required)
```cmd
pip install openai-python
```
- `python-dotenv` module (Recommended)
```bash
pip install python-dotenv
```

### 1.1.0
---

Added features X, Y, and Z.
## Known Issues

---
Please report any issues you encounter by creating a new [issue](https://github.com/your-repo-name/issues) in this repository. We appreciate your feedback and contributions to help improve this project.

If you have any questions or need assistance, feel free to reach out by opening an issue. Thank you for your support!

## Working with Markdown

You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:

* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.
## ⏫ Release Notes

## For more information
Initial release
### Version 1.0.0 (2023-05-26)
- Initial release of OpenAIPy Fragments

* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
---

**Enjoy!**
### Thanks for installing this extension. I hope it proves to be highly useful for you.
Binary file added demos/def.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/getempty.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/init.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/models.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/oaifrag.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demos/params.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "openaipy-fragments",
"displayName": "OpenAIPY Fragments",
"description": "Simplify your coding with ready-to-use Python snippets for Chat GPT using OpenAI's GPT model.",
"version": "0.0.1",
"displayName": "OpenAIPY Fragments IntelliSense",
"description": "Simplify your coding with ready-to-use Python snippets for OpenAI library.",
"version": "1.0.0",
"engines": {
"vscode": "^1.78.0"
},
Expand Down
Loading

0 comments on commit 067ae51

Please sign in to comment.