question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow dots in $variable names and provide a way to override or replace the ContextVariables class

See original GitHub issue

We’re exploring integrating SK with the Bot Framework SDK’s as a way to leverage Large Language Models (LLMs) for the creation of chat bots. SK seems like a perfect fit but one rough edge is around SK manages memory. The Bot Framework has a very rich state management system that breaks memory down into scopes. These scopes are extensible but the 3 default scopes that are relevant here are:

  • conversation - variables are automatically remembered on a per conversation basis so if the bot is being used in 4 different chats there are 4 completely separate sets of variables being remembered.
  • user - variables are automatically remembered for each user across all their conversations. So if there are 10 of us in a chat we each have a private set of user variables that are the same across all 4 chats I’m in with the bot.
  • temp - variables are transient and only remembered for the turn. This more closely matches the current working memory for SK.
  • activity - a pseudo memory scope for referencing properties off the received activity.

To create the best developer experience for our community it would be great if developers could just reference these scoped bags of state directly from the prompt; for example {{$user.name}} could reference the name of the current user, {{$activity.text}} could refence the text of the user massage the bot received, and {{$conversation.workItems}} could reference a list of work items being tracked by the bot.

The alternative is to make the developer manually copy every bot state variable they wish to reference in their prompts to working memory (ContextVariables) before they call into SK. That obviously would work but is a less then ideal developer experience.

To make SK “Bot Framework State Aware” I think 2 features would be needed:

  1. We would need to relax the requirement to not include dots in $variable names.
  2. We need some way of either replacing the ContextVariables class used by SK (make it an interface and include a clone() method) or let us inherit from and override the property getters and setters…

To go along with this on the Bot Framework side of things I would propose we map flat references like {{$history}} to our temp scope so we would turn that into {{$temp.history}} in our implementation of ContextVariables.

Issue Analytics

  • State:closed
  • Created 6 months ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
evchakicommented, Mar 21, 2023

@Stevenic, thanks again for the great feedback on this. I made sure we are tracking it with the project team.

1reaction
dluccommented, Mar 21, 2023

thanks @Stevenic - we’re looking into this area while working on increasing the pipeline flexibility. The change should be straightforward, but we just need to make sure it doesn’t conflict with the bigger picture. We’ll provide updates soon

Read more comments on GitHub >

github_iconTop Results From Across the Web

dot character in environment variable name yields "invalid ...
I'd like to take a stab at relaxing Kubernetes' validation logic so that dotted environment variables are allowed. If there's anything I should ......
Read more >
How to use variables in dot notation like square bracket ...
In this example, I understand that square bracket notation allows you to use a variable to call a certain object in the array....
Read more >
Exporting a variable with dot (.) in it
ksh93 has special variables whose name contains a dot like ${.sh.version} , but those are not mapped to environment variables and are special....
Read more >
What kinds of variable names can be used in Tcl
Variables consist of one or more Names, separated and optionally preceded by namespace separators (two or more colons), and optionally followed by an...
Read more >
The Django template language
When the template engine encounters a variable, it evaluates that variable and replaces it with the result. Variable names consist of any combination...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found