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.3.tar.gz (42.4 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.3-py3-none-any.whl (60.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: grinning_cat_python_sdk-1.0.3.tar.gz
  • Upload date:
  • Size: 42.4 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.3.tar.gz
Algorithm Hash digest
SHA256 070a4d7d522e8cae10358b9ab03db8f4212b268d7a77a4e89d83f87a3c2a810c
MD5 686c6a65da721e7b4ccacdac2d59a0d2
BLAKE2b-256 c26549e97be39596fa0af7d2e43b27c1709faee228256d083a96a824ffa24b67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for grinning_cat_python_sdk-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4e7a6708a7ed4799766e6788d9266622f4cd8a11f0e15a4bc7634f7ef8115391
MD5 98d901978843202b16baa67af2ceb996
BLAKE2b-256 e11d939cb9d6114c4a31e95c47cbc095b3b82f28804f764ce72350903987b51f

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