Below are some common flow types that can be implemented with LLM Stack. These flow types have associated sample apps.
But users are not limited to only these flow types.
VectorStoreManagement
A flow designed to create and update a vector store that can be reused by other flows, such as QuestionAnswering or Search.
type:flowname:Sample Vector Store Builder from a websitedescription:Sample Vector Store Builder from a websiteflow_type:VectorStoreManagementinput:-name:urldescription:The website address to load data fromtype:stringrequired:falsetasks:-name:WebLoaderdescription:Load data from a web page or from remote filestype:schema.task.content_loader.WebLoaderinput:recursive:trueurl:$inputs.urlmax_urls:10start_selector_type:class_namestart_element:contenttask_config:retries:0timeout_seconds:30persist_result:truecache_result:truecache_expiration:5m-name:CharacterTextSplitterdescription:Split text into chunkstype:schema.task.text_splitter.CharacterTextSplitterinput:documents:$WebLoader.outputseparator:"\n##"chunk_size:300chunk_overlap:20task_config:retries:0timeout_seconds:30persist_result:truecache_result:truecache_expiration:5m-name:EmbeddingsModeldescription:Embeddings Embeddingstype:schema.task.embedding.EmbeddingsModelinput:mode:documentsdocuments:$CharacterTextSplitter.outputprovider:openaimodel_name:text-embedding-ada-002batch_size:32task_config:retries:3timeout_seconds:90persist_result:truecache_result:truecache_expiration:5m-name:QdrantBuilderdescription:Build a vector storetype:schema.task.vector_store_builder.QdrantBuilderinput:embeddings:$EmbeddingsModel.outputcollection_name:test_collectiontask_config:retries:1timeout_seconds:10persist_result:truecache_result:falsecache_expiration:""output:-name:collection_namevalue:$QdrantBuilder.output-name:documentsvalue:$CharacterTextSplitter.output
QuestionAnswering
A flow specifically developed to support Question Answering applications, such as the IM8 Q&A bot. It leverages an LLM to understand questions and provide accurate and relevant answers based on provided context.
type:flowname:"MyWebsiteQ&ABot"flow_type:QuestionAnsweringinput:-name:the_urldescription:The URL of the website to load contenttype:stringdefault:https://www.washingtonpost.com/technology/2023/05/16/sam-altman-open-ai-congress-hearing/-name:the_questiondescription:The question to ask on the website contenttype:stringrequired:truetasks:-name:MyWebPageContentLoaderdescription:Load text content from a webpagetype:schema.task.content_loader.WebLoaderinput:url:$inputs.the_urltask_config:retries:3timeout_seconds:10cache_result:truecache_expiration:24h-name:MyLLMdescription:Use LLM to generate answer based on retrieve documentstype:schema.task.llm.ChatLLMinput:messages:-type:systemcontent:|You are Q&A Chat Bot. Use the provided context to answer question.If you don't know the answer, just say "Sorry, I don't know the answer to this", don't try to make up an answer.-type:usercontent:|Context:{{ MyWebPageContentLoader.output[0].content }}Question: {{ inputs.question }}provider:openaimodel_name:gpt-3.5-turbotemperature:0max_tokens:256task_config:retries:1timeout_seconds:30cache_result:truecache_expiration:24houtput:-name:llm_responsevalue:$MyLLM.output
type:flowname:Sample Question Answering Flow using existing vector storedescription:Sample Question Answering Flow using existing vector storeflow_type:QuestionAnsweringinput:-name:questiondescription:Question from usertype:stringrequired:falsetasks:-name:EmbeddingsModeldescription:Embeddingstype:schema.task.embedding.EmbeddingsModelinput:mode:querydocuments:nullprovider:openaimodel_name:text-embedding-ada-002batch_size:32query:$inputs.questiontask_config:retries:3timeout_seconds:90persist_result:truecache_result:truecache_expiration:5m-name:QdrantRetrieverdescription:Retrieve documents from a vector storetype:schema.task.retriever.QdrantRetrieverinput:embeddings:$EmbeddingsModel.outputcollection_name:test_collectiontask_config:retries:1timeout_seconds:30persist_result:truecache_result:truecache_expiration:5m-name:ChatLLMdescription:Use LLM to generate answer based on retrieve documentstype:schema.task.llm.ChatLLMinput:messages:-type:systemcontent:>You are a Question Answering Bot. You can provide questions based on given context.If you don't know the answer, just say that you don't know. Don't try to make up an answer.Always include sources the answer in the format: 'Source: source1' or 'Sources: source1 source2'.-type:usercontent:|-Context:{%- for doc in QdrantRetriever.output %}Content: {{ doc.content }}Source: {{ doc.metadata.source }}{%- endfor %}Question: {{ inputs.question }}provider:openaimodel_name:gpt-3.5-turbotemperature:0max_tokens:512task_config:retries:1timeout_seconds:30persist_result:truecache_result:truecache_expiration:5moutput:-name:llm_responsevalue:$ChatLLM.output-name:documentsvalue:$QdrantRetriever.output
Search
A flow dedicated to supporting Search applications, particularly site search. It enables users to search for information within a specific domain or dataset, returning relevant results based on the provided query.
Examples
TBD
Summarization
A flow aimed at generating concise summaries of long texts. It uses an LLM to distill the key information and main points from a given text.
type:flowflow_type:Summarizationname:Sample summarizer from a web pageinput:-name:the_urldescription:The URL of the website to load contenttype:stringdefault:https://www.washingtonpost.com/technology/2023/05/16/sam-altman-open-ai-congress-hearing/tasks:-name:MyWebPageContentLoaderdescription:Load text content from a webpagetype:schema.task.content_loader.WebLoaderinput:url:$inputs.the_urlsave_path:/tmptask_config:retries:3timeout_seconds:10cache_result:truecache_expiration:24h-name:SampleRecursiveTextSplitterdescription:Recursively split text into chunkstype:schema.task.text_splitter.RecursiveCharacterTextSplitterinput:documents:$ContentLoader.outputseparators:["\n\n","\n"]chunk_size:4000chunk_overlap:0task_config:retries:0timeout_seconds:5persist_result:truecache_result:truecache_expiration:5m-name:MyLLMdescription:Use Summarize LLM to generate summary based on texttype:schema.task.llm.SummarizeLLMinput:documents:$SampleRecursiveTextSplitter.outputprovider:openaimodel_name:gpt-3.5-turbotemperature:0max_tokens:4096task_config:retries:0timeout_seconds:120persist_result:truecache_result:truecache_expiration:5moutput:-name:summaryvalue:$MyLLM.output
Classfication
A flow to classify text into predefined categories or labels. This can be used for tasks such as spam detection, topic classification, sentiment analysis, and more.
Examples
TBD
Flow Input & Output
Flow Input
Flow Input is a JSON object containing parameter values for the flow.
There are 2 input parameters (url, file_urls) with 4 tasks.
Input to a task can be set using the flow's input parameters that are linked to the task. This is the recommended approach for a clean API.
However, there can be scenarios where an API user wants to modify a task input parameter even though it was not linked to a flow's input parameter.
To support this, we allow task parameters to be specified directly in the flow input. Below are 2 examples which result in the setup.
By using task input parameter, users can further customize the input to the task.
For example, the CombinedLoader task has a recursive parameter that is not exposed as a flow input parameter. This can be set by using the task input parameter.
Flow Output is a JSON object containing the output values of the flow.
In the sample flow above, there are 2 output parameters (collection_name and documents).
Output parameters can take values from the output of any tasks in the flow, although usually the last task's output is most important.
However, there can be scenarios where an API user wants to have additional output parameter values even though it was not defined as a flow's output parameter.
To support this, we allow output parameters to be specified in the API request body.
For example, the documents output parameter defined in the flow may contain too many documents. Below request body shows how an API user can modify the output to limit the number of documents returned.