Lucas ARRIESSE commited on
Commit
c203651
·
1 Parent(s): fe6b7e9

Make FTO topic count configurable

Browse files
prompts/private/fto_topics.txt CHANGED
@@ -2,7 +2,7 @@
2
  <task>
3
  You are tasked with giving a list of topics to investigate for freedom-to-operate from a given idea.
4
  You will be given an idea and you need to list all the topics or concepts that should be explored in a FTO analysis to make sure the idea is exploitable.
5
- Please give at most the 4 most important ideas or concepts to explore.
6
  </task>
7
 
8
  <idea>
 
2
  <task>
3
  You are tasked with giving a list of topics to investigate for freedom-to-operate from a given idea.
4
  You will be given an idea and you need to list all the topics or concepts that should be explored in a FTO analysis to make sure the idea is exploitable.
5
+ Please give at most the {{max_topic_count}} most important ideas or concepts to explore.
6
  </task>
7
 
8
  <idea>
static/index.html CHANGED
@@ -351,7 +351,8 @@
351
  <p id="assessment-recommendation-summary">A short resumé of the patcom
352
  sayings should go there.</p>
353
  </div>
354
- <button class="btn btn-ghost font-bold" id="read-assessment-button">Read whole assessment</button>
 
355
  </div>
356
 
357
  <div class="divider my-1"></div>
@@ -367,12 +368,15 @@
367
  <!-- User insights-->
368
  <div class="max-w space-y-2">
369
  <p class="font-bold text-lg">User insights</p>
370
- <p class="text-m text-base-content/70">You can provide here additional guidance for selected refinement insights above, or provide a customized additional insight.</p>
 
 
371
  <textarea id="user-insight-text" class="textarea w-full" style="height: 197px;">
372
  </textarea>
373
  </div>
374
  <div class="card-actions justify-end mt-6">
375
- <button id="fto-analysis-btn" class="btn btn-warning">Perform FTO on draft</button>
 
376
  <button id="refine-btn" class="btn btn-primary">Refine draft</button>
377
  </div>
378
  </div>
@@ -460,6 +464,29 @@
460
  class="textarea textarea-bordered w-full h-48"
461
  placeholder="Enter your portfolio info here..."></textarea>
462
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  <p class="py-4">⚠ 'Save configuration' to keep the current configuration across sessions.</p>
464
  </div>
465
  <div class="mt-2 space-x-2">
 
351
  <p id="assessment-recommendation-summary">A short resumé of the patcom
352
  sayings should go there.</p>
353
  </div>
354
+ <button class="btn btn-ghost font-bold" id="read-assessment-button">Read whole
355
+ assessment</button>
356
  </div>
357
 
358
  <div class="divider my-1"></div>
 
368
  <!-- User insights-->
369
  <div class="max-w space-y-2">
370
  <p class="font-bold text-lg">User insights</p>
371
+ <p class="text-m text-base-content/70">You can provide here additional guidance
372
+ for selected refinement insights above, or provide a customized additional
373
+ insight.</p>
374
  <textarea id="user-insight-text" class="textarea w-full" style="height: 197px;">
375
  </textarea>
376
  </div>
377
  <div class="card-actions justify-end mt-6">
378
+ <button id="fto-analysis-btn" class="btn btn-warning">Perform FTO on
379
+ draft</button>
380
  <button id="refine-btn" class="btn btn-primary">Refine draft</button>
381
  </div>
382
  </div>
 
464
  class="textarea textarea-bordered w-full h-48"
465
  placeholder="Enter your portfolio info here..."></textarea>
466
  </div>
467
+ <h2 class="text-lg font-bold">FTO analysis</h2>
468
+ <p class="py-4">Configure the max numbers of topics explored in the FTO analysis.</p>
469
+ <div class="w-full max-w-xs">
470
+ <label for="settings-fto-topic-count">Number of topics to explore for FTO</label>
471
+ <input id="settings-fto-topic-count" name="settings-fto-topic-count" type="range" min="1" max="10" value="4" class="range" step="1" />
472
+ <!--c moche mais ca marche-->
473
+ <div class="flex justify-between px-2.5 mt-2 text-xs">
474
+ <span>|</span>
475
+ <span></span>
476
+ <span>|</span>
477
+ <span></span>
478
+ <span></span>
479
+ <span>|</span>
480
+ </div>
481
+ <div class="flex justify-between px-2.5 mt-2 text-xs">
482
+ <span>1</span>
483
+ <span></span>
484
+ <span>5</span>
485
+ <span></span>
486
+ <span></span>
487
+ <span>10</span>
488
+ </div>
489
+ </div>
490
  <p class="py-4">⚠ 'Save configuration' to keep the current configuration across sessions.</p>
491
  </div>
492
  <div class="mt-2 space-x-2">
static/js/gen.js CHANGED
@@ -256,13 +256,14 @@ const FTOAnalysisTopicsSchema = zod.object({
256
  /**
257
  * Extract the topics to search for FTO
258
  */
259
- async function getFtoAnalysisTopics(providerUrl, modelName, apiKey, idea) {
260
  const template = await retrieveTemplate("fto_topics");
261
 
262
  const structured_template = formatTemplate(template, {
263
  "problem_description": idea.problem_description,
264
  "solution_description": idea.solution_description,
265
  "response_schema": zod.toJSONSchema(FTOAnalysisTopicsSchema),
 
266
  });
267
 
268
  const topics = await generateStructuredCompletion(providerUrl, modelName, apiKey, [{ role: "user", content: structured_template }], FTOAnalysisTopicsSchema);
@@ -300,8 +301,8 @@ async function assessFTOReport(providerUrl, modelName, apiKey, solution, fto_rep
300
  return { assessment_full, extracted_info };
301
  }
302
 
303
- export async function runFTOAnalysis(providerUrl, providerModel, apiKey, solution, portfolio_info) {
304
- const fto_topics = await getFtoAnalysisTopics(providerUrl, providerModel, apiKey, solution);
305
  console.log(fto_topics);
306
 
307
  const fto_report = await performDeepSearch(fto_topics.topics);
 
256
  /**
257
  * Extract the topics to search for FTO
258
  */
259
+ async function getFtoAnalysisTopics(providerUrl, modelName, apiKey, idea, count) {
260
  const template = await retrieveTemplate("fto_topics");
261
 
262
  const structured_template = formatTemplate(template, {
263
  "problem_description": idea.problem_description,
264
  "solution_description": idea.solution_description,
265
  "response_schema": zod.toJSONSchema(FTOAnalysisTopicsSchema),
266
+ "max_topic_count": count
267
  });
268
 
269
  const topics = await generateStructuredCompletion(providerUrl, modelName, apiKey, [{ role: "user", content: structured_template }], FTOAnalysisTopicsSchema);
 
301
  return { assessment_full, extracted_info };
302
  }
303
 
304
+ export async function runFTOAnalysis(providerUrl, providerModel, apiKey, solution, portfolio_info, ftoTopicCount) {
305
+ const fto_topics = await getFtoAnalysisTopics(providerUrl, providerModel, apiKey, solution, ftoTopicCount);
306
  console.log(fto_topics);
307
 
308
  const fto_report = await performDeepSearch(fto_topics.topics);
static/js/persistence.js CHANGED
@@ -1,5 +1,5 @@
1
  // clées utilisées pour la generation avec private compute
2
- const CONFIG_KEYS = ["providerUrl", "providerToken", "providerModel", "assessmentRules", "businessPortfolio"];
3
  // clée pour marquer si la config est remplie.
4
  const POPULATED_CONFIG_KEY = "_config_populated";
5
 
 
1
  // clées utilisées pour la generation avec private compute
2
+ const CONFIG_KEYS = ["providerUrl", "providerToken", "providerModel", "assessmentRules", "businessPortfolio", "ftoTopicCount"];
3
  // clée pour marquer si la config est remplie.
4
  const POPULATED_CONFIG_KEY = "_config_populated";
5
 
static/js/ui.js CHANGED
@@ -358,8 +358,9 @@ export function getConfigFields() {
358
  const providerModel = document.getElementById('settings-provider-model').value;
359
  const assessmentRules = document.getElementById('settings-assessment-rules').value;
360
  const businessPortfolio = document.getElementById('settings-portfolio').value;
 
361
 
362
- return { providerUrl, providerToken, providerModel, assessmentRules, businessPortfolio };
363
  }
364
 
365
  /**
@@ -434,11 +435,13 @@ export function handleLoadConfigFields() {
434
  const providerModel = document.getElementById('settings-provider-model');
435
  const assessmentRules = document.getElementById('settings-assessment-rules');
436
  const businessPortfolio = document.getElementById('settings-portfolio');
 
437
 
438
  providerUrl.value = configuration.providerUrl;
439
  providerToken.value = configuration.providerToken;
440
  assessmentRules.value = configuration.assessmentRules;
441
  businessPortfolio.value = configuration.businessPortfolio;
 
442
 
443
  // on doit d'abord recup les modeles avant de set la valeur
444
  populateLLMModelSelect('settings-provider-model', configuration.providerUrl, configuration.providerToken).then(() => {
@@ -688,14 +691,14 @@ function jumpToDraft(index) {
688
  }
689
 
690
  export function handleFTOAnalysis() {
691
- const { providerUrl, providerToken, providerModel, businessPortfolio } = getConfigFields();
692
  const currentState = draftHistory[draftCurrentIndex];
693
 
694
  console.log("Launching FTO analysis");
695
 
696
  showLoadingOverlay("Running FTO analysis... This may take a while");
697
 
698
- runFTOAnalysis(providerUrl, providerModel, providerToken, currentState.solution, businessPortfolio)
699
  .then(result => {
700
  // map from a list of insights to a selectable list of insights
701
  const newInsights = result.extracted_info.insights.map((e, idx, __) => ({ id: idx, text: e, checked: false }));
 
358
  const providerModel = document.getElementById('settings-provider-model').value;
359
  const assessmentRules = document.getElementById('settings-assessment-rules').value;
360
  const businessPortfolio = document.getElementById('settings-portfolio').value;
361
+ const ftoTopicCount = document.getElementById('settings-fto-topic-count').value;
362
 
363
+ return { providerUrl, providerToken, providerModel, assessmentRules, businessPortfolio, ftoTopicCount };
364
  }
365
 
366
  /**
 
435
  const providerModel = document.getElementById('settings-provider-model');
436
  const assessmentRules = document.getElementById('settings-assessment-rules');
437
  const businessPortfolio = document.getElementById('settings-portfolio');
438
+ const ftoTopicCount = document.getElementById('settings-fto-topic-count');
439
 
440
  providerUrl.value = configuration.providerUrl;
441
  providerToken.value = configuration.providerToken;
442
  assessmentRules.value = configuration.assessmentRules;
443
  businessPortfolio.value = configuration.businessPortfolio;
444
+ ftoTopicCount.value = configuration.ftoTopicCount;
445
 
446
  // on doit d'abord recup les modeles avant de set la valeur
447
  populateLLMModelSelect('settings-provider-model', configuration.providerUrl, configuration.providerToken).then(() => {
 
691
  }
692
 
693
  export function handleFTOAnalysis() {
694
+ const { providerUrl, providerToken, providerModel, businessPortfolio, ftoTopicCount } = getConfigFields();
695
  const currentState = draftHistory[draftCurrentIndex];
696
 
697
  console.log("Launching FTO analysis");
698
 
699
  showLoadingOverlay("Running FTO analysis... This may take a while");
700
 
701
+ runFTOAnalysis(providerUrl, providerModel, providerToken, currentState.solution, businessPortfolio, ftoTopicCount)
702
  .then(result => {
703
  // map from a list of insights to a selectable list of insights
704
  const newInsights = result.extracted_info.insights.map((e, idx, __) => ({ id: idx, text: e, checked: false }));