LLM Component writing to session variable

Hi all, newbie here.

I'm testing Retool and can't wrap my head around one thing.

I'm playing around with the LLM component, which works great, but I need the AI to provide information that is not seen by the user.

Think of it like this: the AI responds with "Great" and also sends a code that is to be used by another function.

I can instruct the AI to send the return message in a json, and strip out everything but the message that is vissible to the user in the transformer.

But how do I save the other info in a local session variable.

The component is sandboxed so I cant get to it.

Any tips?

1 Like

Hi there @Carl-Johan_Larsson, and welcome to the forum!

I think there may be several things/workarounds you can try.

  • Firstly, can you clarify which component you're using? Is it the llm chat, or the agent chat?
  • Second, which method are you using to get the llm to respond in a Json, is it simply the system prompt where you provide the instructions, or are you using another query with structured outputs?
  • Finally, when you say the component is sandboxed, what do you exactly mean? Both the llm and agent chat components have the conversation threads available, after a turn in conversation, you can right click on the component -> View status, and search for the conversation results.

Thanks, all of the above will be helpful!

1 Like

Hi @Carl-Johan_Larsson,

If you can add more context to which AI tool you are using and if this is from one of the chat components or from an AI query we can better help assist you to take this data and store it in a way that fits your use case!

The more details and screen shots you can share, the better!

Hi @Carl-Johan_Larsson,

Just wanted to follow up on this to see if you are still facing this issue.

We do not have a built in "when x event occurs, run a JS Query" which would be the primary way of executing code to effect another component while a user is messaging an LLM via a chat component.

But there may be some work arounds, as Miguel asked about the set up so we can have more details to test out possible work arounds.