Sending Message with Files

Installation

Prerequisites

This example specifically requires completion of GLChat SDK installation & API Key steps listed on the Quickstart page.

View full project code on GitHub

Sending Message with Files using GLChat SDK

You can send message with files programmatically using GLChat SDK.

from pathlib import Path
from glchat_sdk import GLChat

client = GLChat()

response = client.message.create(
   chatbot_id="app-id",
   message="What is in this file?",
   files=[Path("/path/to/your/file.txt")],
   user_id="user@example.com",
   conversation_id="conversation-id"
)

for chunk in response:
   print(chunk.decode("utf-8"), end="")

Sample Response

This is a sample of the response (truncated for brevity):

Last updated