#related:
1 messages ยท Page 1 of 1 (latest)
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
}
@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
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)
I could but I'm planning to have multiple objects in my environment and I'd love the LLM to figure out automatically how to call those
initializing all of them every time I want to prompt is ๐ฌ
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)
if it's a common flow, wouldn't you write a module for it?
it won't be a common flow but a "possible" one.
The ideas is that this Discord module could be something that lives in your environment and I'm expecting the user or agent to use it with "Call the Discord API by reading the token from X env variable to do Y"
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
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
makes sense. FWIW this is currently a soft blocker for the UX I'm expecting to deliver with the Agent I'm building. cc @vocal gyro