Skip to content

Commit b7a9ea2

Browse files
committed
Added feature to generate and explore ideas
- A new feature that allows generation and exploration of ideas. When the analysis is complete the user can request the variation of the original task to explore and execute the varied versions. User has an ability to set the degree of variation on scale 1-5. - Updated workflow map to indicate forking, as related to the previous point - Theme toggle moved under settings - A few bug fixes
1 parent 806bdc9 commit b7a9ea2

13 files changed

Lines changed: 407 additions & 91 deletions

PROMPT_TEMPLATES_sample.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,49 @@ theorist_system: |
939939
940940
Remember to tailor your response appropriately based on whether there is relevant previous context or not.
941941
942+
###########################################
943+
### EXPLORE IDEAS #########################
944+
###########################################
945+
946+
ideas_explorer: |
947+
Generate 5 questions that explore variations of our current inquiry. Each question should represent a small mutation in the problem space - subtle shifts that may reveal profound insights.
948+
949+
Variation Level: {}
950+
951+
Level 1: Refine focus - adjust scope, granularity, or specific parameters within the same inquiry
952+
Level 2: Shift angle - examine the same subject from a different perspective or framework
953+
Level 3: Test boundaries - explore what happens at the edges of our current assumptions
954+
Level 4: Blend elements - combine two aspects from our current exploration in a new way
955+
Level 5: Follow emergence - pursue interesting patterns that appeared unexpectedly in our investigation
956+
957+
Guidelines for generating variations:
958+
- Each variation should be ONE STEP away from the current inquiry
959+
- Maintain clear connection to the existing conversation context and any data present
960+
- Small changes often reveal large insights - prefer subtle over dramatic
961+
- Build variations from elements already present in our discussion
962+
- Each question should feel like a natural "what if we considered this slightly differently?"
963+
- Preserve the investigative thread while gently pulling in new directions
964+
965+
Consider how discovery actually works:
966+
- Profound insights emerge from minor adjustments in perspective
967+
- The most valuable questions are often hiding just outside our current view
968+
- Progress happens through accumulation of small exploratory steps
969+
- The adjacent possible is always only one step away
970+
971+
Ground it in the context of the conversation so far, and the given dataset. Format the response as a numbered markdown list.
972+
The Task is routed to the Research Specialist, and the response will be formatted as follows:
973+
974+
1. **question_title:**
975+
question
976+
2. **question_title:**
977+
question
978+
3. **question_title:**
979+
question
980+
4. **question_title:**
981+
question
982+
5. **question_title:**
983+
question
984+
942985
###########################################
943986
### DATAFRAME INSPECTOR AGENT PROMPTS #####
944987
###########################################

bambooai/messages/default_prompts.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,52 @@ theorist_system: |
939939
940940
Remember to tailor your response appropriately based on whether there is relevant previous context or not.
941941
942+
###########################################
943+
### EXPLORE IDEAS #########################
944+
###########################################
945+
946+
ideas_explorer: |
947+
Generate 5 questions that explore variations of our current inquiry. Each question should represent a small mutation in the problem space - subtle shifts that may reveal profound insights.
948+
949+
Variation Level: {}
950+
951+
Level descriptions (in ascending order from lovest variation to the highest):
952+
Level 1: Refine focus - adjust scope, granularity, or specific parameters within the same inquiry
953+
Level 2: Shift angle - examine the same subject from a different perspective or framework
954+
Level 3: Test boundaries - explore what happens at the edges of our current assumptions
955+
Level 4: Blend elements - combine two aspects from our current exploration in a new way
956+
Level 5: Follow emergence - pursue interesting patterns that appeared unexpectedly in our investigation
957+
958+
Your task: Generate 5 different variations, ALL at Level {}. Each question should explore a different aspect while maintaining the same variation distance from the original inquiry.
959+
960+
Guidelines for generating variations:
961+
- Each variation should be ONE STEP away from the current inquiry
962+
- Maintain clear connection to the existing conversation context and any data present
963+
- Small changes often reveal large insights - prefer subtle over dramatic
964+
- Build variations from elements already present in our discussion
965+
- Each question should feel like a natural "what if we considered this slightly differently?"
966+
- Preserve the investigative thread while gently pulling in new directions
967+
968+
Consider how discovery actually works:
969+
- Profound insights emerge from minor adjustments in perspective
970+
- The most valuable questions are often hiding just outside our current view
971+
- Progress happens through accumulation of small exploratory steps
972+
- The adjacent possible is always only one step away
973+
974+
Ground it in the context of the conversation so far, and the given dataset. Format the response as a numbered markdown list.
975+
The Task is routed to the Research Specialist, and the response will be formatted as follows:
976+
977+
1. **question_title:**
978+
question
979+
2. **question_title:**
980+
question
981+
3. **question_title:**
982+
question
983+
4. **question_title:**
984+
question
985+
5. **question_title:**
986+
question
987+
942988
###########################################
943989
### DATAFRAME INSPECTOR AGENT PROMPTS #####
944990
###########################################

bambooai/messages/prompts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"analyst_selector_system", "analyst_selector_user",
1717
"planner_system", "planner_user_gen", "planner_user_df",
1818
"planner_user_gen_reasoning", "planner_user_df_reasoning",
19-
"theorist_system", "dataframe_inspector_system", "dataframe_inspector_user",
20-
"google_search_query_generator_system", "google_search_react_system",
21-
"google_search_summarizer_system",
19+
"theorist_system", "ideas_explorer", "dataframe_inspector_system",
20+
"dataframe_inspector_user","google_search_query_generator_system",
21+
"google_search_react_system","google_search_summarizer_system",
2222
"code_generator_system_df", "code_generator_system_gen",
2323
"code_generator_user_df_plan", "code_generator_user_df_no_plan",
2424
"code_generator_user_gen_plan", "code_generator_user_gen_no_plan",

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ flask
2020
ipython
2121
nbformat
2222
python-dotenv
23-
lxml[html_clean]
23+
lxml_html_clean
2424
gunicorn
2525
google-cloud-storage
2626
statsmodels

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name='bambooai',
9-
version='0.4.19',
9+
version='0.4.20',
1010
description='A lightweight library for working with pandas dataframes using natural language queries',
1111
long_description=long_description,
1212
long_description_content_type="text/markdown",
@@ -39,7 +39,7 @@
3939
'ipython',
4040
'nbformat',
4141
'python-dotenv',
42-
'lxml[html_clean]',
42+
'lxml_html_clean',
4343
'gunicorn',
4444
'google-cloud-storage',
4545
'statsmodels',
@@ -49,6 +49,7 @@
4949
'yfinance',
5050
'sweatstack'
5151
],
52+
python_requires=">=3.10",
5253
classifiers=[
5354
'Development Status :: 3 - Alpha',
5455
'License :: OSI Approved :: MIT License',

web_app/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,10 +889,13 @@ def query():
889889
thread_id = request.json['thread_id']
890890
chain_id = request.json['chain_id']
891891
image = request.json.get('image')
892-
user_code= request.json.get('user_code')
892+
user_code = request.json.get('user_code')
893+
branching_cv = request.json.get('branching_cv')
893894

894895
if user_code:
895896
user_input = "User manually edited your code, and requested to run it, and return the result."
897+
elif branching_cv:
898+
user_input = bamboo_ai_instance.prompts.ideas_explorer.format(branching_cv, branching_cv)
896899

897900
bamboo_ai_instance.output_manager.add_user_input(user_input)
898901

web_app/static/css/styles.css

Lines changed: 138 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,6 +1836,116 @@ body, html {
18361836
opacity: 0.8;
18371837
}
18381838

1839+
/* Branching CV Icons Popup */
1840+
.branching-slider-popup {
1841+
position: absolute;
1842+
bottom: calc(100% + 10px);
1843+
left: 70px; /* Positioned to align with suggest questions button */
1844+
background: var(--dropdown-bg);
1845+
border: 1px solid var(--border-color);
1846+
border-radius: 8px;
1847+
padding: 4px;
1848+
display: none;
1849+
flex-direction: column;
1850+
gap: 2px;
1851+
min-width: 40px;
1852+
box-shadow: 0 2px 10px var(--shadow-color);
1853+
z-index: 1000;
1854+
}
1855+
1856+
.branching-slider-popup::before {
1857+
content: '';
1858+
position: absolute;
1859+
bottom: -10px;
1860+
left: 0;
1861+
width: 100%;
1862+
height: 10px;
1863+
}
1864+
1865+
.branching-slider-popup::after {
1866+
content: '';
1867+
position: absolute;
1868+
bottom: -5px;
1869+
left: 20px;
1870+
transform: rotate(45deg);
1871+
width: 10px;
1872+
height: 10px;
1873+
background: var(--dropdown-bg);
1874+
border-right: 1px solid var(--border-color);
1875+
border-bottom: 1px solid var(--border-color);
1876+
}
1877+
1878+
.branching-icon {
1879+
background: none;
1880+
border: none;
1881+
cursor: pointer;
1882+
color: var(--text-secondary);
1883+
display: flex;
1884+
align-items: center;
1885+
justify-content: center;
1886+
padding: 6px;
1887+
border-radius: 4px;
1888+
transition: all 0.2s;
1889+
width: 100%;
1890+
}
1891+
1892+
/* Size scaling from smallest to largest */
1893+
.branching-icon[data-value="1"] svg {
1894+
width: 14px;
1895+
height: 14px;
1896+
}
1897+
1898+
.branching-icon[data-value="2"] svg {
1899+
width: 16px;
1900+
height: 16px;
1901+
}
1902+
1903+
.branching-icon[data-value="3"] svg {
1904+
width: 18px;
1905+
height: 18px;
1906+
}
1907+
1908+
.branching-icon[data-value="4"] svg {
1909+
width: 20px;
1910+
height: 20px;
1911+
}
1912+
1913+
.branching-icon[data-value="5"] svg {
1914+
width: 22px;
1915+
height: 22px;
1916+
}
1917+
1918+
.branching-icon svg {
1919+
stroke: currentColor;
1920+
fill: none;
1921+
transition: all 0.2s;
1922+
}
1923+
1924+
.branching-icon:hover {
1925+
background: var(--bg-tertiary);
1926+
color: var(--accent-color);
1927+
}
1928+
1929+
/* Dark theme adjustments */
1930+
[data-theme="dark"] .branching-slider-popup {
1931+
background: var(--dropdown-bg);
1932+
border-color: var(--border-color);
1933+
}
1934+
1935+
[data-theme="dark"] .branching-slider-popup::after {
1936+
background: var(--dropdown-bg);
1937+
border-color: var(--border-color);
1938+
}
1939+
1940+
[data-theme="dark"] .branching-icon {
1941+
color: var(--text-secondary);
1942+
}
1943+
1944+
[data-theme="dark"] .branching-icon:hover {
1945+
color: var(--accent-color);
1946+
background: var(--bg-tertiary);
1947+
}
1948+
18391949
.switch-container {
18401950
display: flex;
18411951
align-items: center;
@@ -2958,32 +3068,39 @@ code.language-json {
29583068
color: var(--text-tertiary);
29593069
}
29603070

2961-
/* Theme Toggle Styles */
3071+
/* Theme Toggle in Settings Menu - Match existing menu items exactly */
3072+
.theme-toggle-option .sun-icon,
3073+
.theme-toggle-option .moon-icon {
3074+
width: 20px;
3075+
height: 20px;
3076+
stroke: currentColor;
3077+
/* Remove any margin - let the default gap: 8px from .menu-option handle spacing */
3078+
}
3079+
3080+
.theme-toggle-option .theme-label {
3081+
font-size: 14px; /* Match other menu item text */
3082+
}
3083+
3084+
/* Hide old theme toggle container */
29623085
.theme-toggle-container {
2963-
display: inline-block;
2964-
margin-left: 10px;
3086+
display: none;
29653087
}
29663088

2967-
.theme-toggle {
2968-
background: none;
2969-
border: none;
2970-
padding: 4px;
2971-
cursor: pointer;
2972-
color: var(--accent-color);
2973-
display: flex;
2974-
align-items: center;
2975-
justify-content: center;
2976-
transition: transform 0.2s;
3089+
/* Fix submenu trigger - be very specific */
3090+
.integrations-menu-item .integrations-option:hover + .integrations-submenu,
3091+
.integrations-submenu:hover {
3092+
display: flex !important;
29773093
}
29783094

2979-
.theme-toggle:hover {
2980-
transform: scale(1.1);
3095+
/* Ensure the general hover rule doesn't apply to other elements */
3096+
.integrations-menu-item:hover .integrations-submenu {
3097+
display: none !important;
29813098
}
29823099

2983-
.theme-toggle svg {
2984-
width: 20px;
2985-
height: 20px;
2986-
stroke: currentColor;
3100+
/* Only show submenu when hovering specifically over the integrations option or the submenu itself */
3101+
.integrations-menu-item .integrations-option:hover + .integrations-submenu,
3102+
.integrations-menu-item .integrations-submenu:hover {
3103+
display: flex !important;
29873104
}
29883105

29893106
/* Search Results Styles */
@@ -3530,7 +3647,7 @@ code.language-json {
35303647
margin-top: 0; /* Remove top margin */
35313648
}
35323649

3533-
#workflowMapContainer g.node:hover rect {
3650+
#workflowMapContainer g.node:hover * {
35343651
stroke: var(--accent-color) !important;
35353652
stroke-width: 1px !important;
35363653
}
@@ -3894,7 +4011,7 @@ code.language-json {
38944011
border: none;
38954012
padding: 0;
38964013
cursor: pointer;
3897-
color: var(--text-tertiary) !important;
4014+
color: var(--text-secondary) !important;
38984015
width: 28px;
38994016
height: 28px;
39004017
display: flex;

web_app/static/js/content-rendering.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ async function handleQuerySubmission(e) {
259259
//--------------------
260260

261261
function createOrUpdateTab(type, data, id = null, format = null) {
262+
// Skip creating query tab entirely if answerTabInteractive is true
263+
if (type === 'query' && answerTabInteractive) {
264+
return;
265+
}
266+
262267
const tabContainer = document.getElementById('tabContainer');
263268
const contentOutput = document.getElementById('contentOutput');
264269
let tab = document.getElementById(`tab-${type}`);
@@ -269,7 +274,11 @@ function createOrUpdateTab(type, data, id = null, format = null) {
269274
tab = document.createElement('div');
270275
tab.id = `tab-${type}`;
271276
tab.className = 'tab';
272-
tab.textContent = type.charAt(0).toUpperCase() + type.slice(1);
277+
278+
// Change "Answer" to "Explore" if answerTabInteractive is true
279+
const tabName = (type === 'answer' && answerTabInteractive) ? 'Explore' : type.charAt(0).toUpperCase() + type.slice(1);
280+
tab.textContent = tabName;
281+
273282
tab.onclick = () => activateTab(type);
274283
tabContainer.appendChild(tab);
275284

@@ -377,7 +386,10 @@ async function updateTabContent(type, data, id = null, format = null) {
377386
break;
378387
case 'answer': {
379388
console.log('Processing answer case');
380-
content = `<h3>${type.charAt(0).toUpperCase() + type.slice(1)}:</h3>`;
389+
390+
// Change header text based on answerTabInteractive
391+
const headerText = answerTabInteractive ? 'Explore' : type.charAt(0).toUpperCase() + type.slice(1);
392+
content = `<h3>${headerText}:</h3>`;
381393

382394
// First protect LaTeX content
383395
const { text: protectedContent, placeholders } = protectLatexDelimiters(data);

0 commit comments

Comments
 (0)