LLM Framework - Documentation
LLM Framework - Documentation
Automation
Framework
Guide for
Table of Contents
I. Introduction ........................................................................................................1
I.1 Overview & Challenge ................................................................................................................................................ 1
V. Appendix ......................................................................................................... 20
V.1 Future Enhancements............................................................................................................................................. 20
[Type here]
I. Introduction
Leverage this LLM Framework template along with its Generative AI powered
custom activities to make LLM App & Automation Development much easier,
more flexible, more reliable and built for enterprise level usage with
automation.
We've seen how powerful large language models can be, whether it's for generating
unstructured sources, generating works of art, music, etc - that's why we fondly call
Its power relies on the huge amount and quality of data it's trained with, that
ironically is also where the limiting factor is. But through other integrations it can
The challenge with large language models by itself is it's built to be general
trained on, but in reality, large language models don’t know of the underlying
context that language describes, as the technology aims to generate text that
sounds nice, grammatically, and semantically, but they don’t really have some kind
and amplify harmful biases through hallucinations and might, in turn, reinforce
actions.
Language Models, using this framework that is both flexible and reusable.
II. Prerequisite
The custom activity package used throughout the framework is the main pre-
requisite to utilize the template for your LLM powered projects. This section depicts
See Appendix ‘V.3. Additional sources of documentation’ for full video tutorials
III.1 Runtime Dependencies
Console)
o Pinecone Account - https://app.pinecone.io/
production scenario it’s best to host the API on a proper remote app server.
b. Make sure Docker is running by starting up the application. Verify docker is running
Where first 5000 -> external port accessed by client; and second 5000 -> internal port from code e.g. waitress-server --
listen=0.0.0.0:5000 app:app
running.
If hosted on a remote webserver, localhost will be replaced with the remote host name or IP
This template orchestrates the reusability of the solution across a wide array
framework so that it can cater to different types of downstream process which may
It is created to fit all of the best practices regarding logging, exception handling,
applications, retrieving input data, processing it, and ending the transaction. All of
these States are connected through multiple Transitions which cover almost every
provided sources such as csv, pdf, YouTube video links, word documents,
etc.
Properties
- Authentication
API Endpoint (String)
This is the endpoint where the backend API is hosted (either locally or on a remote app
For instance, if docker container is ran in local machine where the bot is, then the API
https://app.pinecone.io/ or from Azure Resources. Fetch API Key from Pinecone Project >
API Keys. The following video guide includes tutorial on how to setup and get required
- Input
Source (String)
File path or URL sources. Base Path (e.g. c:\temp\file.csv -> file.csv or
- Options
Pinecone Environment (String)
The environment name of the Pinecone vector database e.g. us-east1-gcp
- Output
Output Context (String)
Reference (i.e. namespace) to the vector embeddings or documents that will be used to
Properties
- Authentication
API Endpoint (String)
This is the endpoint where the backend API is hosted (either locally or on a remote app
For instance, if docker container is ran in local machine where the bot is, then the API
OpenAI -> https://platform.openai.com > Account > View API Keys (API keys - OpenAI API)
- Input
Source or Context (String)
Message
[Any] Question or instruction [to the provided context]
Memory
Serialized memory file injected into the LLM chain.
- Options
Pinecone Environment (String)
LLM Provider
LLM provider that will be used for the completions. Defaults to OpenAIGPT.
Defaults to gpt-4-0613.
files.anthropic.com/production/images/model_pricing_july2023.pdf
- Output
AI Message
Context-aware completions Output
Updated Memory
Same reference to input memory, with updated context after the LLM chain run
a. Fetch Knowledge Source – Fetch document/s from vector database for
inspection purposes
Properties
- Authentication
API Endpoint (String)
- Input
Source (String)
- Options
Pinecone Environment (String)
- Output
Args (String)
Embeddings generation JSON string arguments. Includes keys - env, index_name,
namespace
C. Config Mapping
Global variables that is being used throughout the framework are being
mapped from the config.xlsx values in the 00_InitializeSource.xaml
II.2 Solution Architecture
the flow for various types of use cases. The studio template includes some
other core framework components are stored in the root, Framework, Forms and
LLM for various real-world use cases, which can generally be categorized as
Response)
b.1. 00_InitializeSource
Connect to various sources, convert into embeddings and store into a vector database, to be
used as context for the prompt template. Currently supported sources: CSV, DOCX, PDF,
YOUTUBE VIDEOS
b.2. 10_InteractLLM.xaml
Initialize Prompt Template, Fetch or Restore stored memory, (Re)Initialize LLM chain or
b.3. 15_ActionCenter.xaml
Customizable action center form for your specific use case where the LLM output would
b.4. 20_PerformActions.xaml
Add process flows to interact with ANY downstream systems either through UI or API using
b.5. 25_PostProcessResponse.xaml
Add process flows to perform any post processing step before completing the current
transaction or conversation.
e. AfterResumeWorkflow.xaml
executed i.e. submit, reject, etc.- Post processing of validated data based on
f. InteractionFlowRulesValidation.xaml
Use this workflow to determine the next step after the LLM interaction.
IV. Quick Start Use Cases
Step 2: Publish Project to Orchestrator. Make sure the customizable fields are
filled up or just remove other samples xamls that a not relevant for this
deployment.
point.
Sample-ChatMode.xaml
Leverage context aware LLM Framework with memory to ingest data source and
ingested source.
IV.2 Transactional
as entry point.
queues.
Sample-TransactionMode1.xaml
-> Data Service -> LLM Framework [LLM Interaction (Analyze) > ERP (Act) > LLM
Related Artifacts
enabled.
Step 2: Also, ‘Wait for Form Task and Resume’ MUST BE ADDED to 1.5 wait for
as entry point.
queues.
Sample-TransactionMode2.xaml
the text to justify your answer. If both parties agree to indemnify each other it is
example supplier indemnifies company, even if company has to notify the supplier)
Reference
Indemnification in a contract is a contractual clause that shifts liability, costs, and
expenses from one party to another. After the LLM agent is used to identify if an
from the contract) it will push to human for further review via the custom action
center form
Related Artifacts
APIs/Activities
➢ Enable web page knowledge ingestion and cascading URL web scraping from
base URL.
➢ Include support for output parsers: unstructured input -> structured output
As the framework is still in its nascent stage, there are still some known bugs and
➢ Persistence support needs to be enabled in Studio and the Wait activity needs to
be added when using the HITL flow, otherwise, adding the Wait activity without
Persistence while using Chat Mode would throw Persistence Bookmarks error
during runtime.