Client for Jiggy AI JiggyBase, including ChatGPT Retriever Plugins
Project description
JiggyBase
JiggyBase is a Python library for interacting with the JiggyBase service at https://jiggy.ai.
Use it to manage your JiggyBase organization and collections, including uploading documents into a collection.
Requirements
- Python 3.6 or above
Installation
pip install jiggybase
Client Usage
To start using JiggyBase in your Python code, you first need to import it:
import jiggybase
After importing, you need to create a JiggyBase client object:
jb = jiggybase.JiggyBase()
Assuming you already created a collection 'my-collection', you can add files to the collection as follows:
collection = jb.collection('my-collection')
collection.upsert_file('/path/to/my/doc')
The document is now available in the collection and can be accessed by the collection's ChatGPT plugin, via chat.jiggy.ai, or via the associated chat API endpoint.
JiggyBase Client
These are the top level methods of th JiggyBase client, primarily used for getting the user's organizations or all collections across all organizations.
collection_names()- Returns a list of all of theCollectionnames that the user can accesscollection(name: str)- Returns theCollectionobject matching the given name.collections()- Returns a list of allCollectionobjects in all organizations the user is a member of.orgs()- Returns a list ofOrgobjects the user is a member of.get_org(name_or_id: str)- Returns theOrgobject matching the given name or ID.api_keys()- Returns a list of the user'sApiKeyobjects.authenticated_user()- Returns the authenticated user'sUserobject.
Organization
Organizations in JiggyBase are a mechanism for separating different customers within the JiggyBase service. Users can be a member of mutiple unrelated organizations. A new user who subscribes to a JiggyBase service tier has their own oganization that they control as administrator of the organization. Users can also be invited to an organization by existing members of the organization.
For an Org object (e.g., my_org = jb.get_org("<org_name>")), you have access to the following methods:
collections()- Returns a list ofCollectionobjects within the organization.collection(name: str)- Returns theCollectionobject matching the given name.update([name: Optional[str] = None, description: Optional[str] = None])- Updates the organization's name or description.
Collection
A collection is a group of documents that can be used to augment ChatGPT language models with your personalized information by using information from your collection to inform ChatGPT responses. A collection can be exposed as a ChatGPT Plugin, via the JiggyBase ChatCompletion API, or via chat.jiggy.ai. You have full control over who can access to your collection.
For a Collection object (e.g., my_collection = jb.collection("<collection_name>")), you have access to the following methods:
upsert_file(file_path: str[, mimetype: str = None])- Uploads a file to the collection.upsert(documents: List[Document])- Adds a list ofDocumentobjects to the collection.query(queries: Union[str, List[str], Query][, top_k : int = 10])- Queries the collection and returns aQueryResponseobject.get_doc(id: str)- Retrieves a document by its ID.get_chunks([start: int = 0, limit: int = 10, reverse: bool = True])- Iterates through the chunks in a collection.delete_docs([ids: Optional[List[str]] = None, document_metadata_filter: Optional[DocumentMetadataFilter] = None, delete_all: Optional[bool] = False])- Deletes items in the collection by document IDs, metadata filter, or deletes all documents.set_description(self, description: str)- Updates the description of the collection.delete()- Deletes the collection permanently.get_chat_config()- Retrieves the chat configuration for the collection.
Organization User Management
An organization supports multiple roles for members, including 'admin', 'member', and 'viewer'. A viwer role can access the data in the collection for chat purposes. A member can upload new documents to the collection.
members()- Returns a list ofOrgMemberobjects within the organization.add_member(email: str, role: OrgRole)- Adds a new member to the organization with the given email and role.delete_member(email: str)- Deletes a member from the organization using the given email.
Organization Prompt Management
JiggyBase supports user-customized prompts for the JiggyBase ChatCompletion API. The following methods are provided to manage the customized prompts.
prompt_tasks([name=None, version=None])- Returns a list ofPromptTaskobjects, optionally filtering by name and version.create_prompt_task(name: str, version: int, prompts: List[PromptMessage][, type: Optional[PromptTaskType] = None, description: Optional[str] = None])- Creates a newPromptTaskobject with the specified parameters.update_prompt_task(name: str, prompts: List[PromptMessage])- Updates the specified prompt task's prompts.get_prompt_task(prompt_task_id: int)- Retrieves aPromptTaskobject using the given prompt_task_id.delete_prompt_task(prompt_task_id: int)- Deletes aPromptTaskobject using the given prompt_task_id.
jiggybase_upload
This utility is installed via pip and allows you to upload files or directories to your JiggyBase collection using command-line arguments. It's included in the jiggybase/examples directory.
Usage
jiggybase_upload [--org <organization>] [--collection <collection>] [--dir <directory>] [--file <file>]
--org: The name of your JiggyBase organization. Alternatively, setJIGGYBASE_ORGenvironment variable, or be a member of a single organization.--collection: The name of your JiggyBase collection. Alternatively, set theJIGGYBASE_COLLECTIONenvironment variable, or have a single collection in your organization.--dir: The directory you want to upload.--file: The file you want to upload.
If neither --file nor --dir options are provided, the script will automatically process other arguments as a file or directory.
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 jiggybase-0.2.0.tar.gz.
File metadata
- Download URL: jiggybase-0.2.0.tar.gz
- Upload date:
- Size: 33.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4f4f2ce611475994a57338776b82fdc1aa328d407c9140eb99d5395631dbaab
|
|
| MD5 |
22bf1fada86c81c220d4a7b0701c46fc
|
|
| BLAKE2b-256 |
5b1ccbd38518ba9ed3c075cc8c9abca9ec6fb141a0ef8bd92bfe37df1701a4d6
|
File details
Details for the file jiggybase-0.2.0-py3-none-any.whl.
File metadata
- Download URL: jiggybase-0.2.0-py3-none-any.whl
- Upload date:
- Size: 35.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b667c9f06992d1a47e6f2b1d23f23349bbedf262733465188ade6737f708a4bb
|
|
| MD5 |
ba0aae4587e89305e34e327b0cc5bc8c
|
|
| BLAKE2b-256 |
9520129cc9a732408f0ff66b9e036f7d076d0e2e69a67df0132b781e64baef5a
|