GPT Plugins for 4all
Project description
GPT Plugins 4All
GPT Plugins 4All is a Python library designed to facilitate the integration of GPT and other large language models with various APIs, leveraging OpenAPI specifications. This library simplifies the process of parsing OpenAPI specs, managing different authentication methods, and dynamically interacting with APIs based on model responses.
Features
- Parse and validate OpenAPI 3.1.0 specifications.
- Handle diverse authentication methods, including OAuth 2.0, Basic Auth, Header Auth, and Query Parameter Auth.
- Generate structured API representations for AI interactions.
- Dynamically construct API calls based on OpenAPI specs.
- Support OAuth2.0 flow for token acquisition and usage.
Installation
Install GPT Plugins 4All using pip:
pip install GPTPlugins4All
Quick Start
Initializing with an OpenAPI Specification
from GPTPlugins4All.config import Config
# Initialize the Config object with your OpenAPI spec
spec_string = """...""" # Your OpenAPI spec as a string
config = Config(spec_string)
Adding Authentication Methods
Add Basic Authentication
config.add_auth_method("BASIC", {"key": "your_api_key"})
Add OAuth Configuration
config.add_auth_method("OAUTH", {
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"auth_url": "https://example.com/auth",
"token_url": "https://example.com/token",
"redirect_uri": "https://yourapp.com/oauth-callback",
"scope": "read write"
})
Generating Simplified API Representations
simplified_api = config.generate_simplified_api_representation()
print(simplified_api)
Generate Object for use with OpenAI functions
tools = config.generate_tools_representation()
OAuth Flow
auth_url = config.start_oauth_flow()
# Redirect the user to auth_url...
tokens = config.handle_oauth_callback(code_from_redirect)
Making API Calls
response = config.make_api_call("/endpoint", "GET", {"param": "value"})
Oauth
url = config5.start_oauth_flow() #use this url to get code first
callback = config5.handle_oauth_callback(code)
#example
response = config5.make_api_call_by_path(path, "POST", params=your_params, user_token=callback, is_json=True)
Contributing
Contributions are welcome! Please check out the contributing guidelines.
License
GPT Plugins 4All is released under the 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
GPTPlugins4All-1.0.1.tar.gz
(5.5 kB
view details)
Built Distribution
File details
Details for the file GPTPlugins4All-1.0.1.tar.gz
.
File metadata
- Download URL: GPTPlugins4All-1.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50d75030e7a86007b7bf163f0a97cd880319c4166a64e913d5cae907644e0e7d |
|
MD5 | 1bb33e00efb677bb45980897d9d604a9 |
|
BLAKE2b-256 | 939beec95b332864eb5d9c3dd60cf4852c66eae3a968578400e291fda8a5cc58 |
File details
Details for the file GPTPlugins4All-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: GPTPlugins4All-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a3a4ea18caebb60cc595bd904530819242acf1d623086a6a1bc93a5ecfcb678 |
|
MD5 | d13c1334b0f966885ea541e82ed73505 |
|
BLAKE2b-256 | 4ba1f499f655f38907614795587c398834df5a50ec7c94ae94cd600e51d3e86a |