Skip to main content

Python SDK for the Cloud-ready fork of the Grinning Cat

Project description

Grinning Cat Python SDK


Grinning Cat Python SDK is a library to help the implementation of Grinning Cat on a Python Project

Installation

To install Grinning Cat Python SDK, run:

pip install grinning-cat-python-sdk

Usage

Initialization and usage:

from grinning_cat_python_sdk import GrinningCatClient, Configuration

configuration = Configuration(host="localhost", port=1865, auth_key="test", secure_connection=False)

cat_client = GrinningCatClient(configuration)

Send a message to the websocket:

from grinning_cat_python_sdk import GrinningCatClient, Configuration, Message

configuration = Configuration(host="localhost", port=1865, auth_key="test", secure_connection=False)
cat_client = GrinningCatClient(configuration)

notification_closure = lambda message: None # handle websocket notification, like chat token stream

# result is the result of the message
result = cat_client.message.send_websocket_message(
    Message(text="Hello world!"),  # message body
    "agent", # agent ID
    "user", # user ID
    callback=notification_closure # websocket notification closure handle
)

Load data to the rabbit hole:

import asyncio

from grinning_cat_python_sdk import GrinningCatClient, Configuration, Message

configuration = Configuration(host="localhost", port=1865, auth_key="test", secure_connection=False)
cat_client = GrinningCatClient(configuration)

# file
file = "path/to/file"
result = asyncio.run(cat_client.rabbit_hole.post_file(file, "agent"))

# url
url = "https://www.google.com"
result = asyncio.run(cat_client.rabbit_hole.post_web(url, "agent"))

Memory management utilities:

from grinning_cat_python_sdk import GrinningCatClient, Configuration, Message

configuration = Configuration(host="localhost", port=1865, auth_key="test", secure_connection=False)
cat_client = GrinningCatClient(configuration)

cat_client.memory.get_memory_collections("agent")  # get number of vectors in the working memory
cat_client.memory.get_memory_recall("HELLO", "agent", "user")  # recall memories by text

url = "https://www.google.com"

# delete memory points by metadata, like this example delete by source
cat_client.memory.delete_memory_points_by_metadata("declarative", "agent", {"source": url})

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

grinning_cat_python_sdk-1.0.1.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

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

grinning_cat_python_sdk-1.0.1-py3-none-any.whl (59.7 kB view details)

Uploaded Python 3

File details

Details for the file grinning_cat_python_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: grinning_cat_python_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for grinning_cat_python_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 71f59438872b45db2d0ec5e6b5d4a65e0f1cb4b106a98c861754553bd4b316be
MD5 15b12407c2d63041898b830890e0ebf9
BLAKE2b-256 25a36ba624acbc70fe2c9b6b416ee34321b48e8a7faa3e3199ce4e3e66908a29

See more details on using hashes here.

File details

Details for the file grinning_cat_python_sdk-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for grinning_cat_python_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cfbdc301b3e6c3b7385f34bb6bb6a2f12d6c447b3096c5f366095034b858b241
MD5 5ac987f45a5509235014087eafc0a883
BLAKE2b-256 f952ea5263476c5902b477a70ca4fe8f4d09eb016fe31e6e751414d3049579df

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