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.0.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.0-py3-none-any.whl (59.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for grinning_cat_python_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1d3425c641640891ee91819c50c81e37f37ce321fb53f77bd73f202b2f9c0610
MD5 7fd40c9540e4bf74cc25877f0e89dcb9
BLAKE2b-256 016e0dc670c72e69076a291e210115fa892a5087d6df61d8e6f06b56b8f63cb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for grinning_cat_python_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92b5b897e9d2045fb3d8ab9c297ce1be24431c2f7a900de2408b69734b0504d7
MD5 7324f3733954a015eb527b65deb94d6d
BLAKE2b-256 bee8d7351fa241b57b19f0443b7378733c6b43e1dc3ea0a430ad3c0d50e65f51

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