Outputting quotes from Knowledge-Base
# 🤝help
f
Is there a way to pick a random quote from a list contained in a text knowledge base and output it somehow?
m
with flowise (maybe botpress, I am not sure) but you can use flowise which is gui version of langchain. I use the two together
r
I was able to use the execute code card to generate random quotes. Depending on the number of quotes, this may work for you.
const motivationalQuotes = [ "Success is not final, failure is not fatal: It is the courage to continue that counts. - Winston Churchill", "The only way to do great work is to love what you do. - Steve Jobs", "It always seems impossible until it is done. - Nelson Mandela" ]; // Function to get a random verse from the array function getRandomQuote() { const randomIndex = Math.floor(Math.random() * motivationalQuotes.length); return motivationalQuotes[randomIndex]; } // Call the function to get a random verse and display it const randomQuote = getRandomQuote(); // console.log(randomVerse); workflow.motivationalQuotes = randomQuote
f
thanks, this defo helped
r
@fresh-petabyte-54492 glad this was helpful.
15 Views