@fractal-solutions/qflow 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -806,7 +806,7 @@ Storing and retrieving text-based memories for lightweight Retrieval-Augmented G
|
|
|
806
806
|
|
|
807
807
|
```javascript
|
|
808
808
|
import { AsyncFlow } from '@fractal-solutions/qflow';
|
|
809
|
-
import { MemoryNode,
|
|
809
|
+
import { MemoryNode, DeepSeekLLMNode } from '@fractal-solutions/qflow/nodes';
|
|
810
810
|
|
|
811
811
|
const DEEPSEEK_API_KEY = process.env.DEEPSEEK_API_KEY;
|
|
812
812
|
|
|
@@ -846,18 +846,18 @@ const DEEPSEEK_API_KEY = process.env.DEEPSEEK_API_KEY;
|
|
|
846
846
|
});
|
|
847
847
|
|
|
848
848
|
// 4. Use an LLM to answer a question based on retrieved memories
|
|
849
|
-
const ragLLM = new
|
|
850
|
-
ragLLM.setParams({ apiKey: DEEPSEEK_API_KEY });
|
|
851
|
-
|
|
852
|
-
ragRetrieve.next(ragLLM);
|
|
853
|
-
|
|
849
|
+
const ragLLM = new DeepSeekLLMNode();
|
|
854
850
|
ragLLM.preparePrompt = (shared) => {
|
|
855
851
|
const retrievedContent = shared.memoryResult.map(mem => mem.content).join('\n\n');
|
|
856
852
|
ragLLM.setParams({
|
|
857
|
-
|
|
853
|
+
apiKey: DEEPSEEK_API_KEY,
|
|
854
|
+
prompt: `Based on the following context, answer the question:\n\nContext:\n${retrievedContent}\n\nQuestion: What is the main role of a CPU?`,
|
|
855
|
+
keyword: 'rag_llm'
|
|
858
856
|
});
|
|
859
857
|
};
|
|
860
858
|
|
|
859
|
+
ragRetrieve.next(ragLLM);
|
|
860
|
+
|
|
861
861
|
const ragFlow = new AsyncFlow(ragRetrieve);
|
|
862
862
|
try {
|
|
863
863
|
const ragResult = await ragFlow.runAsync({});
|
|
@@ -869,7 +869,7 @@ const DEEPSEEK_API_KEY = process.env.DEEPSEEK_API_KEY;
|
|
|
869
869
|
|
|
870
870
|
console.log('\n--- MemoryNode RAG Example Finished ---');
|
|
871
871
|
})();
|
|
872
|
-
|
|
872
|
+
`````
|
|
873
873
|
|
|
874
874
|
## Exploring More Examples
|
|
875
875
|
|
package/package.json
CHANGED