Skip to main content

A module for interacting with shapes.inc API.

Project description

shapesinc-py

Installation

From PyPI:

pip install shapesinc -U

From GitHub:

pip install git+https://github.com/Rishiraj0100/shapesinc-py.git

Examples

Synchronous Shape Example

from shapesinc import (
  shape,
  ShapeUser as User,
  ShapeChannel as Channel
)

my_shape = shape("API_KEY", "my_shape")
user = User("u0")
channel = Channel("cli")

while True:
  inp = input(" >>> ")
  r = my_shape.prompt(inp, user = user, channel=channel)
  print(r.choices[0].message)

Asynchronous Shape Example

from shapesinc import (
  shape,
  ShapeUser as User,
  ShapeChannel as Channel
)

my_shape = shape("API_KEY", "my_shape", synchronous=False)
user = User("u0")
channel = Channel("cli")

async def run():
  while True:
    inp = input(" >>> ")
    r = await my_shape.prompt(inp, user = user, channel=channel)
    print(r.choices[0].message)

import asyncio
asyncio.run(run())

Image Examples

from shapesinc import Message, MessageContent, ContentType as C

msg = Message.new("Explain this image!", [dict(url = "URL OF IMAGE", type = c.image)])

resp = my_shape.prompt(msg)

Audio Messages

from shapesinc import Message, MessageContent, ContentType as C

msg = Message.new(files = [dict(url = "URL OF AUDIO FILE", type = c.audio)])

resp = my_shape.prompt(msg)

Note

  • When both audio and image files are given in one message, only audio will be processed!
  • Commands like !wack can be normally used with Shape.prompt method.

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

shapesinc-0.2.2.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

shapesinc-0.2.2-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file shapesinc-0.2.2.tar.gz.

File metadata

  • Download URL: shapesinc-0.2.2.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for shapesinc-0.2.2.tar.gz
Algorithm Hash digest
SHA256 0ad18c7fcca4519cc52f50cd6813c8f33b71112ce5206740b33f96fbf492647a
MD5 6e37d4bdd1d632f1b6c03d5e7973ed40
BLAKE2b-256 5076ce2bc6f54db70834cacbb244c1d7a5528d5f991a67d0b34f60d4194a1771

See more details on using hashes here.

File details

Details for the file shapesinc-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: shapesinc-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for shapesinc-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 83151290a70f6949f0d9e1b4677b49a68769fc3f8fb26387e48e643bb31c2783
MD5 c21b10b6c17e8f03a29253f01a05b285
BLAKE2b-256 1a93d7b4a5fb4a04e9d5a70f00d59442d308bb50a98b761a88311fb51ebee876

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