A LangChain Agent that can handle your Instagram account
Dendrite
InstagramTools
classagent.py
. We’re going to start by importing all dependencies at the top. Don’t worry about their uses, it will become clear later on:
InstagramTools
. The class will manage the Dendrite browser and will contain the methods used for the tools metioned above. Let’s start with creating the class and initiating Dendrite.
InstagramTools
class, let’s create a goto_chat
method.
InstagramTools
we’re creating send_message_in_chat
and get_messages_from_chat
, utilizing out goto_chat
method for navigation.
extract
method for structured data output. Then, we utilize the fill
and press
methods to send messages, and the extract
method to extract messages.
upload_content
method. This tool takes in the caption and image path as an argument. Later, we will create a utility function that generates an image with Dall-E and saves it locally.
upload_post
tool.
main
function