Context
In BrainSoup, a Context represents a real-time, dynamic set of data that is injected directly into the working memory of the agents. This mechanism provides agents with an enriched comprehension of their operating environment and enables relevant interactions.
A context in BrainSoup is identified by a uniquely defined subject. This context subject acts as a subscription point for chat rooms or individual agents. Upon subscription, the context data becomes immediately accessible to the respective agent, enhancing their response capabilities.
It is important to consider the size and optimization of the context. Context sizes have a direct impact on the cost of using the agent; smaller and optimized contexts contribute to cost-effective utilization.
BrainSoup provides a set of predefined contextual topics, whose names begin with BrainSoup.
. These subjects present useful data about the application that assists the agent in user guidance and interactions within BrainSoup.
Custom Context
BrainSoup supports the creation of Custom Contexts. These user-generated contexts allow for a deeper real-time, user-specific data alignment.
Defining Custom Contexts
A custom context can be defined in several ways:
- With a small text file: if your context corresponds to a single value (for example, a numerical value, a date or a text), simply place it in a text file within the
Context
folder. The name of this file (without the '.txt' extension) will be the subject of the context, to which agents can subscribe. - With a tree of text files: if your context is more complex and requires multiple values, you can create a structured text file tree with folders and sub-folders. The name of the root folder will be the subject of the context, and the file structure will define the context data.
- With a JSON file: alternatively, you can define a custom structured context by placing a JSON-formatted file within the
Context
folder. The JSON file should contain the context data in the desired structure. This approach is equivalent to the tree of text files but may be more convenient if you want to generate the context programmatically, or if it is the output of a web API.
Tips:
- You can quickly access the
Context
folder from the BrainSoup interface by going to Settings > App Folders > Context. - A text file composing a custom context can be a very small Mardown or CSV document. In this case, it is recommended to keep the
.md
or.csv
extension help the LLM to understand the content of the file.
Example of a Custom Context
Consider the below example which uses a JSON file named BusinessKPIs.json
within the Context
folder to defines a custom context BusinessKPIs
representing daily key performance indicators (KPIs):
{ "ecommerce": { "dailyKPIs": { "visitors": 13456, "orders": 3456, "revenue": 45678.9 } } }
Agents subscribing to this context subject will immediately update their working memory with the latest KPIs.
Structure and naming of custom contexts are entirely flexible within the limits of the JSON format. This property encourages comprehensive scripting possibilities for custom context generation and facilitates raw web API output integration.
To summarize, contexts in BrainSoup can be dynamically updated, and agents and chat rooms can be efficiently linked to specific contexts. This functionality empowers BrainSoup users in effectively customizing agent behavior.