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
!wackcan be normally used withShape.promptmethod.
Project details
Release history Release notifications | RSS feed
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.0b0.tar.gz
(9.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shapesinc-0.2.0b0.tar.gz.
File metadata
- Download URL: shapesinc-0.2.0b0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
005f5c97662c98734d79c3e163436dac9a97a7ab1bcedd4493c9fc796bfff8b2
|
|
| MD5 |
6ee8392f99ef83ce9c899566f1b54df0
|
|
| BLAKE2b-256 |
38b9f105da70106eed1643c783744090d7bc0949d7393549e73223f250a1c350
|
File details
Details for the file shapesinc-0.2.0b0-py3-none-any.whl.
File metadata
- Download URL: shapesinc-0.2.0b0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
917d180e2ae0c2cbbc37e9b8fd9928daf87d0876824d60c3ff866f5a13d0ceee
|
|
| MD5 |
ab53723fd3fa14e3fa176dcfd643e99b
|
|
| BLAKE2b-256 |
29b6b291a3e7c791f1f017700760083420dea04d4adf14b1eb32e4ae90d81d3b
|