#related:

1 messages ยท Page 1 of 1 (latest)

teal spire
#

removing the secret yield to better results for now:

โœ” call the discord API to fetch the messages from the channel 1354287096637952000 13.3s
โ”‚๐Ÿง‘ call the discord API to fetch the messages from the channel 1354287096637952000
โ”‚ โ”ƒ 0.0s
โ”‚
โ”‚๐Ÿค– Let me help you with that. Looking at the available functions, I can use the  Query_discord  function. However, I notice that this function doesn't have any parameters specified in its schema.
โ”‚ โ”ƒ
โ”‚ โ”ƒ I'll make the call to see what we can get:
โ”‚ โ”ƒ 3.4s โ—† Input Tokens: 2,411 โ—† Output Tokens: 92
โ”‚
โ”‚ โœ” discord: Discord! 0.3s
โ”‚
โ”‚๐Ÿค– I see that this returns a Discord ID. To actually fetch the messages from the specified channel, I can use the Discord_call function with the appropriate endpoint. I'll make a GET request to the
โ”‚ โ”ƒ messages endpoint for this channel:
โ”‚ โ”ƒ 4.2s โ—† Input Tokens: 654 โ—† Output Tokens: 129
โ”‚
โ”‚ โœ” Discord.call(method: "GET", path: "/channels/1354287096637952000/messages"): String! 0.7s
โ”‚
โ”‚๐Ÿค– I've successfully retrieved the messages from the specified channel. The response shows several messages in the channel, including:
โ”‚ โ”ƒ
โ”‚ โ”ƒ 1. A message saying "and we're chatting about a bunch of things here ๐Ÿ˜„"
โ”‚ โ”ƒ 2. A message saying "this is a thread"
โ”‚ โ”ƒ 3. A thread creation message referencing "hello! let's start a thread!"
โ”‚ โ”ƒ
โ”‚ โ”ƒ The messages are shown in reverse chronological order (newest first) and include details such as:
โ”‚ โ”ƒ
โ”‚ โ”ƒ โ€ข Message content
โ”‚ โ”ƒ โ€ข Timestamp
โ”‚ โ”ƒ โ€ข Author information
โ”‚ โ”ƒ โ€ข Message IDs
โ”‚ โ”ƒ โ€ข And other metadata
โ”‚ โ”ƒ
โ”‚ โ”ƒ Would you like me to help you parse or analyze any specific information from these messages?
โ”‚ โ”ƒ 4.6s โ—† Input Tokens: 2,148 โ—† Output Tokens: 138
#

this is the whole tool function:

func (m *Discord) Call(
    ctx context.Context,
    // The HTTP method to use
    method string,
    // The path to call after the "https://discord.com/api" base URl
    path string,

    // an optional body parameter for non GET requests
    // +optional
    body string) (string, error) {

    r, _ := http.NewRequest(strings.ToUpper(method), "https://discord.com/api"+path, strings.NewReader(body))

    r.Header.Add("Authorization", "Bot $redacted")

    res, err := http.DefaultClient.Do(r)

    if err != nil {
        return "", err
    }

    defer res.Body.Close()
    ret, err := io.ReadAll(res.Body)
    if err != nil {
        return "", err
    }

    return string(ret), nil

}
teal spire
#

@vital egret any hints about making env secrets loading better with modules?

#

tried different prompts but haven't managed to make it work yet

#

cc @frail scroll

frail scroll
#

wait do you really want the llm to be able to do this? why not create your Discord object as a variable first?

#

discord=$(. $DISCORD_TOKEN)

teal spire
#

initializing all of them every time I want to prompt is ๐Ÿ˜ฌ

frail scroll
#

got it. But if it can load the secret from the DISCORD_TOKEN env variable that means you're assuming it automatically has access to your entire host env (and probably host filesystem too)

frail scroll
teal spire
#

the name of the variable can be whatever the user has decided to set it to

#

It'd be also awesome if the LLM can also use secret providers.. but not sure how that works

frail scroll
#

I think maybe default secrets with the Environments API can solve this. I would not want to give the sandboxed LLM my whole env, filesystem, and especially secret provider

teal spire