send_message

Sending a message to a character

client.chat.send_message('HISTORY_ID', 'TGT', 'TEXT')

or send message with image

from characterai import PyCAI

client = PyCAI('TOKEN')

image = client.upload_image('image.jpg')

message = client.chat.send_message(
    'HISTORY_ID', 'TGT', 'TEXT',
    image_description_type='AUTO_IMAGE_CAPTIONING',
    image_rel_path=f'https://characterai.io/i/400/static/user/{image["value"]}',
    image_origin_type='UPLOADED'
)
    
print(message)

text [str]

Message text

history_id [str]

Unique ID for character history

tgt [str]

Character's username

image_description [str] (optional)

Image description instead of automatic recognition, set image_description_type to HUMAN

image_description_type [str] (optional)

When image uploaded, can be HUMAN or AUTO_IMAGE_CAPTIONING

image_rel_path [str] (optional)

The path to the image on the server. You can create this path with the upload_image() function, set image_origin_type to UPLOADED

token [str] (optional)

You can set a specific token for the function, it will be executed from the specified token

Last updated