#Marking emails as read not working but AI think it is?

1 messages · Page 1 of 1 (latest)

tulip pulsar
#
        const tools = await toolset.getTools({ actions: ["GMAIL_FETCH_EMAILS", "GMAIL_ADD_LABEL_TO_EMAIL"]});

        // Get emails
        const emailResult = await agentExecutor.invoke({
            input: "Collect all resent emails, Please use this search filter in the query to filter the emails for last 3d, newer_than:3d and only unread emails. Include Email ID, Subject, Sender and Date."
        });

        console.log("email result :",emailResult.output);

        
        const formatData = await agentExecutor.invoke({
            input: "Format the following such as: ---" + emailResult.output
        });

        console.log("formatData:", formatData.output)

        try {
            // await bot.sendMessage(process.env.TELEGRAM_CHAT_ID, result.output, { parse_mode: 'Markdown' });

            await bot.sendMessage(process.env.TELEGRAM_CHAT_ID, formatData.output, { parse_mode: 'Markdown' });
            console.log("We got real format")
        } catch (error) {

            await bot.sendMessage(process.env.TELEGRAM_CHAT_ID, formatData.output);
            console.log("We got no format")
        }

        
        const addLabel = await agentExecutor.invoke({
            input: "Add label 'Label_906366639289765258' to all these emails: ${"+emailResult.output+"}"
        });

        const addReceipt = await agentExecutor.invoke({
            input: "Add label 'Label_3863516074469975887' to any email which is an Invoice / Bill / Receipt: ${"+emailResult.output+"}"
        });

        const markRead = await agentExecutor.invoke({
            input: "Remove label 'UNREAD' to all these emails: ${"+emailResult.output+"}"
        });

        console.log("addLabel:", addLabel.output)
        console.log("receipts:", addReceipt.output)
        console.log("Read:", markRead.output)
#

Above is code snippet and this gives me the result:

#

But when i check its still unread 🤔

solemn coyote
#

If yes could you share me what prompt you gave??
Also as you are using specific actions you need to use getActions(), like:

const tools = await toolset.getActions({ actions: ["GMAIL_FETCH_EMAILS", "GMAIL_ADD_LABEL_TO_EMAIL"]}); // getTools() is used for adding whole app (or list of) as a tool
tulip pulsar
#

It’s in the code above. See the remove unread part for the prompt. And yes I have the add label in there it’s able to add but haven’t been able to remove labels

#

But the gpt says that it did remove it so it must be hallucinating or something

#

Sorry on phone atm

solemn coyote
solemn coyote
tulip pulsar
solemn coyote
# tulip pulsar 3.5 turbo

Okay, it is recommended to use gpt-4-turbo or gpt-4o as many times gpt-3.5-turbo can't even send request to composio.

#

Try to change your model and let me know 🙌

tulip pulsar
#

But all the other requests seem to work.

solemn coyote
tulip pulsar
#

Hm i tried making a seperate smarter AI

#

code is there

#

but now i get this weird error

sinful aspen
#

Hey @tulip pulsar - There's no action to remove the label in Gmail tool as of now but we'll priortize this and get a action live for this by Wednesday EOD.

tulip pulsar
#

oh sweet thanks @sinful aspen

I'm drowning in emails, i really need AI to start clearing them out for me 😂

tulip pulsar
solemn coyote
#
` ` ` 
<json>
` ` `

or

Hey this is your json...:
<json>
#

Lemme know if you need that function, I have one

#

😄 @tulip pulsar

tulip pulsar
solemn coyote
# tulip pulsar I’d love to have it 🙃

You wished I delivered 🫡

import json
import typing as t

def parse_json_garbage(s: str) -> t.Dict[str, t.Any]:
    """
    This function converts string containing json to a json object.

    @param s: str - The string to parse.
    @return: t.Dict[str, t.Any] - The parsed json garbage.
    """
    s = s[next(idx for idx, c in enumerate(s) if c in "{["):]
    try:
        return json.loads(s)
    except json.JSONDecodeError as e:
        return json.loads(s[:e.pos])
#

Lemme know if you want any other help in composio 🙌

tulip pulsar
#

Oh that’s Python I’m in JS 😄

solemn coyote
tulip pulsar
#

True haha

sinful aspen
#

Hey - Checking with the team. Give me few minutes!