Skip to main content

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 the Collection names that the user can access
  • collection(name: str) - Returns the Collection object matching the given name.
  • collections() - Returns a list of all Collection objects in all organizations the user is a member of.
  • orgs() - Returns a list of Org objects the user is a member of.
  • get_org(name_or_id: str) - Returns the Org object matching the given name or ID.
  • api_keys() - Returns a list of the user's ApiKey objects.
  • authenticated_user() - Returns the authenticated user's User object.

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 of Collection objects within the organization.
  • collection(name: str) - Returns the Collection object 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 of Document objects to the collection.
  • query(queries: Union[str, List[str], Query][, top_k : int = 10]) - Queries the collection and returns a QueryResponse object.
  • 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 of OrgMember objects 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 of PromptTask objects, 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 new PromptTask object 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 a PromptTask object using the given prompt_task_id.
  • delete_prompt_task(prompt_task_id: int) - Deletes a PromptTask object 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, set JIGGYBASE_ORG environment variable, or be a member of a single organization.
  • --collection: The name of your JiggyBase collection. Alternatively, set the JIGGYBASE_COLLECTION environment 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jiggybase-0.2.1.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jiggybase-0.2.1-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file jiggybase-0.2.1.tar.gz.

File metadata

  • Download URL: jiggybase-0.2.1.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for jiggybase-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7a8711ea62898946f50d2d9b686bef9a5125a73ea7af4af1dc4adb89221613c1
MD5 850949755a9ca67005f1429d6037e39d
BLAKE2b-256 00664f71e5983c3c3c27bffc12b8e5ce8230202060e30dafe2122d59d3d9dfcc

See more details on using hashes here.

File details

Details for the file jiggybase-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: jiggybase-0.2.1-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

Hashes for jiggybase-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d4e728f02d02cd2436a0daa2e9aee549816b303cc88b922e4514ab015aa659a
MD5 9a9973a35534adf5d043a6d3e32bf41f
BLAKE2b-256 a6361ab132a1a2e5af6000dd60f53c673ffc6cb861594b57c1aabe86ca4388fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page