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.1.3.tar.gz
(7.7 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.1.3.tar.gz.
File metadata
- Download URL: shapesinc-0.1.3.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6673fe40e1368a41728613f2c2fd0b9a68e65e9f203d731bd56d0bd43983d260
|
|
| MD5 |
b1833dda00c7025414441776e3f494f3
|
|
| BLAKE2b-256 |
5c8655b714be9479ef0b7e28c6c5252611f6364bed5a7924dfbf3b0d6fa6785d
|
File details
Details for the file shapesinc-0.1.3-py3-none-any.whl.
File metadata
- Download URL: shapesinc-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.7 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 |
cc1a293fb6a9f5b01930c8e86a2360d8009358d3469d1a440cd08b7d77873e38
|
|
| MD5 |
e829b3de49db82cc46d8d3d6e452debc
|
|
| BLAKE2b-256 |
b2372f0e8f4c4a77613130bf0ee726d2f3e6762b1409849d7527c14cf890514d
|