Lucas ARRIESSE
commited on
Commit
·
4fd597d
1
Parent(s):
2a7f67c
Implement FTO
Browse files- prompts/private/fto_assess.txt +29 -0
- static/js/gen.js +55 -1
- static/js/ui.js +20 -12
prompts/private/fto_assess.txt
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<role> You are a patent attorney expert, critical and no sugarcoating. </role>
|
2 |
+
<task>
|
3 |
+
You will be provided with the reports of a comprehensive freedom-to-operate analysis, a potentially patentable idea and have to determine
|
4 |
+
whether any of the inventions found in the report potentially infringe partially or totally the presented solution, and how they infringe.
|
5 |
+
Perform a full-blown analysis.
|
6 |
+
Finally end your analysis by stating whether the idea is a "NO-GO" (completely blocked by infringing inventions), "CONDITIONAL-GO" (partially for the most part of the invention), "IMMEDIATE-GO" (little to no infringement) and provide a list of actionnable insights.
|
7 |
+
The actionnable insights should help steer the idea in a direction that may bypass some potential infringement while still considering the business line.
|
8 |
+
</task>
|
9 |
+
|
10 |
+
<business>
|
11 |
+
Here's the business line
|
12 |
+
{{business}}
|
13 |
+
</business>
|
14 |
+
|
15 |
+
<idea>
|
16 |
+
**The idea is as follows:**
|
17 |
+
|
18 |
+
## Problem description
|
19 |
+
{{problem_description}}
|
20 |
+
|
21 |
+
## Solution description
|
22 |
+
{{solution_description}}
|
23 |
+
</idea>
|
24 |
+
|
25 |
+
|
26 |
+
<fto_report>
|
27 |
+
**Here's the FTO report:**
|
28 |
+
{{fto_report}}
|
29 |
+
</fto_report>
|
static/js/gen.js
CHANGED
@@ -38,6 +38,7 @@ export async function performDeepSearch(topics) {
|
|
38 |
body: JSON.stringify({ topics: topics })
|
39 |
});
|
40 |
const results = await response.json();
|
|
|
41 |
}
|
42 |
|
43 |
/**
|
@@ -244,12 +245,18 @@ export async function refineSolution(providerUrl, modelName, apiKey, solution, i
|
|
244 |
return newSolution;
|
245 |
}
|
246 |
|
|
|
|
|
|
|
247 |
// JS schema for FTO analysis topic extraction
|
248 |
const FTOAnalysisTopicsSchema = zod.object({
|
249 |
topics: zod.array(zod.string())
|
250 |
});
|
251 |
|
252 |
-
|
|
|
|
|
|
|
253 |
const template = await retrieveTemplate("fto_topics");
|
254 |
|
255 |
const structured_template = formatTemplate(template, {
|
@@ -263,3 +270,50 @@ export async function getFtoAnalysisTopics(providerUrl, modelName, apiKey, idea)
|
|
263 |
return topics;
|
264 |
}
|
265 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
body: JSON.stringify({ topics: topics })
|
39 |
});
|
40 |
const results = await response.json();
|
41 |
+
return results.content;
|
42 |
}
|
43 |
|
44 |
/**
|
|
|
245 |
return newSolution;
|
246 |
}
|
247 |
|
248 |
+
|
249 |
+
// FTO analysis
|
250 |
+
|
251 |
// JS schema for FTO analysis topic extraction
|
252 |
const FTOAnalysisTopicsSchema = zod.object({
|
253 |
topics: zod.array(zod.string())
|
254 |
});
|
255 |
|
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, {
|
|
|
270 |
return topics;
|
271 |
}
|
272 |
|
273 |
+
/*
|
274 |
+
* Assess the infringement of the idea wrt
|
275 |
+
*/
|
276 |
+
async function assessFTOReport(providerUrl, modelName, apiKey, solution, fto_report, portfolio_info) {
|
277 |
+
const template = await retrieveTemplate("fto_assess");
|
278 |
+
|
279 |
+
const assessment_template = formatTemplate(template, {
|
280 |
+
business: portfolio_info,
|
281 |
+
fto_report: fto_report,
|
282 |
+
problem_description: solution.problem_description,
|
283 |
+
solution_description: solution.solution_description,
|
284 |
+
});
|
285 |
+
|
286 |
+
const assessment_full = await generateCompletion(providerUrl, modelName, apiKey, [
|
287 |
+
{ role: "user", content: assessment_template }
|
288 |
+
]);
|
289 |
+
|
290 |
+
const structured_template = await retrieveTemplate("extract");
|
291 |
+
const structured_filled_template = formatTemplate(structured_template, {
|
292 |
+
"report": assessment_full,
|
293 |
+
"response_schema": zod.toJSONSchema(StructuredAssessmentOutput)
|
294 |
+
})
|
295 |
+
|
296 |
+
const extracted_info = await generateStructuredCompletion(providerUrl, modelName, apiKey, [{ role: "user", content: structured_filled_template }], StructuredAssessmentOutput);
|
297 |
+
|
298 |
+
return { assessment_full, extracted_info };
|
299 |
+
}
|
300 |
+
|
301 |
+
export async function runFTOAnalysis(providerUrl, providerModel, apiKey, solution, portfolio_info) {
|
302 |
+
const fto_topics = await getFtoAnalysisTopics(providerUrl, providerModel, apiKey, solution);
|
303 |
+
console.log(fto_topics);
|
304 |
+
|
305 |
+
const fto_report = await performDeepSearch(fto_topics.topics);
|
306 |
+
|
307 |
+
console.log(fto_report);
|
308 |
+
|
309 |
+
const assess_results = await assessFTOReport(providerUrl, providerModel, apiKey, solution, fto_report, portfolio_info);
|
310 |
+
console.log(assess_results.extracted_info);
|
311 |
+
|
312 |
+
return {
|
313 |
+
fto_topics: fto_topics,
|
314 |
+
fto_report: fto_report,
|
315 |
+
assessment_full: assess_results.assessment_full,
|
316 |
+
extracted_info: assess_results.extracted_info,
|
317 |
+
};
|
318 |
+
|
319 |
+
}
|
static/js/ui.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import { marked } from 'https://cdnjs.cloudflare.com/ajax/libs/marked/16.1.1/lib/marked.esm.js';
|
2 |
-
import { assessSolution, getModelList, refineSolution,
|
3 |
import { clearConfig, loadConfig, saveConfig } from "./persistence.js";
|
4 |
|
5 |
// =============================================================================
|
@@ -537,6 +537,7 @@ function renderDraftTimeline(timelineContainer, currentIndex, drafts) {
|
|
537 |
const li = document.createElement('li');
|
538 |
li.className = `step ${idx <= currentIndex ? 'step-primary' : ''}`;
|
539 |
li.textContent = `Draft #${idx + 1}`;
|
|
|
540 |
li.onclick = () => jumpToDraft(idx);
|
541 |
timelineContainer.appendChild(li);
|
542 |
});
|
@@ -668,23 +669,30 @@ function jumpToDraft(index) {
|
|
668 |
}
|
669 |
|
670 |
export function handleFTOAnalysis() {
|
671 |
-
const { providerUrl, providerToken, providerModel } = getConfigFields();
|
672 |
const currentState = draftHistory[draftCurrentIndex];
|
673 |
|
674 |
console.log("Launching FTO analysis");
|
675 |
|
676 |
-
showLoadingOverlay("
|
677 |
|
678 |
-
|
679 |
-
.then(
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
686 |
})
|
687 |
-
.catch(e => alert(
|
688 |
.finally(() => hideLoadingOverlay());
|
689 |
}
|
690 |
|
|
|
1 |
import { marked } from 'https://cdnjs.cloudflare.com/ajax/libs/marked/16.1.1/lib/marked.esm.js';
|
2 |
+
import { assessSolution, getModelList, refineSolution, runFTOAnalysis } from "./gen.js"
|
3 |
import { clearConfig, loadConfig, saveConfig } from "./persistence.js";
|
4 |
|
5 |
// =============================================================================
|
|
|
537 |
const li = document.createElement('li');
|
538 |
li.className = `step ${idx <= currentIndex ? 'step-primary' : ''}`;
|
539 |
li.textContent = `Draft #${idx + 1}`;
|
540 |
+
li.setAttribute('data-content', state.type == "draft" ? "D" : "F")
|
541 |
li.onclick = () => jumpToDraft(idx);
|
542 |
timelineContainer.appendChild(li);
|
543 |
});
|
|
|
669 |
}
|
670 |
|
671 |
export function handleFTOAnalysis() {
|
672 |
+
const { providerUrl, providerToken, providerModel, businessPortfolio } = getConfigFields();
|
673 |
const currentState = draftHistory[draftCurrentIndex];
|
674 |
|
675 |
console.log("Launching FTO analysis");
|
676 |
|
677 |
+
showLoadingOverlay("Running FTO analysis...");
|
678 |
|
679 |
+
runFTOAnalysis(providerUrl, providerModel, providerToken, currentState.solution, businessPortfolio)
|
680 |
+
.then(result => {
|
681 |
+
// map from a list of insights to a selectable list of insights
|
682 |
+
const newInsights = result.extracted_info.insights.map((e, idx, __) => ({ id: idx, text: e, checked: false }));
|
683 |
+
|
684 |
+
draftHistory.push({
|
685 |
+
type: "fto",
|
686 |
+
solution: currentState.solution,
|
687 |
+
insights: newInsights,
|
688 |
+
assessment_full: result.assessment_full,
|
689 |
+
final_verdict: result.extracted_info.final_verdict,
|
690 |
+
assessment_summary: result.extracted_info.summary,
|
691 |
+
});
|
692 |
+
|
693 |
+
draftCurrentIndex++;
|
694 |
})
|
695 |
+
.catch(e => alert(e))
|
696 |
.finally(() => hideLoadingOverlay());
|
697 |
}
|
698 |
|