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.3.1.tar.gz
(12.2 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
shapesinc-0.3.1-py3-none-any.whl
(12.8 kB
view details)
File details
Details for the file shapesinc-0.3.1.tar.gz.
File metadata
- Download URL: shapesinc-0.3.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39d6f2c71ad9509ea57d5ed6607e07ad47e4fba6f3718caaed6a27b4959999de
|
|
| MD5 |
168b9ca3c38c19adf347578d3fd7613f
|
|
| BLAKE2b-256 |
2a63ca787f4406b1e394b651dce1b3d6c77d51bf78731983db9c9817840346ad
|
File details
Details for the file shapesinc-0.3.1-py3-none-any.whl.
File metadata
- Download URL: shapesinc-0.3.1-py3-none-any.whl
- Upload date:
- Size: 12.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 |
4219c4dc8f68cfa6b7e978724a68eae31c9460b1c64e700cba4b096875153133
|
|
| MD5 |
0fa00dafbc097745edf11f522abbc945
|
|
| BLAKE2b-256 |
7ae7c408caf8ddc57e0c37a3337fc6e377a4a3e72222d18f7ef9c3dfc7c2347f
|