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.2.tar.gz (42.3 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.2-py3-none-any.whl (59.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: grinning_cat_python_sdk-1.0.2.tar.gz
  • Upload date:
  • Size: 42.3 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.2.tar.gz
Algorithm Hash digest
SHA256 c9ba9136fa7c7afdd02a1d5caa15e1ec2409cd31dacf84b03a7a8b480134d520
MD5 aba47de81ca056e11351bb3f1c2bac9e
BLAKE2b-256 f08786c5bd37fbae778aba8a4a2fd34a69845119ca52cfbb758401c318e44dd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for grinning_cat_python_sdk-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b830ba892e47385a33733b330eedfd2302dfa5483bc1799fb8eae689f5b4404b
MD5 3bbda83e441676c7ea39246ac9549c3a
BLAKE2b-256 504dec3852cafd8ea66d4c5c3c0b999471d3593d3de31ce4121b8a6d4c5f1dfc

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