Some external utilities to facilitate OpenAI's Utilites
Project description
OpenAI Utilities README
Package Name: openai-utilities
When imported, the package is referred to as openai_utils.
Installation
To install the package, run:
pip install openai-utilities
Overview
This Python package provides utility functions for interacting with OpenAI's GPT-3.5-turbo and GPT-4 models to generate text completions and embeddings. It simplifies the process of generating text completions and embeddings.
Dependencies
openainumpy
Importing
After installation, import the package using:
import openai_utils
Functions
AskGPT
Description
Generates text completions using OpenAI's GPT-3.5-turbo or GPT-4 models.
Parameters
model: The GPT model to use for text generation. Available options: "gpt-3.5-turbo", "gpt-4".Context: Can be either a string or a list of message objects.- If a string, it serves as the prompt for the text completion.
- If a list, it should contain message objects in the format
{"role": "user/system", "content": "message content"}.
temperature: Controls the randomness of the output (default is 1).
Returns
Returns a string containing the generated text.
Example
response = openai_utils.AskGPT(model="gpt-4", Context="How are you?", temperature=0.7)
CreateEmbedding
Description
Generates text embeddings for a given string using OpenAI's text-embedding models.
Parameters
String: The input string for which the embedding will be generated.
Returns
Returns a list representing the generated text embedding.
Example
embedding = openai_utils.CreateEmbedding(String="Hello, world!")
Usage
First, ensure you have the openai and numpy packages installed. Then import the openai_utils package and use the functions as demonstrated in the examples above.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openai-utilties-3.0.tar.gz.
File metadata
- Download URL: openai-utilties-3.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a33356517501bd9b7fc182c460961dad074605831b66f9498ea4335f4541b0b6
|
|
| MD5 |
8bf1e9b6ce28158145f8c985197d9977
|
|
| BLAKE2b-256 |
7c6cd508fe89b480514e2aef3f017c907d5100cc353dda1aad6337d85c1f8121
|
File details
Details for the file openai_utilties-3.0-py3-none-any.whl.
File metadata
- Download URL: openai_utilties-3.0-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10c8d55de29889fceb7a933e15e814e06fe903dac4c7fc7fc69c2931a2224360
|
|
| MD5 |
9577c1dd901840a00b47d5e362043b66
|
|
| BLAKE2b-256 |
dca4385b2fa07265f7dce52ca16ba5ea73123a44ba6fa0a93b58bf0186534b0f
|