llmware


Namellmware JSON
Version 0.3.9 PyPI version JSON
download
home_pagehttps://github.com/llmware-ai
SummaryAn enterprise-grade LLM-based development framework, tools, and fine-tuned models
upload_time2024-11-08 15:56:26
maintainerNone
docs_urlNone
authorllmware
requires_python>=3.9
licenseNone
keywords ai llm rag data development
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # llmware
![Static Badge](https://img.shields.io/badge/python-3.9_%7C_3.10%7C_3.11%7C_3.12-blue?color=blue)
![PyPI - Version](https://img.shields.io/pypi/v/llmware?color=blue)
[![discord](https://img.shields.io/badge/Chat%20on-Discord-blue?logo=discord&logoColor=white)](https://discord.gg/MhZn5Nc39h)   
[![Documentation](https://github.com/llmware-ai/llmware/actions/workflows/pages.yml/badge.svg)](https://github.com/llmware-ai/llmware/actions/workflows/pages.yml)  

🆕Check out [Model Depot](https://medium.com/@darrenoberst/model-depot-9e6625c5fc55)  
Are you using a Windows/Linux x86 machine?  
- Getting started with [OpenVino example](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using_openvino_models.py)  
- Getting started with [ONNX example](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using_onnx_models.py)  

## Table of Contents

- [Building Enterprise RAG Pipelines with Small, Specialized Models](%EF%B8%8Fbuilding-enterprise-rag-pipelines-with-small-specialized-models)
- [Key Features](#--key-features)
- [What's New](#️-whats-new)
- [Getting Started](#-getting-started)
- [Working with the llmware Github repository](#%EF%B8%8F-working-with-the-llmware-github-repository)
- [Data Store Options](#data-store-options)
- [Meet our Models](#meet-our-models)
- [Using LLMs and setting-up API keys & secrets](#using-llms-and-setting-up-api-keys--secrets)
- [Release notes and Change Log](#--release-notes-and-change-log)

## 🧰🛠️🔩Building Enterprise RAG Pipelines with Small, Specialized Models  

`llmware` provides a unified framework for building LLM-based applications (e.g., RAG, Agents), using small, specialized models that can be deployed privately, integrated with enterprise knowledge sources safely and securely, and cost-effectively tuned and adapted for any business process.  

 `llmware` has two main components:  
 
 1.  **RAG Pipeline** - integrated components for the full lifecycle of connecting knowledge sources to generative AI models; and 

 2.  **50+ small, specialized models** fine-tuned for key tasks in enterprise process automation, including fact-based question-answering, classification, summarization, and extraction.  

By bringing together both of these components, along with integrating leading open source models and underlying technologies, `llmware` offers a comprehensive set of tools to rapidly build knowledge-based enterprise LLM applications.  

Most of our examples can be run without a GPU server - get started right away on your laptop.   

[Join us on Discord](https://discord.gg/MhZn5Nc39h)   |  [Watch Youtube Tutorials](https://www.youtube.com/@llmware)  | [Explore our Model Families on Huggingface](https://www.huggingface.co/llmware)   

New to Agents?  [Check out the Agent Fast Start series](https://github.com/llmware-ai/llmware/tree/main/fast_start/agents)  

New to RAG?  [Check out the Fast Start video series](https://www.youtube.com/playlist?list=PL1-dn33KwsmD7SB9iSO6vx4ZLRAWea1DB)  

🔥🔥🔥 [**Multi-Model Agents with SLIM Models**](examples/SLIM-Agents/) - [**Intro-Video**](https://www.youtube.com/watch?v=cQfdaTcmBpY) 🔥🔥🔥   

[Intro to SLIM Function Call Models](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using_function_calls.py)  
Can't wait?  Get SLIMs right away:  

```python 
from llmware.models import ModelCatalog

ModelCatalog().get_llm_toolkit()  # get all SLIM models, delivered as small, fast quantized tools 
ModelCatalog().tool_test_run("slim-sentiment-tool") # see the model in action with test script included  
```

## 🎯  Key features 
Writing code with`llmware` is based on a few main concepts:

<details>
<summary><b>Model Catalog</b>: Access all models the same way with easy lookup, regardless of underlying implementation. 
</summary>  


```python
#   150+ Models in Catalog with 50+ RAG-optimized BLING, DRAGON and Industry BERT models
#   Full support for GGUF, HuggingFace, Sentence Transformers and major API-based models
#   Easy to extend to add custom models - see examples

from llmware.models import ModelCatalog
from llmware.prompts import Prompt

#   all models accessed through the ModelCatalog
models = ModelCatalog().list_all_models()

#   to use any model in the ModelCatalog - "load_model" method and pass the model_name parameter
my_model = ModelCatalog().load_model("llmware/bling-phi-3-gguf")
output = my_model.inference("what is the future of AI?", add_context="Here is the article to read")

#   to integrate model into a Prompt
prompter = Prompt().load_model("llmware/bling-tiny-llama-v0")
response = prompter.prompt_main("what is the future of AI?", context="Insert Sources of information")
```

</details>  

<details>  
<summary><b>Library</b>:  ingest, organize and index a collection of knowledge at scale - Parse, Text Chunk and Embed. </summary>  

```python

from llmware.library import Library

#   to parse and text chunk a set of documents (pdf, pptx, docx, xlsx, txt, csv, md, json/jsonl, wav, png, jpg, html)  

#   step 1 - create a library, which is the 'knowledge-base container' construct
#          - libraries have both text collection (DB) resources, and file resources (e.g., llmware_data/accounts/{library_name})
#          - embeddings and queries are run against a library

lib = Library().create_new_library("my_library")

#    step 2 - add_files is the universal ingestion function - point it at a local file folder with mixed file types
#           - files will be routed by file extension to the correct parser, parsed, text chunked and indexed in text collection DB

lib.add_files("/folder/path/to/my/files")

#   to install an embedding on a library - pick an embedding model and vector_db
lib.install_new_embedding(embedding_model_name="mini-lm-sbert", vector_db="milvus", batch_size=500)

#   to add a second embedding to the same library (mix-and-match models + vector db)  
lib.install_new_embedding(embedding_model_name="industry-bert-sec", vector_db="chromadb", batch_size=100)

#   easy to create multiple libraries for different projects and groups

finance_lib = Library().create_new_library("finance_q4_2023")
finance_lib.add_files("/finance_folder/")

hr_lib = Library().create_new_library("hr_policies")
hr_lib.add_files("/hr_folder/")

#    pull library card with key metadata - documents, text chunks, images, tables, embedding record
lib_card = Library().get_library_card("my_library")

#   see all libraries
all_my_libs = Library().get_all_library_cards()

```
</details>  

<details> 
<summary><b>Query</b>: query libraries with mix of text, semantic, hybrid, metadata, and custom filters. </summary>

```python

from llmware.retrieval import Query
from llmware.library import Library

#   step 1 - load the previously created library 
lib = Library().load_library("my_library")

#   step 2 - create a query object and pass the library
q = Query(lib)

#    step 3 - run lots of different queries  (many other options in the examples)

#    basic text query
results1 = q.text_query("text query", result_count=20, exact_mode=False)

#    semantic query
results2 = q.semantic_query("semantic query", result_count=10)

#    combining a text query restricted to only certain documents in the library and "exact" match to the query
results3 = q.text_query_with_document_filter("new query", {"file_name": "selected file name"}, exact_mode=True)

#   to apply a specific embedding (if multiple on library), pass the names when creating the query object
q2 = Query(lib, embedding_model_name="mini_lm_sbert", vector_db="milvus")
results4 = q2.semantic_query("new semantic query")
```

</details>  

<details>
<summary><b>Prompt with Sources</b>: the easiest way to combine knowledge retrieval with a LLM inference. </summary>

```python

from llmware.prompts import Prompt
from llmware.retrieval import Query
from llmware.library import Library

#   build a prompt
prompter = Prompt().load_model("llmware/bling-tiny-llama-v0")

#   add a file -> file is parsed, text chunked, filtered by query, and then packaged as model-ready context,
#   including in batches, if needed, to fit the model context window

source = prompter.add_source_document("/folder/to/one/doc/", "filename", query="fast query")

#   attach query results (from a Query) into a Prompt
my_lib = Library().load_library("my_library")
results = Query(my_lib).query("my query")
source2 = prompter.add_source_query_results(results)

#   run a new query against a library and load directly into a prompt
source3 = prompter.add_source_new_query(my_lib, query="my new query", query_type="semantic", result_count=15)

#   to run inference with 'prompt with sources'
responses = prompter.prompt_with_source("my query")

#   to run fact-checks - post inference
fact_check = prompter.evidence_check_sources(responses)

#   to view source materials (batched 'model-ready' and attached to prompt)
source_materials = prompter.review_sources_summary()

#   to see the full prompt history
prompt_history = prompter.get_current_history()
```

</details>  

<details> 
<summary><b>RAG-Optimized Models</b> -  1-7B parameter models designed for RAG workflow integration and running locally. </summary>  

```
""" This 'Hello World' example demonstrates how to get started using local BLING models with provided context, using both
Pytorch and GGUF versions. """

import time
from llmware.prompts import Prompt


def hello_world_questions():

    test_list = [

    {"query": "What is the total amount of the invoice?",
     "answer": "$22,500.00",
     "context": "Services Vendor Inc. \n100 Elm Street Pleasantville, NY \nTO Alpha Inc. 5900 1st Street "
                "Los Angeles, CA \nDescription Front End Engineering Service $5000.00 \n Back End Engineering"
                " Service $7500.00 \n Quality Assurance Manager $10,000.00 \n Total Amount $22,500.00 \n"
                "Make all checks payable to Services Vendor Inc. Payment is due within 30 days."
                "If you have any questions concerning this invoice, contact Bia Hermes. "
                "THANK YOU FOR YOUR BUSINESS!  INVOICE INVOICE # 0001 DATE 01/01/2022 FOR Alpha Project P.O. # 1000"},

    {"query": "What was the amount of the trade surplus?",
     "answer": "62.4 billion yen ($416.6 million)",
     "context": "Japan’s September trade balance swings into surplus, surprising expectations"
                "Japan recorded a trade surplus of 62.4 billion yen ($416.6 million) for September, "
                "beating expectations from economists polled by Reuters for a trade deficit of 42.5 "
                "billion yen. Data from Japan’s customs agency revealed that exports in September "
                "increased 4.3% year on year, while imports slid 16.3% compared to the same period "
                "last year. According to FactSet, exports to Asia fell for the ninth straight month, "
                "which reflected ongoing China weakness. Exports were supported by shipments to "
                "Western markets, FactSet added. — Lim Hui Jie"},

    {"query": "When did the LISP machine market collapse?",
     "answer": "1987.",
     "context": "The attendees became the leaders of AI research in the 1960s."
                "  They and their students produced programs that the press described as 'astonishing': "
                "computers were learning checkers strategies, solving word problems in algebra, "
                "proving logical theorems and speaking English.  By the middle of the 1960s, research in "
                "the U.S. was heavily funded by the Department of Defense and laboratories had been "
                "established around the world. Herbert Simon predicted, 'machines will be capable, "
                "within twenty years, of doing any work a man can do'.  Marvin Minsky agreed, writing, "
                "'within a generation ... the problem of creating 'artificial intelligence' will "
                "substantially be solved'. They had, however, underestimated the difficulty of the problem.  "
                "Both the U.S. and British governments cut off exploratory research in response "
                "to the criticism of Sir James Lighthill and ongoing pressure from the US Congress "
                "to fund more productive projects. Minsky's and Papert's book Perceptrons was understood "
                "as proving that artificial neural networks approach would never be useful for solving "
                "real-world tasks, thus discrediting the approach altogether.  The 'AI winter', a period "
                "when obtaining funding for AI projects was difficult, followed.  In the early 1980s, "
                "AI research was revived by the commercial success of expert systems, a form of AI "
                "program that simulated the knowledge and analytical skills of human experts. By 1985, "
                "the market for AI had reached over a billion dollars. At the same time, Japan's fifth "
                "generation computer project inspired the U.S. and British governments to restore funding "
                "for academic research. However, beginning with the collapse of the Lisp Machine market "
                "in 1987, AI once again fell into disrepute, and a second, longer-lasting winter began."},

    {"query": "What is the current rate on 10-year treasuries?",
     "answer": "4.58%",
     "context": "Stocks rallied Friday even after the release of stronger-than-expected U.S. jobs data "
                "and a major increase in Treasury yields.  The Dow Jones Industrial Average gained 195.12 points, "
                "or 0.76%, to close at 31,419.58. The S&P 500 added 1.59% at 4,008.50. The tech-heavy "
                "Nasdaq Composite rose 1.35%, closing at 12,299.68. The U.S. economy added 438,000 jobs in "
                "August, the Labor Department said. Economists polled by Dow Jones expected 273,000 "
                "jobs. However, wages rose less than expected last month.  Stocks posted a stunning "
                "turnaround on Friday, after initially falling on the stronger-than-expected jobs report. "
                "At its session low, the Dow had fallen as much as 198 points; it surged by more than "
                "500 points at the height of the rally. The Nasdaq and the S&P 500 slid by 0.8% during "
                "their lowest points in the day.  Traders were unclear of the reason for the intraday "
                "reversal. Some noted it could be the softer wage number in the jobs report that made "
                "investors rethink their earlier bearish stance. Others noted the pullback in yields from "
                "the day’s highs. Part of the rally may just be to do a market that had gotten extremely "
                "oversold with the S&P 500 at one point this week down more than 9% from its high earlier "
                "this year.  Yields initially surged after the report, with the 10-year Treasury rate trading "
                "near its highest level in 14 years. The benchmark rate later eased from those levels, but "
                "was still up around 6 basis points at 4.58%.  'We’re seeing a little bit of a give back "
                "in yields from where we were around 4.8%. [With] them pulling back a bit, I think that’s "
                "helping the stock market,' said Margaret Jones, chief investment officer at Vibrant Industries "
                "Capital Advisors. 'We’ve had a lot of weakness in the market in recent weeks, and potentially "
                "some oversold conditions.'"},

    {"query": "Is the expected gross margin greater than 70%?",
     "answer": "Yes, between 71.5% and 72.%",
     "context": "Outlook NVIDIA’s outlook for the third quarter of fiscal 2024 is as follows:"
                "Revenue is expected to be $16.00 billion, plus or minus 2%. GAAP and non-GAAP "
                "gross margins are expected to be 71.5% and 72.5%, respectively, plus or minus "
                "50 basis points.  GAAP and non-GAAP operating expenses are expected to be "
                "approximately $2.95 billion and $2.00 billion, respectively.  GAAP and non-GAAP "
                "other income and expense are expected to be an income of approximately $100 "
                "million, excluding gains and losses from non-affiliated investments. GAAP and "
                "non-GAAP tax rates are expected to be 14.5%, plus or minus 1%, excluding any discrete items."
                "Highlights NVIDIA achieved progress since its previous earnings announcement "
                "in these areas:  Data Center Second-quarter revenue was a record $10.32 billion, "
                "up 141% from the previous quarter and up 171% from a year ago. Announced that the "
                "NVIDIA® GH200 Grace™ Hopper™ Superchip for complex AI and HPC workloads is shipping "
                "this quarter, with a second-generation version with HBM3e memory expected to ship "
                "in Q2 of calendar 2024. "},

    {"query": "What is Bank of America's rating on Target?",
     "answer": "Buy",
     "context": "Here are some of the tickers on my radar for Thursday, Oct. 12, taken directly from "
                "my reporter’s notebook: It’s the one-year anniversary of the S&P 500′s bear market bottom "
                "of 3,577. Since then, as of Wednesday’s close of 4,376, the broad market index "
                "soared more than 22%.  Hotter than expected September consumer price index, consumer "
                "inflation. The Social Security Administration issues announced a 3.2% cost-of-living "
                "adjustment for 2024.  Chipotle Mexican Grill (CMG) plans price increases. Pricing power. "
                "Cites consumer price index showing sticky retail inflation for the fourth time "
                "in two years. Bank of America upgrades Target (TGT) to buy from neutral. Cites "
                "risk/reward from depressed levels. Traffic could improve. Gross margin upside. "
                "Merchandising better. Freight and transportation better. Target to report quarter "
                "next month. In retail, the CNBC Investing Club portfolio owns TJX Companies (TJX), "
                "the off-price juggernaut behind T.J. Maxx, Marshalls and HomeGoods. Goldman Sachs "
                "tactical buy trades on Club names Wells Fargo (WFC), which reports quarter Friday, "
                "Humana (HUM) and Nvidia (NVDA). BofA initiates Snowflake (SNOW) with a buy rating."
                "If you like this story, sign up for Jim Cramer’s Top 10 Morning Thoughts on the "
                "Market email newsletter for free. Barclays cuts price targets on consumer products: "
                "UTZ Brands (UTZ) to $16 per share from $17. Kraft Heinz (KHC) to $36 per share from "
                "$38. Cyclical drag. J.M. Smucker (SJM) to $129 from $160. Secular headwinds. "
                "Coca-Cola (KO) to $59 from $70. Barclays cut PTs on housing-related stocks: Toll Brothers"
                "(TOL) to $74 per share from $82. Keeps underweight. Lowers Trex (TREX) and Azek"
                "(AZEK), too. Goldman Sachs (GS) announces sale of fintech platform and warns on "
                "third quarter of 19-cent per share drag on earnings. The buyer: investors led by "
                "private equity firm Sixth Street. Exiting a mistake. Rise in consumer engagement for "
                "Spotify (SPOT), says Morgan Stanley. The analysts hike price target to $190 per share "
                "from $185. Keeps overweight (buy) rating. JPMorgan loves elf Beauty (ELF). Keeps "
                "overweight (buy) rating but lowers price target to $139 per share from $150. "
                "Sees “still challenging” environment into third-quarter print. The Club owns shares "
                "in high-end beauty company Estee Lauder (EL). Barclays upgrades First Solar (FSLR) "
                "to overweight from equal weight (buy from hold) but lowers price target to $224 per "
                "share from $230. Risk reward upgrade. Best visibility of utility scale names."},

    {"query": "What was the rate of decline in 3rd quarter sales?",
     "answer": "20% year-on-year.",
     "context": "Nokia said it would cut up to 14,000 jobs as part of a cost cutting plan following "
                "third quarter earnings that plunged. The Finnish telecommunications giant said that "
                "it will reduce its cost base and increase operation efficiency to “address the "
                "challenging market environment. The substantial layoffs come after Nokia reported "
                "third-quarter net sales declined 20% year-on-year to 4.98 billion euros. Profit over "
                "the period plunged by 69% year-on-year to 133 million euros."},

    {"query": "What is a list of the key points?",
     "answer": "•Stocks rallied on Friday with stronger-than-expected U.S jobs data and increase in "
               "Treasury yields;\n•Dow Jones gained 195.12 points;\n•S&P 500 added 1.59%;\n•Nasdaq Composite rose "
               "1.35%;\n•U.S. economy added 438,000 jobs in August, better than the 273,000 expected;\n"
               "•10-year Treasury rate trading near the highest level in 14 years at 4.58%.",
     "context": "Stocks rallied Friday even after the release of stronger-than-expected U.S. jobs data "
               "and a major increase in Treasury yields.  The Dow Jones Industrial Average gained 195.12 points, "
               "or 0.76%, to close at 31,419.58. The S&P 500 added 1.59% at 4,008.50. The tech-heavy "
               "Nasdaq Composite rose 1.35%, closing at 12,299.68. The U.S. economy added 438,000 jobs in "
               "August, the Labor Department said. Economists polled by Dow Jones expected 273,000 "
               "jobs. However, wages rose less than expected last month.  Stocks posted a stunning "
               "turnaround on Friday, after initially falling on the stronger-than-expected jobs report. "
               "At its session low, the Dow had fallen as much as 198 points; it surged by more than "
               "500 points at the height of the rally. The Nasdaq and the S&P 500 slid by 0.8% during "
               "their lowest points in the day.  Traders were unclear of the reason for the intraday "
               "reversal. Some noted it could be the softer wage number in the jobs report that made "
               "investors rethink their earlier bearish stance. Others noted the pullback in yields from "
               "the day’s highs. Part of the rally may just be to do a market that had gotten extremely "
               "oversold with the S&P 500 at one point this week down more than 9% from its high earlier "
               "this year.  Yields initially surged after the report, with the 10-year Treasury rate trading "
               "near its highest level in 14 years. The benchmark rate later eased from those levels, but "
               "was still up around 6 basis points at 4.58%.  'We’re seeing a little bit of a give back "
               "in yields from where we were around 4.8%. [With] them pulling back a bit, I think that’s "
               "helping the stock market,' said Margaret Jones, chief investment officer at Vibrant Industries "
               "Capital Advisors. 'We’ve had a lot of weakness in the market in recent weeks, and potentially "
               "some oversold conditions.'"}

    ]

    return test_list


# this is the main script to be run

def bling_meets_llmware_hello_world (model_name):

    t0 = time.time()

    # load the questions
    test_list = hello_world_questions()

    print(f"\n > Loading Model: {model_name}...")

    # load the model 
    prompter = Prompt().load_model(model_name)

    t1 = time.time()
    print(f"\n > Model {model_name} load time: {t1-t0} seconds")
 
    for i, entries in enumerate(test_list):

        print(f"\n{i+1}. Query: {entries['query']}")
     
        # run the prompt
        output = prompter.prompt_main(entries["query"],context=entries["context"]
                                      , prompt_name="default_with_context",temperature=0.30)

        # print out the results
        llm_response = output["llm_response"].strip("\n")
        print(f"LLM Response: {llm_response}")
        print(f"Gold Answer: {entries['answer']}")
        print(f"LLM Usage: {output['usage']}")

    t2 = time.time()

    print(f"\nTotal processing time: {t2-t1} seconds")

    return 0


if __name__ == "__main__":

    # list of 'rag-instruct' laptop-ready small bling models on HuggingFace

    pytorch_models = ["llmware/bling-1b-0.1",                    #  most popular
                      "llmware/bling-tiny-llama-v0",             #  fastest 
                      "llmware/bling-1.4b-0.1",
                      "llmware/bling-falcon-1b-0.1",
                      "llmware/bling-cerebras-1.3b-0.1",
                      "llmware/bling-sheared-llama-1.3b-0.1",    
                      "llmware/bling-sheared-llama-2.7b-0.1",
                      "llmware/bling-red-pajamas-3b-0.1",
                      "llmware/bling-stable-lm-3b-4e1t-v0",
                      "llmware/bling-phi-3"                      # most accurate (and newest)  
                      ]

    #  Quantized GGUF versions generally load faster and run nicely on a laptop with at least 16 GB of RAM
    gguf_models = ["bling-phi-3-gguf", "bling-stablelm-3b-tool", "dragon-llama-answer-tool", "dragon-yi-answer-tool", "dragon-mistral-answer-tool"]

    #   try model from either pytorch or gguf model list
    #   the newest (and most accurate) is 'bling-phi-3-gguf'  

    bling_meets_llmware_hello_world(gguf_models[0]  

    #   check out the model card on Huggingface for RAG benchmark test performance results and other useful information
```

</details>

<details>
<summary><b>Simple-to-Scale Database Options </b> - integrated data stores from laptop to parallelized cluster. </summary>

```python

from llmware.configs import LLMWareConfig

#   to set the collection database - mongo, sqlite, postgres  
LLMWareConfig().set_active_db("mongo")  

#   to set the vector database (or declare when installing)  
#   --options: milvus, pg_vector (postgres), redis, qdrant, faiss, pinecone, mongo atlas  
LLMWareConfig().set_vector_db("milvus")  

#   for fast start - no installations required  
LLMWareConfig().set_active_db("sqlite")  
LLMWareConfig().set_vector_db("chromadb")   # try also faiss and lancedb  

#   for single postgres deployment  
LLMWareConfig().set_active_db("postgres")  
LLMWareConfig().set_vector_db("postgres")  

#   to install mongo, milvus, postgres - see the docker-compose scripts as well as examples

```

</details>

<details>

<summary> 🔥 <b> Agents with Function Calls and SLIM Models </b> 🔥 </summary>  

```python

from llmware.agents import LLMfx

text = ("Tesla stock fell 8% in premarket trading after reporting fourth-quarter revenue and profit that "
        "missed analysts’ estimates. The electric vehicle company also warned that vehicle volume growth in "
        "2024 'may be notably lower' than last year’s growth rate. Automotive revenue, meanwhile, increased "
        "just 1% from a year earlier, partly because the EVs were selling for less than they had in the past. "
        "Tesla implemented steep price cuts in the second half of the year around the world. In a Wednesday "
        "presentation, the company warned investors that it’s 'currently between two major growth waves.'")

#   create an agent using LLMfx class
agent = LLMfx()

#   load text to process
agent.load_work(text)

#   load 'models' as 'tools' to be used in analysis process
agent.load_tool("sentiment")
agent.load_tool("extract")
agent.load_tool("topics")
agent.load_tool("boolean")

#   run function calls using different tools
agent.sentiment()
agent.topics()
agent.extract(params=["company"])
agent.extract(params=["automotive revenue growth"])
agent.xsum()
agent.boolean(params=["is 2024 growth expected to be strong? (explain)"])

#   at end of processing, show the report that was automatically aggregated by key
report = agent.show_report()

#   displays a summary of the activity in the process
activity_summary = agent.activity_summary()

#   list of the responses gathered
for i, entries in enumerate(agent.response_list):
    print("update: response analysis: ", i, entries)

output = {"report": report, "activity_summary": activity_summary, "journal": agent.journal}  

```

</details>
<details>

<summary> 🚀 <b>Start coding - Quick Start for RAG </b> 🚀 </summary>

```python
# This example illustrates a simple contract analysis
# using a RAG-optimized LLM running locally

import os
import re
from llmware.prompts import Prompt, HumanInTheLoop
from llmware.setup import Setup
from llmware.configs import LLMWareConfig

def contract_analysis_on_laptop (model_name):

    #  In this scenario, we will:
    #  -- download a set of sample contract files
    #  -- create a Prompt and load a BLING LLM model
    #  -- parse each contract, extract the relevant passages, and pass questions to a local LLM

    #  Main loop - Iterate thru each contract:
    #
    #      1.  parse the document in memory (convert from PDF file into text chunks with metadata)
    #      2.  filter the parsed text chunks with a "topic" (e.g., "governing law") to extract relevant passages
    #      3.  package and assemble the text chunks into a model-ready context
    #      4.  ask three key questions for each contract to the LLM
    #      5.  print to the screen
    #      6.  save the results in both json and csv for furthe processing and review.

    #  Load the llmware sample files

    print (f"\n > Loading the llmware sample files...")

    sample_files_path = Setup().load_sample_files()
    contracts_path = os.path.join(sample_files_path,"Agreements")
 
    #  Query list - these are the 3 main topics and questions that we would like the LLM to analyze for each contract

    query_list = {"executive employment agreement": "What are the name of the two parties?",
                  "base salary": "What is the executive's base salary?",
                  "vacation": "How many vacation days will the executive receive?"}

    #  Load the selected model by name that was passed into the function

    print (f"\n > Loading model {model_name}...")

    prompter = Prompt().load_model(model_name, temperature=0.0, sample=False)

    #  Main loop

    for i, contract in enumerate(os.listdir(contracts_path)):

        #   excluding Mac file artifact (annoying, but fact of life in demos)
        if contract != ".DS_Store":

            print("\nAnalyzing contract: ", str(i+1), contract)

            print("LLM Responses:")

            for key, value in query_list.items():

                # step 1 + 2 + 3 above - contract is parsed, text-chunked, filtered by topic key,
                # ... and then packaged into the prompt

                source = prompter.add_source_document(contracts_path, contract, query=key)

                # step 4 above - calling the LLM with 'source' information already packaged into the prompt

                responses = prompter.prompt_with_source(value, prompt_name="default_with_context")  

                # step 5 above - print out to screen

                for r, response in enumerate(responses):
                    print(key, ":", re.sub("[\n]"," ", response["llm_response"]).strip())

                # We're done with this contract, clear the source from the prompt
                prompter.clear_source_materials()

    # step 6 above - saving the analysis to jsonl and csv

    # Save jsonl report to jsonl to /prompt_history folder
    print("\nPrompt state saved at: ", os.path.join(LLMWareConfig.get_prompt_path(),prompter.prompt_id))
    prompter.save_state()

    # Save csv report that includes the model, response, prompt, and evidence for human-in-the-loop review
    csv_output = HumanInTheLoop(prompter).export_current_interaction_to_csv()
    print("csv output saved at:  ", csv_output)


if __name__ == "__main__":

    # use local cpu model - try the newest - RAG finetune of Phi-3 quantized and packaged in GGUF  
    model = "bling-phi-3-gguf"

    contract_analysis_on_laptop(model)

```
</details>

## 🔥 Latest Enhancements and Features 🔥  

### Model Capabilities & Benchmarks

- **Benchmarking Small Model Capabilities**  
  Explore the latest benchmark results for small language models focusing on accuracy and enterprise use cases.  
  - [Read benchmark results](https://medium.com/@darrenoberst/best-small-language-models-for-accuracy-and-enterprise-use-cases-benchmark-results-cf71964759c8)
  - [Example code for model ranking](fast_start/agents/agents-15-get_model_benchmarks.py)

### New Models and Functionality

- **Qwen2 Models for RAG, Function Calling, and Chat**  
  Start using Qwen2 models quickly with resources for Retrieval-Augmented Generation (RAG), function calling, and chat functionalities.
  - [Quickstart example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-qwen2-models.py)

- **Phi-3 Function Calling Models**  
  Get started in minutes with Phi-3 models designed for function calling.
  - [Quickstart example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-phi-3-function-calls.py)

### New Use Cases & Applications

- **BizBot: RAG + SQL Local Chatbot**  
  Implement a local chatbot for business intelligence using RAG and SQL.
  - [Code example](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/biz_bot.py) | [Demo video](https://youtu.be/4nBYDEjxxTE?si=o6PDPbu0PVcT-tYd)

- **Lecture Tool**  
  Enables Q&A on voice recordings for education and lecture analysis.
  - [Lecture tool code](https://github.com/llmware-ai/llmware/blob/main/examples/Use_Cases/lecture_tool/)

- **Web Services for Financial Research**  
  An end-to-end example demonstrating web services with agent calls for financial research.
  - [Demo video](https://youtu.be/l0jzsg1_Ik0?si=hmLhpT1iv_rxpkHo) | [Code example](examples/Use_Cases/web_services_slim_fx.py)

### Audio & Text Processing

- **Voice Transcription with WhisperCPP**  
  Start transcription projects with WhisperCPP, featuring tools for sample file usage and famous speeches.
  - [Getting started guide](examples/Models/using-whisper-cpp-getting-started.py) | [Parsing great speeches](examples/Use_Cases/parsing_great_speeches.py) | [Demo video](https://youtu.be/5y0ez5ZBpPE?si=KVxsXXtX5TzvlEws)

- **Natural Language Query to CSV**  
  Convert natural language queries to CSV with Slim-SQL, supporting custom Postgres tables.
  - [Demo video](https://youtu.be/z48z5XOXJJg?si=V-CX1w-7KRioI4Bi) | [End-to-end example](examples/SLIM-Agents/text2sql-end-to-end-2.py) | [Custom table usage](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/agent_with_custom_tables.py)

### Multi-Model Agents

- **Multi-Model Agents with SLIM**  
  Use SLIM models on CPU for multi-step agents in complex workflows.
  - [Demo video](https://www.youtube.com/watch?v=cQfdaTcmBpY) | [Example directory](examples/SLIM-Agents)

### Document & OCR Processing

- **OCR Embedded Document Images**  
  Extract text systematically from images embedded in documents for enhanced document processing.
  - [OCR example](examples/Parsing/ocr_embedded_doc_images.py)

- **Enhanced Document Parsing for PDFs, Word, PowerPoint, and Excel**  
  Improved text-chunking controls, table extraction, and content parsing.
  - [Parsing example](examples/Parsing/pdf_parser_new_configs.py)

### Deployment & Optimization

- **Agent Inference Server**  
  Set up an inference server for multi-model agents to optimize deployments.
  - [Server setup example](https://github.com/llmware-ai/llmware/tree/main/examples/SLIM-Agents/agent_api_endpoint.py)

- **Optimizing Accuracy of RAG Prompts**  
  Tutorials for tuning RAG prompt settings for increased accuracy.
  - [Settings example](examples/Models/adjusting_sampling_settings.py) | Videos: [Part I](https://youtu.be/7oMTGhSKuNY?si=14mS2pftk7NoKQbC), [Part II](https://youtu.be/iXp1tj-pPjM?si=T4teUAISnSWgtThu)



## 🌱 Getting Started

**Step 1 - Install llmware** -  `pip3 install llmware` or `pip3 install 'llmware[full]'`  

- note: starting with v0.3.0, we provide options for a [core install](https://github.com/llmware-ai/llmware/blob/main/llmware/requirements.txt) (minimal set of dependencies) or [full install](https://github.com/llmware-ai/llmware/blob/main/llmware/requirements_extras.txt) (adds to the core with wider set of related python libraries).  

<details>
<summary><b>Step 2- Go to Examples</b> - Get Started Fast with 100+ 'Cut-and-Paste' Recipes </summary>

## 🔥 Top New Examples 🔥  

End-to-End Scenario - [**Function Calls with SLIM Extract and Web Services for Financial Research**](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/web_services_slim_fx.py)  
Analyzing Voice Files - [**Great Speeches with LLM Query and Extract**](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/parsing_great_speeches.py)  
New to LLMWare - [**Fast Start tutorial series**](https://github.com/llmware-ai/llmware/tree/main/fast_start)  
Getting Setup - [**Getting Started**](https://github.com/llmware-ai/llmware/tree/main/examples/Getting_Started)  
SLIM Examples -  [**SLIM Models**](examples/SLIM-Agents/)  

| Example     |  Detail      |
|-------------|--------------|
| 1.   BLING models fast start ([code](examples/Models/bling_fast_start.py) / [video](https://www.youtube.com/watch?v=JjgqOZ2v5oU)) | Get started with fast, accurate, CPU-based models - question-answering, key-value extraction, and basic summarization.  |
| 2.   Parse and Embed 500 PDF Documents ([code](examples/Embedding/docs2vecs_with_milvus-un_resolutions.py))  | End-to-end example for Parsing, Embedding and Querying UN Resolution documents with Milvus  |
| 3.  Hybrid Retrieval - Semantic + Text ([code](examples/Retrieval/dual_pass_with_custom_filter.py)) | Using 'dual pass' retrieval to combine best of semantic and text search |  
| 4.   Multiple Embeddings with PG Vector ([code](examples/Embedding/using_multiple_embeddings.py) / [video](https://www.youtube.com/watch?v=Bncvggy6m5Q)) | Comparing Multiple Embedding Models using Postgres / PG Vector |
| 5.   DRAGON GGUF Models ([code](examples/Models/dragon_gguf_fast_start.py) / [video](https://www.youtube.com/watch?v=BI1RlaIJcsc&t=130s)) | State-of-the-Art 7B RAG GGUF Models.  | 
| 6.   RAG with BLING ([code](examples/Use_Cases/contract_analysis_on_laptop_with_bling_models.py) / [video](https://www.youtube.com/watch?v=8aV5p3tErP0)) | Using contract analysis as an example, experiment with RAG for complex document analysis and text extraction using `llmware`'s BLING ~1B parameter GPT model running on your laptop. |  
| 7.   Master Service Agreement Analysis with DRAGON ([code](examples/Use_Cases/msa_processing.py) / [video](https://www.youtube.com/watch?v=Cf-07GBZT68&t=2s)) | Analyzing MSAs using DRAGON YI 6B Model.   |                                                                                                                         
| 8.   Streamlit Example ([code](examples/UI/simple_rag_ui_with_streamlit.py))  | Ask questions to Invoices with UI run inference.  |  
| 9.   Integrating LM Studio ([code](examples/Models/using-open-chat-models.py) / [video](https://www.youtube.com/watch?v=h2FDjUyvsKE&t=101s)) | Integrating LM Studio Models with LLMWare  |                                                                                                                                       
| 10.  Prompts With Sources ([code](examples/Prompts/prompt_with_sources.py))  | Attach wide range of knowledge sources directly into Prompts.   |   
| 11.  Fact Checking ([code](examples/Prompts/fact_checking.py))  | Explore the full set of evidence methods in this example script that analyzes a set of contracts.   |
| 12.  Using 7B GGUF Chat Models ([code](examples/Models/chat_models_gguf_fast_start.py)) | Using 4 state of the art 7B chat models in minutes running locally |  


Check out:  [llmware examples](https://github.com/llmware-ai/llmware/blob/main/examples/README.md)  

</details>  

<details>
<summary><b>Step 3 - Tutorial Videos</b> - check out our Youtube channel for high-impact 5-10 minute tutorials on the latest examples.   </summary>

🎬 Check out these videos to get started quickly:  
- [Document Summarization](https://youtu.be/Ps3W-P9A1m8?si=Rxvst3RJv8ZaOk0L)  
- [Bling-3-GGUF Local Chatbot](https://youtu.be/gzzEVK8p3VM?si=8cNn_do0oxSzCEnM)  
- [Agent-based Complex Research Analysis](https://youtu.be/y4WvwHqRR60?si=jX3KCrKcYkM95boe)  
- [Getting Started with SLIMs (with code)](https://youtu.be/aWZFrTDmMPc?si=lmo98_quo_2Hrq0C)  
- [Are you prompting wrong for RAG - Stochastic Sampling-Part I](https://youtu.be/7oMTGhSKuNY?si=_KSjuBnqArvWzYbx)  
- [Are you prompting wrong for RAG - Stochastic Sampling-Part II- Code Experiments](https://youtu.be/iXp1tj-pPjM?si=3ZeMgipY0vJDHIMY)  
- [SLIM Models Intro](https://www.youtube.com/watch?v=cQfdaTcmBpY)  
- [Text2SQL Intro](https://youtu.be/BKZ6kO2XxNo?si=tXGt63pvrp_rOlIP)  
- [RAG with BLING on your laptop](https://www.youtube.com/watch?v=JjgqOZ2v5oU)    
- [DRAGON-7B-Models](https://www.youtube.com/watch?v=d_u7VaKu6Qk&t=37s)  
- [Install and Compare Multiple Embeddings with Postgres and PGVector](https://www.youtube.com/watch?v=Bncvggy6m5Q)  
- [Background on GGUF Quantization & DRAGON Model Example](https://www.youtube.com/watch?v=ZJyQIZNJ45E)  
- [Using LM Studio Models](https://www.youtube.com/watch?v=h2FDjUyvsKE)  
- [Using Ollama Models](https://www.youtube.com/watch?v=qITahpVDuV0)  
- [Use any GGUF Model](https://www.youtube.com/watch?v=9wXJgld7Yow)  
- [Use small LLMs for RAG for Contract Analysis (feat. LLMWare)](https://www.youtube.com/watch?v=8aV5p3tErP0)
- [Invoice Processing with LLMware](https://www.youtube.com/watch?v=VHZSaBBG-Bo&t=10s)
- [Ingest PDFs at Scale](https://www.youtube.com/watch?v=O0adUfrrxi8&t=10s)
- [Evaluate LLMs for RAG with LLMWare](https://www.youtube.com/watch?v=s0KWqYg5Buk&t=105s)
- [Fast Start to RAG with LLMWare Open Source Library](https://www.youtube.com/watch?v=0naqpH93eEU)
- [Use Retrieval Augmented Generation (RAG) without a Database](https://www.youtube.com/watch?v=tAGz6yR14lw)
- [Pop up LLMWare Inference Server](https://www.youtube.com/watch?v=qiEmLnSRDUA&t=20s)


</details>  

## ✍️ Working with the llmware Github repository  

The llmware repo can be pulled locally to get access to all the examples, or to work directly with the latest version of the llmware code.  

```bash
git clone git@github.com:llmware-ai/llmware.git
```  

We have provided a **welcome_to_llmware** automation script in the root of the repository folder.  After cloning:  
- On Windows command line:  `.\welcome_to_llmware_windows.sh`  
- On Mac / Linux command line:  `sh ./welcome_to_llmware.sh`  

Alternatively, if you prefer to complete setup without the welcome automation script, then the next steps include:  

1.  **install requirements.txt** - inside the /llmware path - e.g., ```pip3 install -r llmware/requirements.txt```  

2.  **install requirements_extras.txt** - inside the /llmware path - e.g., ```pip3 install -r llmware/requirements_extras.txt```(Depending upon your use case, you may not need all or any of these installs, but some of these will be used in the examples.)

3.  **run examples** - copy one or more of the example .py files into the root project path.   (We have seen several IDEs that will attempt to run interactively from the nested /example path, and then not have access to the /llmware module - the easy fix is to just copy the example you want to run into the root path).  

4.  **install vector db** - no-install vector db options include milvus lite, chromadb, faiss and lancedb - which do not require a server install, but do require that you install the python sdk library for that vector db, e.g., `pip3 install pymilvus`, or `pip3 install chromadb`.  If you look in [examples/Embedding](https://github.com/llmware-ai/llmware/tree/main/examples/Embedding), you will see examples for getting started with various vector DB, and in the root of the repo, you will see easy-to-get-started docker compose scripts for installing milvus, postgres/pgvector, mongo, qdrant, neo4j, and redis.  

5.  Pytorch 2.3 note:  We have recently seen issues with Pytorch==2.3 on some platforms - if you run into any issues, we have seen that uninstalling Pytorch and downleveling to Pytorch==2.1 usually solves the problem.  

6.  Numpy 2.0 note: we have seen issues with numpy 2.0 with many libraries not yet supporting.  Our pip install setup will accept numpy 2.0 (to avoid pip conflicts), but if you pull from repo, we restrict numpy to versions <2.   If you run into issues with numpy, we have found that they can be fixed by downgrading numpy to <2, e.g., 1.26.4.  To use WhisperCPP, you should downlevel to numpy <2.  


## Data Store Options

<details>
<summary><b>Fast Start</b>:  use SQLite3 and ChromaDB (File-based) out-of-the-box - no install required </summary>  

```python
from llmware.configs import LLMWareConfig 
LLMWareConfig().set_active_db("sqlite")   
LLMWareConfig().set_vector_db("chromadb")  
```
</details>  

<details>
<summary><b>Speed + Scale</b>:  use MongoDB (text collection) and Milvus (vector db) - install with Docker Compose </summary> 

```bash
curl -o docker-compose.yaml https://raw.githubusercontent.com/llmware-ai/llmware/main/docker-compose.yaml
docker compose up -d
```

```python
from llmware.configs import LLMWareConfig
LLMWareConfig().set_active_db("mongo")
LLMWareConfig().set_vector_db("milvus")
```

</details>  

<details>
<summary><b>Postgres</b>:  use Postgres for both text collection and vector DB - install with Docker Compose </summary> 

```bash
curl -o docker-compose.yaml https://raw.githubusercontent.com/llmware-ai/llmware/main/docker-compose-pgvector.yaml
docker compose up -d
```

```python
from llmware.configs import LLMWareConfig
LLMWareConfig().set_active_db("postgres")
LLMWareConfig().set_vector_db("postgres")
```

</details>  

<details>
<summary><b>Mix-and-Match</b>: LLMWare supports 3 text collection databases (Mongo, Postgres, SQLite) and 
10 vector databases (Milvus, PGVector-Postgres, Neo4j, Redis, Mongo-Atlas, Qdrant, Faiss, LanceDB, ChromaDB and Pinecone)  </summary>

```bash
# scripts to deploy other options
curl -o docker-compose.yaml https://raw.githubusercontent.com/llmware-ai/llmware/main/docker-compose-redis-stack.yaml
```

</details>  

## Meet our Models   

- **SLIM model series:** small, specialized models fine-tuned for function calling and multi-step, multi-model Agent workflows.  
- **DRAGON model series:**  Production-grade RAG-optimized 6-9B parameter models - "Delivering RAG on ..." the leading foundation base models.  
- **BLING model series:**  Small CPU-based RAG-optimized, instruct-following 1B-5B parameter models.  
- **Industry BERT models:**  out-of-the-box custom trained sentence transformer embedding models fine-tuned for the following industries:  Insurance, Contracts, Asset Management, SEC.  
- **GGUF Quantization:** we provide 'gguf' and 'tool' versions of many SLIM, DRAGON and BLING models, optimized for CPU deployment.  

## Using LLMs and setting-up API keys & secrets

LLMWare is an open platform and supports a wide range of open source and proprietary models.  To use LLMWare, you do not need to use any proprietary LLM - we would encourage you to experiment with [SLIM](https://www.huggingface.co/llmware/), [BLING](https://huggingface.co/llmware), [DRAGON](https://huggingface.co/llmware), [Industry-BERT](https://huggingface.co/llmware), the GGUF examples, along with bringing in your favorite models from HuggingFace and Sentence Transformers. 

If you would like to use a proprietary model, you will need to provide your own API Keys.   API keys and secrets for models, aws, and pinecone can be set-up for use in environment variables or passed directly to method calls.  

<details>  
    
<summary> ✨  <b>Roadmap - Where are we going ... </b>  </summary>

- 💡 Making it easy to deploy fine-tuned open source models to build state-of-the-art RAG workflows  
- 💡 Private cloud - keeping documents, data pipelines, data stores, and models safe and secure  
- 💡 Model quantization, especially GGUF, and democratizing the game-changing use of 1-9B CPU-based LLMs  
- 💡 Developing small specialized RAG optimized LLMs between 1B-9B parameters  
- 💡 Industry-specific LLMs, embedding models and processes to support core knowledge-based use cases  
- 💡 Enterprise scalability - containerization, worker deployments and Kubernetes  
- 💡 Integration of SQL and other scale enterprise data sources  
- 💡 Multi-step, multi-model Agent-based workflows with small, specialized function-calling models  

Like our models, we aspire for llmware to be "small, but mighty" - easy to use and get started, but packing a powerful punch!  

</details>

Interested in contributing to llmware? Information on ways to participate can be found in our [Contributors Guide](https://github.com/llmware-ai/llmware/blob/main/repo_docs/CONTRIBUTING.md#contributing-to-llmware).  As with all aspects of this project, contributing is governed by our [Code of Conduct](https://github.com/llmware-ai/llmware/blob/main/repo_docs/CODE_OF_CONDUCT.md).

Questions and discussions are welcome in our [github discussions](https://github.com/llmware-ai/llmware/discussions).  

## 📣  Release notes and Change Log  

See also [additional deployment/install release notes in wheel_archives](https://github.com/llmware-ai/llmware/tree/main/wheel_archives)   

**Sunday, October 27 - v0.3.8**
 - Integrating Model Depot collection of 100+ OpenVino and ONNX Models into LLMWare default model catalog  
 - Supporting changes in model classes, model catalog and model configs  
   
**Sunday, October 6 - v0.3.7**  
- Added new model class - OVGenerativeModel - to support the use of models packaged in OpenVino format  
- Added new model class - ONNXGenerativeModel - to support use of models packaged in ONNX format  
- Getting started with [OpenVino example](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using_openvino_models.py)  
- Getting started with [ONNX example](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using_onnx_models.py)  
  
**Tuesday, October 1 - v0.3.6**  
- Added new prompt and chat templates  
- Improved and updated model configurations    
- New utility functions for locating and highlighting text matches in search results  
- Improved hashing check utility functions  
  
**Monday, August 26 - v0.3.5**  
- Added 10 new BLING+SLIM models to Model Catalog - featuring Qwen2, Phi-3 and Phi-3.5  
- Launched new DRAGON models on Qwen-7B, Yi-9B, Mistral-v0.3, and Llama-3.1  
- New Qwen2 Models (and RAG + function-calling fine-tunes) - [using-qwen2-models](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using-qwen2-models.py)  
- New Phi-3 function calling models - [using-phi-3-function-calls](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using-phi-3-function-calls.py)  
- New use case example - [lecture_tool](https://github.com/llmware-ai/llmware/blob/main/examples/Use_Cases/lecture_tool/)   
- Improved GGUF Configs to expand context window  
- Added model benchmark performance data to model configs 
- Enhanced Utilities hashing functions  
  
For complete history of release notes, please open the Change log tab.  

**Supported Operating Systems**: MacOS (Metal - M1/M2/M3), Linux (x86), and Windows  
- Linux - support Ubuntu 20+  (glibc 2.31+)   
- If you need support for another Linux version, please raise an issue - we will prioritize testing and ensure support.  

**Supported Vector Databases**: Milvus, Postgres (PGVector), Neo4j, Redis, LanceDB, ChromaDB, Qdrant, FAISS, Pinecone, Mongo Atlas Vector Search

**Supported Text Index Databases**: MongoDB, Postgres, SQLite  


<details>
<summary><b>Optional</b></summary>

- [Docker](https://docs.docker.com/get-docker/)
  
- To enable the OCR parsing capabilities, install [Tesseract v5.3.3](https://tesseract-ocr.github.io/tessdoc/Installation.html) and [Poppler v23.10.0](https://poppler.freedesktop.org/) native packages.

</details>

<details>
  <summary><b>🚧 Change Log</b></summary>

**Monday, July 29 - v03.4**  
- Enhanced safety protections for text2sql db reads for LLMfx agents   
- New examples - see [example](https://github.com/llmware-ai/llmware/blob/main/examples/UI/dueling_chatbot.py)    
- More Notebook examples - see [notebook examples](https://github.com/llmware-ai/llmware/blob/main/examples/Notebooks)      
  
**Monday, July 8 - v03.3**  
- Improvements in model configuration options, logging, and various small fixes  
- Improved Azure OpenAI configs - see [example](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using-azure-openai.py)  
  
**Saturday, June 29 - v0.3.2**  
- Update to PDF and Office parsers - improvements to configurations in logging and text chunking options  
  
**Saturday, June 22 - v0.3.1**  
- Added module 3 to Fast Start example series [examples 7-9 on Agents & Function Calls](https://github.com/llmware-ai/llmware/tree/main/fast_start)  
- Added reranker Jina model for in-memory semantic similarity RAG - see [example](https://github.com/llmware-ai/llmware/tree/main/examples/Embedding/using_semantic_reranker_with_rag.py)  
- Enhanced model fetching parameterization in model loading process  
- Added new 'tiny' versions of slim-extract and slim-summary in both Pytorch and GGUF versions - check out 'slim-extract-tiny-tool' and 'slim-summary-tiny-tool'  
- [Biz Bot] use case - see [example](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/biz_bot.py) and [video](https://youtu.be/4nBYDEjxxTE?si=o6PDPbu0PVcT-tYd)  
- Updated numpy reqs <2 and updated yfinance version minimum (>=0.2.38)     

**Tuesday, June 4 - v0.3.0**  
- Added support for new Milvus Lite embedded 'no-install' database - see [example](https://github.com/llmware-ai/llmware/tree/main/examples/Embedding/using_milvus_lite.py).   
- Added two new SLIM models to catalog and agent processes - ['q-gen'](https://github.com/llmware-ai/llmware/tree/main/examples/SLIM-Agents/using-slim-q-gen.py) and ['qa-gen'](https://github.com/llmware-ai/llmware/tree/main/examples/SLIM-Agents/using-slim-qa-gen.py)    
- Updated model class instantiation to provide more extensibility to add new classes in different modules  
- New welcome_to_llmware.sh and welcome_to_llmware_windows.sh fast install scripts  
- Enhanced Model class base with new configurable post_init and register methods  
- Created InferenceHistory to track global state of all inferences completed  
- Multiple improvements and updates to logging at module level  
- Note: starting with v0.3.0, pip install provides two options - a base minimal install `pip3 install llmware` which will support most use cases, and a larger install `pip3 install 'llmware[full]'` with other commonly-used libraries.  
  
**Wednesday, May 22 - v0.2.15**  
- Improvements in Model class handling of Pytorch and Transformers dependencies (just-in-time loading, if needed)  
- Expanding API endpoint options and inference server functionality - see new [client access options](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/llmware_inference_api_client.py)  and [server_launch](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/llmware_inference_server.py)  

**Saturday, May 18 - v0.2.14**  
- New OCR image parsing methods with [example](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/slicing_and_dicing_office_docs.py)  
- Adding first part of logging improvements (WIP) in Configs and Models.    
- New embedding model added to catalog - industry-bert-loans.  
- Updates to model import methods and configurations.  

**Sunday, May 12 - v0.2.13**  
- New GGUF streaming method with [basic example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/gguf_streaming.py) and [phi3 local chatbot](https://github.com/llmware-ai/llmware/tree/main/examples/UI/gguf_streaming_chatbot.py)  
- Significant cleanups in ancillary imports and dependencies to reduce install complexity - note: the updated requirements.txt and setup.py files.  
- Defensive code to provide informative warning of any missing dependencies in specialized parts of the code, e.g., OCR, Web Parser.  
- Updates of tests, notice and documentation.   
- OpenAIConfigs created to support Azure OpenAI.   
  
**Sunday, May 5 - v0.2.12 Update**  
- Launched ["bling-phi-3"](https://huggingface.co/llmware/bling-phi-3) and ["bling-phi-3-gguf"](https://huggingface.co/llmware/bling-phi-3-gguf) in ModelCatalog - newest and most accurate BLING/DRAGON model  
- New long document summarization method using slim-summary-tool [example](https://github.com/llmware-ai/llmware/tree/main/examples/Prompts/document_summarizer.py)  
- New Office (Powerpoint, Word, Excel) sample files [example](https://github.com/llmware-ai/llmware/tree/main/examples/Parsing/parsing_microsoft_ir_docs.py)  
- Added support for Python 3.12  
- Deprecated faiss and replaced with 'no-install' chromadb in Fast Start examples  
- Refactored Datasets, Graph and Web Services classes  
- Updated Voice parsing with WhisperCPP into Library  
  
**Monday, April 29 - v0.2.11 Update**  
- Updates to gguf libs for Phi-3 and Llama-3  
- Added Phi-3 [example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-microsoft-phi-3.py)  and Llama-3 [example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-llama-3.py) and Quantized Versions to Model Catalog  
- Integrated WhisperCPP Model class and prebuilt shared libraries - [getting-started-example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-whisper-cpp-getting-started.py)  
- New voice sample files for testing - [example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-whisper-cpp-sample-files.py)  
- Improved CUDA detection on Windows and safety checks for older Mac OS versions  

**Monday, April 22 - v0.2.10 Update**  
- Updates to Agent class to support Natural Language queries of Custom Tables on Postgres [example](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/agent_with_custom_tables.py)  
- New Agent API endpoint implemented with LLMWare Inference Server and new Agent capabilities [example](https://github.com/llmware-ai/llmware/tree/main/examples/SLIM-Agents/agent_api_endpoint.py)  
  
**Tuesday, April 16 - v0.2.9 Update**  
- New CustomTable class to rapidly create custom DB tables in conjunction with LLM-based workflows.  
- Enhanced methods for converting CSV and JSON/JSONL files into DB tables.  
- See new examples [Creating Custom Table example](https://github.com/llmware-ai/llmware/tree/main/examples/Structured_Tables/create_custom_table-1.py)
    
**Tuesday, April 9 - v0.2.8 Update**  
- Office Parser (Word Docx, Powerpoint PPTX, and Excel XLSX) - multiple improvements - new libs + Python method.  
- Includes: several fixes, improved text chunking controls, header text extraction and configuration options.  
- Generally, new office parser options conform with the new PDF parser options.  
- Please see [Office Parsing Configs example](https://github.com/llmware-ai/llmware/tree/main/examples/Parsing/office_parser_new_configs.py)  

**Wednesday, April 3 - v0.2.7 Update**  
- PDF Parser - multiple improvements - new libs + Python methods.  
- Includes: UTF-8 encoding for European languages.  
- Includes: Better text chunking controls, header text extraction and configuration options.  
- Please see [PDF Parsing Configs example](https://github.com/llmware-ai/llmware/tree/main/examples/Parsing/pdf_parser_new_configs.py) for more details.  
- Note:  deprecating support for aarch64-linux (will use 0.2.6 parsers).  Full support going forward for Linux Ubuntu20+ on x86_64 + with CUDA.  
  
**Friday, March 22 - v0.2.6 Update**  
- New SLIM models:  summary, extract, xsum, boolean, tags-3b, and combo sentiment-ner.  
- New logit and sampling analytics.  
- New SLIM examples showing how to use the new models.  
  
**Thursday, March 14 - v0.2.5 Update**  
- Improved support for GGUF on CUDA (Windows and Linux), with new prebuilt binaries and exception handling.  
- Enhanced model configuration options (sampling, temperature, top logit capture).  
- Added full back-level support for Ubuntu 20+ with parsers and GGUF engine.  
- Support for new Anthropic Claude 3 models.  
- New retrieval methods: document_lookup and aggregate_text.  
- New model:  bling-stablelm-3b-tool - fast, accurate 3b quantized question-answering model - one of our new favorites.  

**Wednesday, February 28 - v0.2.4 Update**  
- Major upgrade of GGUF Generative Model class - support for Stable-LM-3B, CUDA build options, and better control over sampling strategies.
- Note: new GGUF llama.cpp built libs packaged with build starting in v0.2.4.  
- Improved GPU support for HF Embedding Models.   
  
**Friday, February 16 - v0.2.3 Update**  
- Added 10+ embedding models to ModelCatalog - nomic, jina, bge, gte, ember and uae-large.   
- Updated OpenAI support >=1.0 and new text-3 embedding models.    
- SLIM model keys and output_values now accessible in ModelCatalog.  
- Updating encodings to 'utf-8-sig' to better handle txt/csv files with bom.  

**Latest Updates - 19 Jan 2024 - llmware v0.2.0**
  - Added new database integration options - Postgres and SQlite
  - Improved status update and parser event logging options for parallelized parsing
  - Significant enhancements to interactions between Embedding + Text collection databases
  - Improved error exception handling in loading dynamic modules

**Latest Updates - 15 Jan 2024: llmware v0.1.15**
  - Enhancements to dual pass retrieval queries
  - Expanded configuration objects and options for endpoint resources
    
**Latest Updates - 30 Dec 2023: llmware v0.1.14**
  - Added support for Open Chat inference servers (compatible with OpenAI API)
  - Improved capabilities for multiple embedding models and vector DB configurations
  - Added docker-compose install scripts for PGVector and Redis vector databases
  - Added 'bling-tiny-llama' to model catalog
         
**Latest Updates - 22 Dec 2023: llmware v0.1.13**
  - Added 3 new vector databases - Postgres (PG Vector), Redis, and Qdrant
  - Improved support for integrating sentence transformers directly in the model catalog
  - Improvements in the model catalog attributes
  - Multiple new Examples in Models & Embeddings, including GGUF, Vector database, and model catalog

- **17 Dec 2023: llmware v0.1.12**
  - dragon-deci-7b added to catalog - RAG-finetuned model on high-performance new 7B model base from Deci
  - New GGUFGenerativeModel class for easy integration of GGUF Models
  - Adding prebuilt llama_cpp / ctransformer shared libraries for Mac M1, Mac x86, Linux x86 and Windows
  - 3 DRAGON models packaged as Q4_K_M GGUF models for CPU laptop use (dragon-mistral-7b, dragon-llama-7b, dragon-yi-6b)
  - 4 leading open source chat models added to default catalog with Q4_K_M
  
- **8 Dec 2023: llmware v0.1.11**
  - New fast start examples for high volume Document Ingestion and Embeddings with Milvus.
  - New LLMWare 'Pop up' Inference Server model class and example script.
  - New Invoice Processing example for RAG.
  - Improved Windows stack management to support parsing larger documents.
  - Enhancing debugging log output mode options for PDF and Office parsers.

- **30 Nov 2023: llmware v0.1.10**
  - Windows added as a supported operating system.
  - Further enhancements to native code for stack management. 
  - Minor defect fixes.

- **24 Nov 2023: llmware v0.1.9**
  - Markdown (.md) files are now parsed and treated as text files.
  - PDF and Office parser stack optimizations which should avoid the need to set ulimit -s.
  - New llmware_models_fast_start.py example that allows discovery and selection of all llmware HuggingFace models.
  - Native dependencies (shared libraries and dependencies) now included in repo to faciliate local development.
  - Updates to the Status class to support PDF and Office document parsing status updates.
  - Minor defect fixes including image block handling in library exports.

- **17 Nov 2023: llmware v0.1.8**
  - Enhanced generation performance by allowing each model to specific the trailing space parameter.
  - Improved handling for eos_token_id for llama2 and mistral.
  - Improved support for Hugging Face dynamic loading
  - New examples with the new llmware DRAGON models.
    
- **14 Nov 2023: llmware v0.1.7**
  - Moved to Python Wheel package format for PyPi distribution to provide seamless installation of native dependencies on all supported platforms.  
  - ModelCatalog enhancements:
    - OpenAI update to include newly announced ‘turbo’ 4 and 3.5 models.
    - Cohere embedding v3 update to include new Cohere embedding models.
    - BLING models as out-of-the-box registered options in the catalog. They can be instantiated like any other model, even without the “hf=True” flag.
    - Ability to register new model names, within existing model classes, with the register method in ModelCatalog.
  - Prompt enhancements:
    - “evidence_metadata” added to prompt_main output dictionaries allowing prompt_main responses to be plug into the evidence and fact-checking steps without modification.
    - API key can now be passed directly in a prompt.load_model(model_name, api_key = “[my-api-key]”)
  - LLMWareInference Server - Initial delivery:
    - New Class for LLMWareModel which is a wrapper on a custom HF-style API-based model.    
    - LLMWareInferenceServer is a new class that can be instantiated on a remote (GPU) server to create a testing API-server that can be integrated into any Prompt workflow.    
 
- **03 Nov 2023: llmware v0.1.6**
  - Updated packaging to require mongo-c-driver 1.24.4 to temporarily workaround segmentation fault with mongo-c-driver 1.25.
  - Updates in python code needed in anticipation of future Windows support.  

- **27 Oct 2023: llmware v0.1.5**
  - Four new example scripts focused on RAG workflows with small, fine-tuned instruct models that run on a laptop (`llmware` [BLING](https://huggingface.co/llmware) models).
  - Expanded options for setting temperature inside a prompt class.
  - Improvement in post processing of Hugging Face model generation.
  - Streamlined loading of Hugging Face generative models into prompts.
  - Initial delivery of a central status class: read/write of embedding status with a consistent interface for callers.
  - Enhanced in-memory dictionary search support for multi-key queries.
  - Removed trailing space in human-bot wrapping to improve generation quality in some fine-tuned models.
  - Minor defect fixes, updated test scripts, and version update for Werkzeug to address [dependency security alert](https://github.com/llmware-ai/llmware/security/dependabot/2).
- **20 Oct 2023: llmware v0.1.4**
  - GPU support for Hugging Face models.
  - Defect fixes and additional test scripts.
- **13 Oct 2023: llmware v0.1.3**
  - MongoDB Atlas Vector Search support.
  - Support for authentication using a MongoDB connection string.
  - Document summarization methods.
  - Improvements in capturing the model context window automatically and passing changes in the expected output length.  
  - Dataset card and description with lookup by name.
  - Processing time added to model inference usage dictionary.
  - Additional test scripts, examples, and defect fixes.
- **06 Oct 2023: llmware v0.1.1**
  - Added test scripts to the github repository for regression testing.
  - Minor defect fixes and version update of Pillow to address [dependency security alert](https://github.com/llmware-ai/llmware/security/dependabot/1).
- **02 Oct 2023: llmware v0.1.0**  🔥 Initial release of llmware to open source!! 🔥


</details>
<p align="centre">
  <a href="#top">⬆️ Back to Top</a>
</p>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/llmware-ai",
    "name": "llmware",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "ai, llm, rag, data, development",
    "author": "llmware",
    "author_email": "support@aibloks.com",
    "download_url": null,
    "platform": null,
    "description": "# llmware\n![Static Badge](https://img.shields.io/badge/python-3.9_%7C_3.10%7C_3.11%7C_3.12-blue?color=blue)\n![PyPI - Version](https://img.shields.io/pypi/v/llmware?color=blue)\n[![discord](https://img.shields.io/badge/Chat%20on-Discord-blue?logo=discord&logoColor=white)](https://discord.gg/MhZn5Nc39h)   \n[![Documentation](https://github.com/llmware-ai/llmware/actions/workflows/pages.yml/badge.svg)](https://github.com/llmware-ai/llmware/actions/workflows/pages.yml)  \n\n\ud83c\udd95Check out [Model Depot](https://medium.com/@darrenoberst/model-depot-9e6625c5fc55)  \nAre you using a Windows/Linux x86 machine?  \n- Getting started with [OpenVino example](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using_openvino_models.py)  \n- Getting started with [ONNX example](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using_onnx_models.py)  \n\n## Table of Contents\n\n- [Building Enterprise RAG Pipelines with Small, Specialized Models](%EF%B8%8Fbuilding-enterprise-rag-pipelines-with-small-specialized-models)\n- [Key Features](#--key-features)\n- [What's New](#\ufe0f-whats-new)\n- [Getting Started](#-getting-started)\n- [Working with the llmware Github repository](#%EF%B8%8F-working-with-the-llmware-github-repository)\n- [Data Store Options](#data-store-options)\n- [Meet our Models](#meet-our-models)\n- [Using LLMs and setting-up API keys & secrets](#using-llms-and-setting-up-api-keys--secrets)\n- [Release notes and Change Log](#--release-notes-and-change-log)\n\n## \ud83e\uddf0\ud83d\udee0\ufe0f\ud83d\udd29Building Enterprise RAG Pipelines with Small, Specialized Models  \n\n`llmware` provides a unified framework for building LLM-based applications (e.g., RAG, Agents), using small, specialized models that can be deployed privately, integrated with enterprise knowledge sources safely and securely, and cost-effectively tuned and adapted for any business process.  \n\n `llmware` has two main components:  \n \n 1.  **RAG Pipeline** - integrated components for the full lifecycle of connecting knowledge sources to generative AI models; and \n\n 2.  **50+ small, specialized models** fine-tuned for key tasks in enterprise process automation, including fact-based question-answering, classification, summarization, and extraction.  \n\nBy bringing together both of these components, along with integrating leading open source models and underlying technologies, `llmware` offers a comprehensive set of tools to rapidly build knowledge-based enterprise LLM applications.  \n\nMost of our examples can be run without a GPU server - get started right away on your laptop.   \n\n[Join us on Discord](https://discord.gg/MhZn5Nc39h)   |  [Watch Youtube Tutorials](https://www.youtube.com/@llmware)  | [Explore our Model Families on Huggingface](https://www.huggingface.co/llmware)   \n\nNew to Agents?  [Check out the Agent Fast Start series](https://github.com/llmware-ai/llmware/tree/main/fast_start/agents)  \n\nNew to RAG?  [Check out the Fast Start video series](https://www.youtube.com/playlist?list=PL1-dn33KwsmD7SB9iSO6vx4ZLRAWea1DB)  \n\n\ud83d\udd25\ud83d\udd25\ud83d\udd25 [**Multi-Model Agents with SLIM Models**](examples/SLIM-Agents/) - [**Intro-Video**](https://www.youtube.com/watch?v=cQfdaTcmBpY) \ud83d\udd25\ud83d\udd25\ud83d\udd25   \n\n[Intro to SLIM Function Call Models](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using_function_calls.py)  \nCan't wait?  Get SLIMs right away:  \n\n```python \nfrom llmware.models import ModelCatalog\n\nModelCatalog().get_llm_toolkit()  # get all SLIM models, delivered as small, fast quantized tools \nModelCatalog().tool_test_run(\"slim-sentiment-tool\") # see the model in action with test script included  \n```\n\n## \ud83c\udfaf  Key features \nWriting code with`llmware` is based on a few main concepts:\n\n<details>\n<summary><b>Model Catalog</b>: Access all models the same way with easy lookup, regardless of underlying implementation. \n</summary>  \n\n\n```python\n#   150+ Models in Catalog with 50+ RAG-optimized BLING, DRAGON and Industry BERT models\n#   Full support for GGUF, HuggingFace, Sentence Transformers and major API-based models\n#   Easy to extend to add custom models - see examples\n\nfrom llmware.models import ModelCatalog\nfrom llmware.prompts import Prompt\n\n#   all models accessed through the ModelCatalog\nmodels = ModelCatalog().list_all_models()\n\n#   to use any model in the ModelCatalog - \"load_model\" method and pass the model_name parameter\nmy_model = ModelCatalog().load_model(\"llmware/bling-phi-3-gguf\")\noutput = my_model.inference(\"what is the future of AI?\", add_context=\"Here is the article to read\")\n\n#   to integrate model into a Prompt\nprompter = Prompt().load_model(\"llmware/bling-tiny-llama-v0\")\nresponse = prompter.prompt_main(\"what is the future of AI?\", context=\"Insert Sources of information\")\n```\n\n</details>  \n\n<details>  \n<summary><b>Library</b>:  ingest, organize and index a collection of knowledge at scale - Parse, Text Chunk and Embed. </summary>  \n\n```python\n\nfrom llmware.library import Library\n\n#   to parse and text chunk a set of documents (pdf, pptx, docx, xlsx, txt, csv, md, json/jsonl, wav, png, jpg, html)  \n\n#   step 1 - create a library, which is the 'knowledge-base container' construct\n#          - libraries have both text collection (DB) resources, and file resources (e.g., llmware_data/accounts/{library_name})\n#          - embeddings and queries are run against a library\n\nlib = Library().create_new_library(\"my_library\")\n\n#    step 2 - add_files is the universal ingestion function - point it at a local file folder with mixed file types\n#           - files will be routed by file extension to the correct parser, parsed, text chunked and indexed in text collection DB\n\nlib.add_files(\"/folder/path/to/my/files\")\n\n#   to install an embedding on a library - pick an embedding model and vector_db\nlib.install_new_embedding(embedding_model_name=\"mini-lm-sbert\", vector_db=\"milvus\", batch_size=500)\n\n#   to add a second embedding to the same library (mix-and-match models + vector db)  \nlib.install_new_embedding(embedding_model_name=\"industry-bert-sec\", vector_db=\"chromadb\", batch_size=100)\n\n#   easy to create multiple libraries for different projects and groups\n\nfinance_lib = Library().create_new_library(\"finance_q4_2023\")\nfinance_lib.add_files(\"/finance_folder/\")\n\nhr_lib = Library().create_new_library(\"hr_policies\")\nhr_lib.add_files(\"/hr_folder/\")\n\n#    pull library card with key metadata - documents, text chunks, images, tables, embedding record\nlib_card = Library().get_library_card(\"my_library\")\n\n#   see all libraries\nall_my_libs = Library().get_all_library_cards()\n\n```\n</details>  \n\n<details> \n<summary><b>Query</b>: query libraries with mix of text, semantic, hybrid, metadata, and custom filters. </summary>\n\n```python\n\nfrom llmware.retrieval import Query\nfrom llmware.library import Library\n\n#   step 1 - load the previously created library \nlib = Library().load_library(\"my_library\")\n\n#   step 2 - create a query object and pass the library\nq = Query(lib)\n\n#    step 3 - run lots of different queries  (many other options in the examples)\n\n#    basic text query\nresults1 = q.text_query(\"text query\", result_count=20, exact_mode=False)\n\n#    semantic query\nresults2 = q.semantic_query(\"semantic query\", result_count=10)\n\n#    combining a text query restricted to only certain documents in the library and \"exact\" match to the query\nresults3 = q.text_query_with_document_filter(\"new query\", {\"file_name\": \"selected file name\"}, exact_mode=True)\n\n#   to apply a specific embedding (if multiple on library), pass the names when creating the query object\nq2 = Query(lib, embedding_model_name=\"mini_lm_sbert\", vector_db=\"milvus\")\nresults4 = q2.semantic_query(\"new semantic query\")\n```\n\n</details>  \n\n<details>\n<summary><b>Prompt with Sources</b>: the easiest way to combine knowledge retrieval with a LLM inference. </summary>\n\n```python\n\nfrom llmware.prompts import Prompt\nfrom llmware.retrieval import Query\nfrom llmware.library import Library\n\n#   build a prompt\nprompter = Prompt().load_model(\"llmware/bling-tiny-llama-v0\")\n\n#   add a file -> file is parsed, text chunked, filtered by query, and then packaged as model-ready context,\n#   including in batches, if needed, to fit the model context window\n\nsource = prompter.add_source_document(\"/folder/to/one/doc/\", \"filename\", query=\"fast query\")\n\n#   attach query results (from a Query) into a Prompt\nmy_lib = Library().load_library(\"my_library\")\nresults = Query(my_lib).query(\"my query\")\nsource2 = prompter.add_source_query_results(results)\n\n#   run a new query against a library and load directly into a prompt\nsource3 = prompter.add_source_new_query(my_lib, query=\"my new query\", query_type=\"semantic\", result_count=15)\n\n#   to run inference with 'prompt with sources'\nresponses = prompter.prompt_with_source(\"my query\")\n\n#   to run fact-checks - post inference\nfact_check = prompter.evidence_check_sources(responses)\n\n#   to view source materials (batched 'model-ready' and attached to prompt)\nsource_materials = prompter.review_sources_summary()\n\n#   to see the full prompt history\nprompt_history = prompter.get_current_history()\n```\n\n</details>  \n\n<details> \n<summary><b>RAG-Optimized Models</b> -  1-7B parameter models designed for RAG workflow integration and running locally. </summary>  \n\n```\n\"\"\" This 'Hello World' example demonstrates how to get started using local BLING models with provided context, using both\nPytorch and GGUF versions. \"\"\"\n\nimport time\nfrom llmware.prompts import Prompt\n\n\ndef hello_world_questions():\n\n    test_list = [\n\n    {\"query\": \"What is the total amount of the invoice?\",\n     \"answer\": \"$22,500.00\",\n     \"context\": \"Services Vendor Inc. \\n100 Elm Street Pleasantville, NY \\nTO Alpha Inc. 5900 1st Street \"\n                \"Los Angeles, CA \\nDescription Front End Engineering Service $5000.00 \\n Back End Engineering\"\n                \" Service $7500.00 \\n Quality Assurance Manager $10,000.00 \\n Total Amount $22,500.00 \\n\"\n                \"Make all checks payable to Services Vendor Inc. Payment is due within 30 days.\"\n                \"If you have any questions concerning this invoice, contact Bia Hermes. \"\n                \"THANK YOU FOR YOUR BUSINESS!  INVOICE INVOICE # 0001 DATE 01/01/2022 FOR Alpha Project P.O. # 1000\"},\n\n    {\"query\": \"What was the amount of the trade surplus?\",\n     \"answer\": \"62.4 billion yen ($416.6 million)\",\n     \"context\": \"Japan\u2019s September trade balance swings into surplus, surprising expectations\"\n                \"Japan recorded a trade surplus of 62.4 billion yen ($416.6 million) for September, \"\n                \"beating expectations from economists polled by Reuters for a trade deficit of 42.5 \"\n                \"billion yen. Data from Japan\u2019s customs agency revealed that exports in September \"\n                \"increased 4.3% year on year, while imports slid 16.3% compared to the same period \"\n                \"last year. According to FactSet, exports to Asia fell for the ninth straight month, \"\n                \"which reflected ongoing China weakness. Exports were supported by shipments to \"\n                \"Western markets, FactSet added. \u2014 Lim Hui Jie\"},\n\n    {\"query\": \"When did the LISP machine market collapse?\",\n     \"answer\": \"1987.\",\n     \"context\": \"The attendees became the leaders of AI research in the 1960s.\"\n                \"  They and their students produced programs that the press described as 'astonishing': \"\n                \"computers were learning checkers strategies, solving word problems in algebra, \"\n                \"proving logical theorems and speaking English.  By the middle of the 1960s, research in \"\n                \"the U.S. was heavily funded by the Department of Defense and laboratories had been \"\n                \"established around the world. Herbert Simon predicted, 'machines will be capable, \"\n                \"within twenty years, of doing any work a man can do'.  Marvin Minsky agreed, writing, \"\n                \"'within a generation ... the problem of creating 'artificial intelligence' will \"\n                \"substantially be solved'. They had, however, underestimated the difficulty of the problem.  \"\n                \"Both the U.S. and British governments cut off exploratory research in response \"\n                \"to the criticism of Sir James Lighthill and ongoing pressure from the US Congress \"\n                \"to fund more productive projects. Minsky's and Papert's book Perceptrons was understood \"\n                \"as proving that artificial neural networks approach would never be useful for solving \"\n                \"real-world tasks, thus discrediting the approach altogether.  The 'AI winter', a period \"\n                \"when obtaining funding for AI projects was difficult, followed.  In the early 1980s, \"\n                \"AI research was revived by the commercial success of expert systems, a form of AI \"\n                \"program that simulated the knowledge and analytical skills of human experts. By 1985, \"\n                \"the market for AI had reached over a billion dollars. At the same time, Japan's fifth \"\n                \"generation computer project inspired the U.S. and British governments to restore funding \"\n                \"for academic research. However, beginning with the collapse of the Lisp Machine market \"\n                \"in 1987, AI once again fell into disrepute, and a second, longer-lasting winter began.\"},\n\n    {\"query\": \"What is the current rate on 10-year treasuries?\",\n     \"answer\": \"4.58%\",\n     \"context\": \"Stocks rallied Friday even after the release of stronger-than-expected U.S. jobs data \"\n                \"and a major increase in Treasury yields.  The Dow Jones Industrial Average gained 195.12 points, \"\n                \"or 0.76%, to close at 31,419.58. The S&P 500 added 1.59% at 4,008.50. The tech-heavy \"\n                \"Nasdaq Composite rose 1.35%, closing at 12,299.68. The U.S. economy added 438,000 jobs in \"\n                \"August, the Labor Department said. Economists polled by Dow Jones expected 273,000 \"\n                \"jobs. However, wages rose less than expected last month.  Stocks posted a stunning \"\n                \"turnaround on Friday, after initially falling on the stronger-than-expected jobs report. \"\n                \"At its session low, the Dow had fallen as much as 198 points; it surged by more than \"\n                \"500 points at the height of the rally. The Nasdaq and the S&P 500 slid by 0.8% during \"\n                \"their lowest points in the day.  Traders were unclear of the reason for the intraday \"\n                \"reversal. Some noted it could be the softer wage number in the jobs report that made \"\n                \"investors rethink their earlier bearish stance. Others noted the pullback in yields from \"\n                \"the day\u2019s highs. Part of the rally may just be to do a market that had gotten extremely \"\n                \"oversold with the S&P 500 at one point this week down more than 9% from its high earlier \"\n                \"this year.  Yields initially surged after the report, with the 10-year Treasury rate trading \"\n                \"near its highest level in 14 years. The benchmark rate later eased from those levels, but \"\n                \"was still up around 6 basis points at 4.58%.  'We\u2019re seeing a little bit of a give back \"\n                \"in yields from where we were around 4.8%. [With] them pulling back a bit, I think that\u2019s \"\n                \"helping the stock market,' said Margaret Jones, chief investment officer at Vibrant Industries \"\n                \"Capital Advisors. 'We\u2019ve had a lot of weakness in the market in recent weeks, and potentially \"\n                \"some oversold conditions.'\"},\n\n    {\"query\": \"Is the expected gross margin greater than 70%?\",\n     \"answer\": \"Yes, between 71.5% and 72.%\",\n     \"context\": \"Outlook NVIDIA\u2019s outlook for the third quarter of fiscal 2024 is as follows:\"\n                \"Revenue is expected to be $16.00 billion, plus or minus 2%. GAAP and non-GAAP \"\n                \"gross margins are expected to be 71.5% and 72.5%, respectively, plus or minus \"\n                \"50 basis points.  GAAP and non-GAAP operating expenses are expected to be \"\n                \"approximately $2.95 billion and $2.00 billion, respectively.  GAAP and non-GAAP \"\n                \"other income and expense are expected to be an income of approximately $100 \"\n                \"million, excluding gains and losses from non-affiliated investments. GAAP and \"\n                \"non-GAAP tax rates are expected to be 14.5%, plus or minus 1%, excluding any discrete items.\"\n                \"Highlights NVIDIA achieved progress since its previous earnings announcement \"\n                \"in these areas:  Data Center Second-quarter revenue was a record $10.32 billion, \"\n                \"up 141% from the previous quarter and up 171% from a year ago. Announced that the \"\n                \"NVIDIA\u00ae GH200 Grace\u2122 Hopper\u2122 Superchip for complex AI and HPC workloads is shipping \"\n                \"this quarter, with a second-generation version with HBM3e memory expected to ship \"\n                \"in Q2 of calendar 2024. \"},\n\n    {\"query\": \"What is Bank of America's rating on Target?\",\n     \"answer\": \"Buy\",\n     \"context\": \"Here are some of the tickers on my radar for Thursday, Oct. 12, taken directly from \"\n                \"my reporter\u2019s notebook: It\u2019s the one-year anniversary of the S&P 500\u2032s bear market bottom \"\n                \"of 3,577. Since then, as of Wednesday\u2019s close of 4,376, the broad market index \"\n                \"soared more than 22%.  Hotter than expected September consumer price index, consumer \"\n                \"inflation. The Social Security Administration issues announced a 3.2% cost-of-living \"\n                \"adjustment for 2024.  Chipotle Mexican Grill (CMG) plans price increases. Pricing power. \"\n                \"Cites consumer price index showing sticky retail inflation for the fourth time \"\n                \"in two years. Bank of America upgrades Target (TGT) to buy from neutral. Cites \"\n                \"risk/reward from depressed levels. Traffic could improve. Gross margin upside. \"\n                \"Merchandising better. Freight and transportation better. Target to report quarter \"\n                \"next month. In retail, the CNBC Investing Club portfolio owns TJX Companies (TJX), \"\n                \"the off-price juggernaut behind T.J. Maxx, Marshalls and HomeGoods. Goldman Sachs \"\n                \"tactical buy trades on Club names Wells Fargo (WFC), which reports quarter Friday, \"\n                \"Humana (HUM) and Nvidia (NVDA). BofA initiates Snowflake (SNOW) with a buy rating.\"\n                \"If you like this story, sign up for Jim Cramer\u2019s Top 10 Morning Thoughts on the \"\n                \"Market email newsletter for free. Barclays cuts price targets on consumer products: \"\n                \"UTZ Brands (UTZ) to $16 per share from $17. Kraft Heinz (KHC) to $36 per share from \"\n                \"$38. Cyclical drag. J.M. Smucker (SJM) to $129 from $160. Secular headwinds. \"\n                \"Coca-Cola (KO) to $59 from $70. Barclays cut PTs on housing-related stocks: Toll Brothers\"\n                \"(TOL) to $74 per share from $82. Keeps underweight. Lowers Trex (TREX) and Azek\"\n                \"(AZEK), too. Goldman Sachs (GS) announces sale of fintech platform and warns on \"\n                \"third quarter of 19-cent per share drag on earnings. The buyer: investors led by \"\n                \"private equity firm Sixth Street. Exiting a mistake. Rise in consumer engagement for \"\n                \"Spotify (SPOT), says Morgan Stanley. The analysts hike price target to $190 per share \"\n                \"from $185. Keeps overweight (buy) rating. JPMorgan loves elf Beauty (ELF). Keeps \"\n                \"overweight (buy) rating but lowers price target to $139 per share from $150. \"\n                \"Sees \u201cstill challenging\u201d environment into third-quarter print. The Club owns shares \"\n                \"in high-end beauty company Estee Lauder (EL). Barclays upgrades First Solar (FSLR) \"\n                \"to overweight from equal weight (buy from hold) but lowers price target to $224 per \"\n                \"share from $230. Risk reward upgrade. Best visibility of utility scale names.\"},\n\n    {\"query\": \"What was the rate of decline in 3rd quarter sales?\",\n     \"answer\": \"20% year-on-year.\",\n     \"context\": \"Nokia said it would cut up to 14,000 jobs as part of a cost cutting plan following \"\n                \"third quarter earnings that plunged. The Finnish telecommunications giant said that \"\n                \"it will reduce its cost base and increase operation efficiency to \u201caddress the \"\n                \"challenging market environment. The substantial layoffs come after Nokia reported \"\n                \"third-quarter net sales declined 20% year-on-year to 4.98 billion euros. Profit over \"\n                \"the period plunged by 69% year-on-year to 133 million euros.\"},\n\n    {\"query\": \"What is a list of the key points?\",\n     \"answer\": \"\u2022Stocks rallied on Friday with stronger-than-expected U.S jobs data and increase in \"\n               \"Treasury yields;\\n\u2022Dow Jones gained 195.12 points;\\n\u2022S&P 500 added 1.59%;\\n\u2022Nasdaq Composite rose \"\n               \"1.35%;\\n\u2022U.S. economy added 438,000 jobs in August, better than the 273,000 expected;\\n\"\n               \"\u202210-year Treasury rate trading near the highest level in 14 years at 4.58%.\",\n     \"context\": \"Stocks rallied Friday even after the release of stronger-than-expected U.S. jobs data \"\n               \"and a major increase in Treasury yields.  The Dow Jones Industrial Average gained 195.12 points, \"\n               \"or 0.76%, to close at 31,419.58. The S&P 500 added 1.59% at 4,008.50. The tech-heavy \"\n               \"Nasdaq Composite rose 1.35%, closing at 12,299.68. The U.S. economy added 438,000 jobs in \"\n               \"August, the Labor Department said. Economists polled by Dow Jones expected 273,000 \"\n               \"jobs. However, wages rose less than expected last month.  Stocks posted a stunning \"\n               \"turnaround on Friday, after initially falling on the stronger-than-expected jobs report. \"\n               \"At its session low, the Dow had fallen as much as 198 points; it surged by more than \"\n               \"500 points at the height of the rally. The Nasdaq and the S&P 500 slid by 0.8% during \"\n               \"their lowest points in the day.  Traders were unclear of the reason for the intraday \"\n               \"reversal. Some noted it could be the softer wage number in the jobs report that made \"\n               \"investors rethink their earlier bearish stance. Others noted the pullback in yields from \"\n               \"the day\u2019s highs. Part of the rally may just be to do a market that had gotten extremely \"\n               \"oversold with the S&P 500 at one point this week down more than 9% from its high earlier \"\n               \"this year.  Yields initially surged after the report, with the 10-year Treasury rate trading \"\n               \"near its highest level in 14 years. The benchmark rate later eased from those levels, but \"\n               \"was still up around 6 basis points at 4.58%.  'We\u2019re seeing a little bit of a give back \"\n               \"in yields from where we were around 4.8%. [With] them pulling back a bit, I think that\u2019s \"\n               \"helping the stock market,' said Margaret Jones, chief investment officer at Vibrant Industries \"\n               \"Capital Advisors. 'We\u2019ve had a lot of weakness in the market in recent weeks, and potentially \"\n               \"some oversold conditions.'\"}\n\n    ]\n\n    return test_list\n\n\n# this is the main script to be run\n\ndef bling_meets_llmware_hello_world (model_name):\n\n    t0 = time.time()\n\n    # load the questions\n    test_list = hello_world_questions()\n\n    print(f\"\\n > Loading Model: {model_name}...\")\n\n    # load the model \n    prompter = Prompt().load_model(model_name)\n\n    t1 = time.time()\n    print(f\"\\n > Model {model_name} load time: {t1-t0} seconds\")\n \n    for i, entries in enumerate(test_list):\n\n        print(f\"\\n{i+1}. Query: {entries['query']}\")\n     \n        # run the prompt\n        output = prompter.prompt_main(entries[\"query\"],context=entries[\"context\"]\n                                      , prompt_name=\"default_with_context\",temperature=0.30)\n\n        # print out the results\n        llm_response = output[\"llm_response\"].strip(\"\\n\")\n        print(f\"LLM Response: {llm_response}\")\n        print(f\"Gold Answer: {entries['answer']}\")\n        print(f\"LLM Usage: {output['usage']}\")\n\n    t2 = time.time()\n\n    print(f\"\\nTotal processing time: {t2-t1} seconds\")\n\n    return 0\n\n\nif __name__ == \"__main__\":\n\n    # list of 'rag-instruct' laptop-ready small bling models on HuggingFace\n\n    pytorch_models = [\"llmware/bling-1b-0.1\",                    #  most popular\n                      \"llmware/bling-tiny-llama-v0\",             #  fastest \n                      \"llmware/bling-1.4b-0.1\",\n                      \"llmware/bling-falcon-1b-0.1\",\n                      \"llmware/bling-cerebras-1.3b-0.1\",\n                      \"llmware/bling-sheared-llama-1.3b-0.1\",    \n                      \"llmware/bling-sheared-llama-2.7b-0.1\",\n                      \"llmware/bling-red-pajamas-3b-0.1\",\n                      \"llmware/bling-stable-lm-3b-4e1t-v0\",\n                      \"llmware/bling-phi-3\"                      # most accurate (and newest)  \n                      ]\n\n    #  Quantized GGUF versions generally load faster and run nicely on a laptop with at least 16 GB of RAM\n    gguf_models = [\"bling-phi-3-gguf\", \"bling-stablelm-3b-tool\", \"dragon-llama-answer-tool\", \"dragon-yi-answer-tool\", \"dragon-mistral-answer-tool\"]\n\n    #   try model from either pytorch or gguf model list\n    #   the newest (and most accurate) is 'bling-phi-3-gguf'  \n\n    bling_meets_llmware_hello_world(gguf_models[0]  \n\n    #   check out the model card on Huggingface for RAG benchmark test performance results and other useful information\n```\n\n</details>\n\n<details>\n<summary><b>Simple-to-Scale Database Options </b> - integrated data stores from laptop to parallelized cluster. </summary>\n\n```python\n\nfrom llmware.configs import LLMWareConfig\n\n#   to set the collection database - mongo, sqlite, postgres  \nLLMWareConfig().set_active_db(\"mongo\")  \n\n#   to set the vector database (or declare when installing)  \n#   --options: milvus, pg_vector (postgres), redis, qdrant, faiss, pinecone, mongo atlas  \nLLMWareConfig().set_vector_db(\"milvus\")  \n\n#   for fast start - no installations required  \nLLMWareConfig().set_active_db(\"sqlite\")  \nLLMWareConfig().set_vector_db(\"chromadb\")   # try also faiss and lancedb  \n\n#   for single postgres deployment  \nLLMWareConfig().set_active_db(\"postgres\")  \nLLMWareConfig().set_vector_db(\"postgres\")  \n\n#   to install mongo, milvus, postgres - see the docker-compose scripts as well as examples\n\n```\n\n</details>\n\n<details>\n\n<summary> \ud83d\udd25 <b> Agents with Function Calls and SLIM Models </b> \ud83d\udd25 </summary>  \n\n```python\n\nfrom llmware.agents import LLMfx\n\ntext = (\"Tesla stock fell 8% in premarket trading after reporting fourth-quarter revenue and profit that \"\n        \"missed analysts\u2019 estimates. The electric vehicle company also warned that vehicle volume growth in \"\n        \"2024 'may be notably lower' than last year\u2019s growth rate. Automotive revenue, meanwhile, increased \"\n        \"just 1% from a year earlier, partly because the EVs were selling for less than they had in the past. \"\n        \"Tesla implemented steep price cuts in the second half of the year around the world. In a Wednesday \"\n        \"presentation, the company warned investors that it\u2019s 'currently between two major growth waves.'\")\n\n#   create an agent using LLMfx class\nagent = LLMfx()\n\n#   load text to process\nagent.load_work(text)\n\n#   load 'models' as 'tools' to be used in analysis process\nagent.load_tool(\"sentiment\")\nagent.load_tool(\"extract\")\nagent.load_tool(\"topics\")\nagent.load_tool(\"boolean\")\n\n#   run function calls using different tools\nagent.sentiment()\nagent.topics()\nagent.extract(params=[\"company\"])\nagent.extract(params=[\"automotive revenue growth\"])\nagent.xsum()\nagent.boolean(params=[\"is 2024 growth expected to be strong? (explain)\"])\n\n#   at end of processing, show the report that was automatically aggregated by key\nreport = agent.show_report()\n\n#   displays a summary of the activity in the process\nactivity_summary = agent.activity_summary()\n\n#   list of the responses gathered\nfor i, entries in enumerate(agent.response_list):\n    print(\"update: response analysis: \", i, entries)\n\noutput = {\"report\": report, \"activity_summary\": activity_summary, \"journal\": agent.journal}  \n\n```\n\n</details>\n<details>\n\n<summary> \ud83d\ude80 <b>Start coding - Quick Start for RAG </b> \ud83d\ude80 </summary>\n\n```python\n# This example illustrates a simple contract analysis\n# using a RAG-optimized LLM running locally\n\nimport os\nimport re\nfrom llmware.prompts import Prompt, HumanInTheLoop\nfrom llmware.setup import Setup\nfrom llmware.configs import LLMWareConfig\n\ndef contract_analysis_on_laptop (model_name):\n\n    #  In this scenario, we will:\n    #  -- download a set of sample contract files\n    #  -- create a Prompt and load a BLING LLM model\n    #  -- parse each contract, extract the relevant passages, and pass questions to a local LLM\n\n    #  Main loop - Iterate thru each contract:\n    #\n    #      1.  parse the document in memory (convert from PDF file into text chunks with metadata)\n    #      2.  filter the parsed text chunks with a \"topic\" (e.g., \"governing law\") to extract relevant passages\n    #      3.  package and assemble the text chunks into a model-ready context\n    #      4.  ask three key questions for each contract to the LLM\n    #      5.  print to the screen\n    #      6.  save the results in both json and csv for furthe processing and review.\n\n    #  Load the llmware sample files\n\n    print (f\"\\n > Loading the llmware sample files...\")\n\n    sample_files_path = Setup().load_sample_files()\n    contracts_path = os.path.join(sample_files_path,\"Agreements\")\n \n    #  Query list - these are the 3 main topics and questions that we would like the LLM to analyze for each contract\n\n    query_list = {\"executive employment agreement\": \"What are the name of the two parties?\",\n                  \"base salary\": \"What is the executive's base salary?\",\n                  \"vacation\": \"How many vacation days will the executive receive?\"}\n\n    #  Load the selected model by name that was passed into the function\n\n    print (f\"\\n > Loading model {model_name}...\")\n\n    prompter = Prompt().load_model(model_name, temperature=0.0, sample=False)\n\n    #  Main loop\n\n    for i, contract in enumerate(os.listdir(contracts_path)):\n\n        #   excluding Mac file artifact (annoying, but fact of life in demos)\n        if contract != \".DS_Store\":\n\n            print(\"\\nAnalyzing contract: \", str(i+1), contract)\n\n            print(\"LLM Responses:\")\n\n            for key, value in query_list.items():\n\n                # step 1 + 2 + 3 above - contract is parsed, text-chunked, filtered by topic key,\n                # ... and then packaged into the prompt\n\n                source = prompter.add_source_document(contracts_path, contract, query=key)\n\n                # step 4 above - calling the LLM with 'source' information already packaged into the prompt\n\n                responses = prompter.prompt_with_source(value, prompt_name=\"default_with_context\")  \n\n                # step 5 above - print out to screen\n\n                for r, response in enumerate(responses):\n                    print(key, \":\", re.sub(\"[\\n]\",\" \", response[\"llm_response\"]).strip())\n\n                # We're done with this contract, clear the source from the prompt\n                prompter.clear_source_materials()\n\n    # step 6 above - saving the analysis to jsonl and csv\n\n    # Save jsonl report to jsonl to /prompt_history folder\n    print(\"\\nPrompt state saved at: \", os.path.join(LLMWareConfig.get_prompt_path(),prompter.prompt_id))\n    prompter.save_state()\n\n    # Save csv report that includes the model, response, prompt, and evidence for human-in-the-loop review\n    csv_output = HumanInTheLoop(prompter).export_current_interaction_to_csv()\n    print(\"csv output saved at:  \", csv_output)\n\n\nif __name__ == \"__main__\":\n\n    # use local cpu model - try the newest - RAG finetune of Phi-3 quantized and packaged in GGUF  \n    model = \"bling-phi-3-gguf\"\n\n    contract_analysis_on_laptop(model)\n\n```\n</details>\n\n## \ud83d\udd25 Latest Enhancements and Features \ud83d\udd25  \n\n### Model Capabilities & Benchmarks\n\n- **Benchmarking Small Model Capabilities**  \n  Explore the latest benchmark results for small language models focusing on accuracy and enterprise use cases.  \n  - [Read benchmark results](https://medium.com/@darrenoberst/best-small-language-models-for-accuracy-and-enterprise-use-cases-benchmark-results-cf71964759c8)\n  - [Example code for model ranking](fast_start/agents/agents-15-get_model_benchmarks.py)\n\n### New Models and Functionality\n\n- **Qwen2 Models for RAG, Function Calling, and Chat**  \n  Start using Qwen2 models quickly with resources for Retrieval-Augmented Generation (RAG), function calling, and chat functionalities.\n  - [Quickstart example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-qwen2-models.py)\n\n- **Phi-3 Function Calling Models**  \n  Get started in minutes with Phi-3 models designed for function calling.\n  - [Quickstart example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-phi-3-function-calls.py)\n\n### New Use Cases & Applications\n\n- **BizBot: RAG + SQL Local Chatbot**  \n  Implement a local chatbot for business intelligence using RAG and SQL.\n  - [Code example](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/biz_bot.py) | [Demo video](https://youtu.be/4nBYDEjxxTE?si=o6PDPbu0PVcT-tYd)\n\n- **Lecture Tool**  \n  Enables Q&A on voice recordings for education and lecture analysis.\n  - [Lecture tool code](https://github.com/llmware-ai/llmware/blob/main/examples/Use_Cases/lecture_tool/)\n\n- **Web Services for Financial Research**  \n  An end-to-end example demonstrating web services with agent calls for financial research.\n  - [Demo video](https://youtu.be/l0jzsg1_Ik0?si=hmLhpT1iv_rxpkHo) | [Code example](examples/Use_Cases/web_services_slim_fx.py)\n\n### Audio & Text Processing\n\n- **Voice Transcription with WhisperCPP**  \n  Start transcription projects with WhisperCPP, featuring tools for sample file usage and famous speeches.\n  - [Getting started guide](examples/Models/using-whisper-cpp-getting-started.py) | [Parsing great speeches](examples/Use_Cases/parsing_great_speeches.py) | [Demo video](https://youtu.be/5y0ez5ZBpPE?si=KVxsXXtX5TzvlEws)\n\n- **Natural Language Query to CSV**  \n  Convert natural language queries to CSV with Slim-SQL, supporting custom Postgres tables.\n  - [Demo video](https://youtu.be/z48z5XOXJJg?si=V-CX1w-7KRioI4Bi) | [End-to-end example](examples/SLIM-Agents/text2sql-end-to-end-2.py) | [Custom table usage](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/agent_with_custom_tables.py)\n\n### Multi-Model Agents\n\n- **Multi-Model Agents with SLIM**  \n  Use SLIM models on CPU for multi-step agents in complex workflows.\n  - [Demo video](https://www.youtube.com/watch?v=cQfdaTcmBpY) | [Example directory](examples/SLIM-Agents)\n\n### Document & OCR Processing\n\n- **OCR Embedded Document Images**  \n  Extract text systematically from images embedded in documents for enhanced document processing.\n  - [OCR example](examples/Parsing/ocr_embedded_doc_images.py)\n\n- **Enhanced Document Parsing for PDFs, Word, PowerPoint, and Excel**  \n  Improved text-chunking controls, table extraction, and content parsing.\n  - [Parsing example](examples/Parsing/pdf_parser_new_configs.py)\n\n### Deployment & Optimization\n\n- **Agent Inference Server**  \n  Set up an inference server for multi-model agents to optimize deployments.\n  - [Server setup example](https://github.com/llmware-ai/llmware/tree/main/examples/SLIM-Agents/agent_api_endpoint.py)\n\n- **Optimizing Accuracy of RAG Prompts**  \n  Tutorials for tuning RAG prompt settings for increased accuracy.\n  - [Settings example](examples/Models/adjusting_sampling_settings.py) | Videos: [Part I](https://youtu.be/7oMTGhSKuNY?si=14mS2pftk7NoKQbC), [Part II](https://youtu.be/iXp1tj-pPjM?si=T4teUAISnSWgtThu)\n\n\n\n## \ud83c\udf31 Getting Started\n\n**Step 1 - Install llmware** -  `pip3 install llmware` or `pip3 install 'llmware[full]'`  \n\n- note: starting with v0.3.0, we provide options for a [core install](https://github.com/llmware-ai/llmware/blob/main/llmware/requirements.txt) (minimal set of dependencies) or [full install](https://github.com/llmware-ai/llmware/blob/main/llmware/requirements_extras.txt) (adds to the core with wider set of related python libraries).  \n\n<details>\n<summary><b>Step 2- Go to Examples</b> - Get Started Fast with 100+ 'Cut-and-Paste' Recipes </summary>\n\n## \ud83d\udd25 Top New Examples \ud83d\udd25  \n\nEnd-to-End Scenario - [**Function Calls with SLIM Extract and Web Services for Financial Research**](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/web_services_slim_fx.py)  \nAnalyzing Voice Files - [**Great Speeches with LLM Query and Extract**](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/parsing_great_speeches.py)  \nNew to LLMWare - [**Fast Start tutorial series**](https://github.com/llmware-ai/llmware/tree/main/fast_start)  \nGetting Setup - [**Getting Started**](https://github.com/llmware-ai/llmware/tree/main/examples/Getting_Started)  \nSLIM Examples -  [**SLIM Models**](examples/SLIM-Agents/)  \n\n| Example     |  Detail      |\n|-------------|--------------|\n| 1.   BLING models fast start ([code](examples/Models/bling_fast_start.py) / [video](https://www.youtube.com/watch?v=JjgqOZ2v5oU)) | Get started with fast, accurate, CPU-based models - question-answering, key-value extraction, and basic summarization.  |\n| 2.   Parse and Embed 500 PDF Documents ([code](examples/Embedding/docs2vecs_with_milvus-un_resolutions.py))  | End-to-end example for Parsing, Embedding and Querying UN Resolution documents with Milvus  |\n| 3.  Hybrid Retrieval - Semantic + Text ([code](examples/Retrieval/dual_pass_with_custom_filter.py)) | Using 'dual pass' retrieval to combine best of semantic and text search |  \n| 4.   Multiple Embeddings with PG Vector ([code](examples/Embedding/using_multiple_embeddings.py) / [video](https://www.youtube.com/watch?v=Bncvggy6m5Q)) | Comparing Multiple Embedding Models using Postgres / PG Vector |\n| 5.   DRAGON GGUF Models ([code](examples/Models/dragon_gguf_fast_start.py) / [video](https://www.youtube.com/watch?v=BI1RlaIJcsc&t=130s)) | State-of-the-Art 7B RAG GGUF Models.  | \n| 6.   RAG with BLING ([code](examples/Use_Cases/contract_analysis_on_laptop_with_bling_models.py) / [video](https://www.youtube.com/watch?v=8aV5p3tErP0)) | Using contract analysis as an example, experiment with RAG for complex document analysis and text extraction using `llmware`'s BLING ~1B parameter GPT model running on your laptop. |  \n| 7.   Master Service Agreement Analysis with DRAGON ([code](examples/Use_Cases/msa_processing.py) / [video](https://www.youtube.com/watch?v=Cf-07GBZT68&t=2s)) | Analyzing MSAs using DRAGON YI 6B Model.   |                                                                                                                         \n| 8.   Streamlit Example ([code](examples/UI/simple_rag_ui_with_streamlit.py))  | Ask questions to Invoices with UI run inference.  |  \n| 9.   Integrating LM Studio ([code](examples/Models/using-open-chat-models.py) / [video](https://www.youtube.com/watch?v=h2FDjUyvsKE&t=101s)) | Integrating LM Studio Models with LLMWare  |                                                                                                                                       \n| 10.  Prompts With Sources ([code](examples/Prompts/prompt_with_sources.py))  | Attach wide range of knowledge sources directly into Prompts.   |   \n| 11.  Fact Checking ([code](examples/Prompts/fact_checking.py))  | Explore the full set of evidence methods in this example script that analyzes a set of contracts.   |\n| 12.  Using 7B GGUF Chat Models ([code](examples/Models/chat_models_gguf_fast_start.py)) | Using 4 state of the art 7B chat models in minutes running locally |  \n\n\nCheck out:  [llmware examples](https://github.com/llmware-ai/llmware/blob/main/examples/README.md)  \n\n</details>  \n\n<details>\n<summary><b>Step 3 - Tutorial Videos</b> - check out our Youtube channel for high-impact 5-10 minute tutorials on the latest examples.   </summary>\n\n\ud83c\udfac Check out these videos to get started quickly:  \n- [Document Summarization](https://youtu.be/Ps3W-P9A1m8?si=Rxvst3RJv8ZaOk0L)  \n- [Bling-3-GGUF Local Chatbot](https://youtu.be/gzzEVK8p3VM?si=8cNn_do0oxSzCEnM)  \n- [Agent-based Complex Research Analysis](https://youtu.be/y4WvwHqRR60?si=jX3KCrKcYkM95boe)  \n- [Getting Started with SLIMs (with code)](https://youtu.be/aWZFrTDmMPc?si=lmo98_quo_2Hrq0C)  \n- [Are you prompting wrong for RAG - Stochastic Sampling-Part I](https://youtu.be/7oMTGhSKuNY?si=_KSjuBnqArvWzYbx)  \n- [Are you prompting wrong for RAG - Stochastic Sampling-Part II- Code Experiments](https://youtu.be/iXp1tj-pPjM?si=3ZeMgipY0vJDHIMY)  \n- [SLIM Models Intro](https://www.youtube.com/watch?v=cQfdaTcmBpY)  \n- [Text2SQL Intro](https://youtu.be/BKZ6kO2XxNo?si=tXGt63pvrp_rOlIP)  \n- [RAG with BLING on your laptop](https://www.youtube.com/watch?v=JjgqOZ2v5oU)    \n- [DRAGON-7B-Models](https://www.youtube.com/watch?v=d_u7VaKu6Qk&t=37s)  \n- [Install and Compare Multiple Embeddings with Postgres and PGVector](https://www.youtube.com/watch?v=Bncvggy6m5Q)  \n- [Background on GGUF Quantization & DRAGON Model Example](https://www.youtube.com/watch?v=ZJyQIZNJ45E)  \n- [Using LM Studio Models](https://www.youtube.com/watch?v=h2FDjUyvsKE)  \n- [Using Ollama Models](https://www.youtube.com/watch?v=qITahpVDuV0)  \n- [Use any GGUF Model](https://www.youtube.com/watch?v=9wXJgld7Yow)  \n- [Use small LLMs for RAG for Contract Analysis (feat. LLMWare)](https://www.youtube.com/watch?v=8aV5p3tErP0)\n- [Invoice Processing with LLMware](https://www.youtube.com/watch?v=VHZSaBBG-Bo&t=10s)\n- [Ingest PDFs at Scale](https://www.youtube.com/watch?v=O0adUfrrxi8&t=10s)\n- [Evaluate LLMs for RAG with LLMWare](https://www.youtube.com/watch?v=s0KWqYg5Buk&t=105s)\n- [Fast Start to RAG with LLMWare Open Source Library](https://www.youtube.com/watch?v=0naqpH93eEU)\n- [Use Retrieval Augmented Generation (RAG) without a Database](https://www.youtube.com/watch?v=tAGz6yR14lw)\n- [Pop up LLMWare Inference Server](https://www.youtube.com/watch?v=qiEmLnSRDUA&t=20s)\n\n\n</details>  \n\n## \u270d\ufe0f Working with the llmware Github repository  \n\nThe llmware repo can be pulled locally to get access to all the examples, or to work directly with the latest version of the llmware code.  \n\n```bash\ngit clone git@github.com:llmware-ai/llmware.git\n```  \n\nWe have provided a **welcome_to_llmware** automation script in the root of the repository folder.  After cloning:  \n- On Windows command line:  `.\\welcome_to_llmware_windows.sh`  \n- On Mac / Linux command line:  `sh ./welcome_to_llmware.sh`  \n\nAlternatively, if you prefer to complete setup without the welcome automation script, then the next steps include:  \n\n1.  **install requirements.txt** - inside the /llmware path - e.g., ```pip3 install -r llmware/requirements.txt```  \n\n2.  **install requirements_extras.txt** - inside the /llmware path - e.g., ```pip3 install -r llmware/requirements_extras.txt```(Depending upon your use case, you may not need all or any of these installs, but some of these will be used in the examples.)\n\n3.  **run examples** - copy one or more of the example .py files into the root project path.   (We have seen several IDEs that will attempt to run interactively from the nested /example path, and then not have access to the /llmware module - the easy fix is to just copy the example you want to run into the root path).  \n\n4.  **install vector db** - no-install vector db options include milvus lite, chromadb, faiss and lancedb - which do not require a server install, but do require that you install the python sdk library for that vector db, e.g., `pip3 install pymilvus`, or `pip3 install chromadb`.  If you look in [examples/Embedding](https://github.com/llmware-ai/llmware/tree/main/examples/Embedding), you will see examples for getting started with various vector DB, and in the root of the repo, you will see easy-to-get-started docker compose scripts for installing milvus, postgres/pgvector, mongo, qdrant, neo4j, and redis.  \n\n5.  Pytorch 2.3 note:  We have recently seen issues with Pytorch==2.3 on some platforms - if you run into any issues, we have seen that uninstalling Pytorch and downleveling to Pytorch==2.1 usually solves the problem.  \n\n6.  Numpy 2.0 note: we have seen issues with numpy 2.0 with many libraries not yet supporting.  Our pip install setup will accept numpy 2.0 (to avoid pip conflicts), but if you pull from repo, we restrict numpy to versions <2.   If you run into issues with numpy, we have found that they can be fixed by downgrading numpy to <2, e.g., 1.26.4.  To use WhisperCPP, you should downlevel to numpy <2.  \n\n\n## Data Store Options\n\n<details>\n<summary><b>Fast Start</b>:  use SQLite3 and ChromaDB (File-based) out-of-the-box - no install required </summary>  \n\n```python\nfrom llmware.configs import LLMWareConfig \nLLMWareConfig().set_active_db(\"sqlite\")   \nLLMWareConfig().set_vector_db(\"chromadb\")  \n```\n</details>  \n\n<details>\n<summary><b>Speed + Scale</b>:  use MongoDB (text collection) and Milvus (vector db) - install with Docker Compose </summary> \n\n```bash\ncurl -o docker-compose.yaml https://raw.githubusercontent.com/llmware-ai/llmware/main/docker-compose.yaml\ndocker compose up -d\n```\n\n```python\nfrom llmware.configs import LLMWareConfig\nLLMWareConfig().set_active_db(\"mongo\")\nLLMWareConfig().set_vector_db(\"milvus\")\n```\n\n</details>  \n\n<details>\n<summary><b>Postgres</b>:  use Postgres for both text collection and vector DB - install with Docker Compose </summary> \n\n```bash\ncurl -o docker-compose.yaml https://raw.githubusercontent.com/llmware-ai/llmware/main/docker-compose-pgvector.yaml\ndocker compose up -d\n```\n\n```python\nfrom llmware.configs import LLMWareConfig\nLLMWareConfig().set_active_db(\"postgres\")\nLLMWareConfig().set_vector_db(\"postgres\")\n```\n\n</details>  \n\n<details>\n<summary><b>Mix-and-Match</b>: LLMWare supports 3 text collection databases (Mongo, Postgres, SQLite) and \n10 vector databases (Milvus, PGVector-Postgres, Neo4j, Redis, Mongo-Atlas, Qdrant, Faiss, LanceDB, ChromaDB and Pinecone)  </summary>\n\n```bash\n# scripts to deploy other options\ncurl -o docker-compose.yaml https://raw.githubusercontent.com/llmware-ai/llmware/main/docker-compose-redis-stack.yaml\n```\n\n</details>  \n\n## Meet our Models   \n\n- **SLIM model series:** small, specialized models fine-tuned for function calling and multi-step, multi-model Agent workflows.  \n- **DRAGON model series:**  Production-grade RAG-optimized 6-9B parameter models - \"Delivering RAG on ...\" the leading foundation base models.  \n- **BLING model series:**  Small CPU-based RAG-optimized, instruct-following 1B-5B parameter models.  \n- **Industry BERT models:**  out-of-the-box custom trained sentence transformer embedding models fine-tuned for the following industries:  Insurance, Contracts, Asset Management, SEC.  \n- **GGUF Quantization:** we provide 'gguf' and 'tool' versions of many SLIM, DRAGON and BLING models, optimized for CPU deployment.  \n\n## Using LLMs and setting-up API keys & secrets\n\nLLMWare is an open platform and supports a wide range of open source and proprietary models.  To use LLMWare, you do not need to use any proprietary LLM - we would encourage you to experiment with [SLIM](https://www.huggingface.co/llmware/), [BLING](https://huggingface.co/llmware), [DRAGON](https://huggingface.co/llmware), [Industry-BERT](https://huggingface.co/llmware), the GGUF examples, along with bringing in your favorite models from HuggingFace and Sentence Transformers. \n\nIf you would like to use a proprietary model, you will need to provide your own API Keys.   API keys and secrets for models, aws, and pinecone can be set-up for use in environment variables or passed directly to method calls.  \n\n<details>  \n    \n<summary> \u2728  <b>Roadmap - Where are we going ... </b>  </summary>\n\n- \ud83d\udca1 Making it easy to deploy fine-tuned open source models to build state-of-the-art RAG workflows  \n- \ud83d\udca1 Private cloud - keeping documents, data pipelines, data stores, and models safe and secure  \n- \ud83d\udca1 Model quantization, especially GGUF, and democratizing the game-changing use of 1-9B CPU-based LLMs  \n- \ud83d\udca1 Developing small specialized RAG optimized LLMs between 1B-9B parameters  \n- \ud83d\udca1 Industry-specific LLMs, embedding models and processes to support core knowledge-based use cases  \n- \ud83d\udca1 Enterprise scalability - containerization, worker deployments and Kubernetes  \n- \ud83d\udca1 Integration of SQL and other scale enterprise data sources  \n- \ud83d\udca1 Multi-step, multi-model Agent-based workflows with small, specialized function-calling models  \n\nLike our models, we aspire for llmware to be \"small, but mighty\" - easy to use and get started, but packing a powerful punch!  \n\n</details>\n\nInterested in contributing to llmware? Information on ways to participate can be found in our [Contributors Guide](https://github.com/llmware-ai/llmware/blob/main/repo_docs/CONTRIBUTING.md#contributing-to-llmware).  As with all aspects of this project, contributing is governed by our [Code of Conduct](https://github.com/llmware-ai/llmware/blob/main/repo_docs/CODE_OF_CONDUCT.md).\n\nQuestions and discussions are welcome in our [github discussions](https://github.com/llmware-ai/llmware/discussions).  \n\n## \ud83d\udce3  Release notes and Change Log  \n\nSee also [additional deployment/install release notes in wheel_archives](https://github.com/llmware-ai/llmware/tree/main/wheel_archives)   \n\n**Sunday, October 27 - v0.3.8**\n - Integrating Model Depot collection of 100+ OpenVino and ONNX Models into LLMWare default model catalog  \n - Supporting changes in model classes, model catalog and model configs  \n   \n**Sunday, October 6 - v0.3.7**  \n- Added new model class - OVGenerativeModel - to support the use of models packaged in OpenVino format  \n- Added new model class - ONNXGenerativeModel - to support use of models packaged in ONNX format  \n- Getting started with [OpenVino example](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using_openvino_models.py)  \n- Getting started with [ONNX example](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using_onnx_models.py)  \n  \n**Tuesday, October 1 - v0.3.6**  \n- Added new prompt and chat templates  \n- Improved and updated model configurations    \n- New utility functions for locating and highlighting text matches in search results  \n- Improved hashing check utility functions  \n  \n**Monday, August 26 - v0.3.5**  \n- Added 10 new BLING+SLIM models to Model Catalog - featuring Qwen2, Phi-3 and Phi-3.5  \n- Launched new DRAGON models on Qwen-7B, Yi-9B, Mistral-v0.3, and Llama-3.1  \n- New Qwen2 Models (and RAG + function-calling fine-tunes) - [using-qwen2-models](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using-qwen2-models.py)  \n- New Phi-3 function calling models - [using-phi-3-function-calls](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using-phi-3-function-calls.py)  \n- New use case example - [lecture_tool](https://github.com/llmware-ai/llmware/blob/main/examples/Use_Cases/lecture_tool/)   \n- Improved GGUF Configs to expand context window  \n- Added model benchmark performance data to model configs \n- Enhanced Utilities hashing functions  \n  \nFor complete history of release notes, please open the Change log tab.  \n\n**Supported Operating Systems**: MacOS (Metal - M1/M2/M3), Linux (x86), and Windows  \n- Linux - support Ubuntu 20+  (glibc 2.31+)   \n- If you need support for another Linux version, please raise an issue - we will prioritize testing and ensure support.  \n\n**Supported Vector Databases**: Milvus, Postgres (PGVector), Neo4j, Redis, LanceDB, ChromaDB, Qdrant, FAISS, Pinecone, Mongo Atlas Vector Search\n\n**Supported Text Index Databases**: MongoDB, Postgres, SQLite  \n\n\n<details>\n<summary><b>Optional</b></summary>\n\n- [Docker](https://docs.docker.com/get-docker/)\n  \n- To enable the OCR parsing capabilities, install [Tesseract v5.3.3](https://tesseract-ocr.github.io/tessdoc/Installation.html) and [Poppler v23.10.0](https://poppler.freedesktop.org/) native packages.\n\n</details>\n\n<details>\n  <summary><b>\ud83d\udea7 Change Log</b></summary>\n\n**Monday, July 29 - v03.4**  \n- Enhanced safety protections for text2sql db reads for LLMfx agents   \n- New examples - see [example](https://github.com/llmware-ai/llmware/blob/main/examples/UI/dueling_chatbot.py)    \n- More Notebook examples - see [notebook examples](https://github.com/llmware-ai/llmware/blob/main/examples/Notebooks)      \n  \n**Monday, July 8 - v03.3**  \n- Improvements in model configuration options, logging, and various small fixes  \n- Improved Azure OpenAI configs - see [example](https://github.com/llmware-ai/llmware/blob/main/examples/Models/using-azure-openai.py)  \n  \n**Saturday, June 29 - v0.3.2**  \n- Update to PDF and Office parsers - improvements to configurations in logging and text chunking options  \n  \n**Saturday, June 22 - v0.3.1**  \n- Added module 3 to Fast Start example series [examples 7-9 on Agents & Function Calls](https://github.com/llmware-ai/llmware/tree/main/fast_start)  \n- Added reranker Jina model for in-memory semantic similarity RAG - see [example](https://github.com/llmware-ai/llmware/tree/main/examples/Embedding/using_semantic_reranker_with_rag.py)  \n- Enhanced model fetching parameterization in model loading process  \n- Added new 'tiny' versions of slim-extract and slim-summary in both Pytorch and GGUF versions - check out 'slim-extract-tiny-tool' and 'slim-summary-tiny-tool'  \n- [Biz Bot] use case - see [example](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/biz_bot.py) and [video](https://youtu.be/4nBYDEjxxTE?si=o6PDPbu0PVcT-tYd)  \n- Updated numpy reqs <2 and updated yfinance version minimum (>=0.2.38)     \n\n**Tuesday, June 4 - v0.3.0**  \n- Added support for new Milvus Lite embedded 'no-install' database - see [example](https://github.com/llmware-ai/llmware/tree/main/examples/Embedding/using_milvus_lite.py).   \n- Added two new SLIM models to catalog and agent processes - ['q-gen'](https://github.com/llmware-ai/llmware/tree/main/examples/SLIM-Agents/using-slim-q-gen.py) and ['qa-gen'](https://github.com/llmware-ai/llmware/tree/main/examples/SLIM-Agents/using-slim-qa-gen.py)    \n- Updated model class instantiation to provide more extensibility to add new classes in different modules  \n- New welcome_to_llmware.sh and welcome_to_llmware_windows.sh fast install scripts  \n- Enhanced Model class base with new configurable post_init and register methods  \n- Created InferenceHistory to track global state of all inferences completed  \n- Multiple improvements and updates to logging at module level  \n- Note: starting with v0.3.0, pip install provides two options - a base minimal install `pip3 install llmware` which will support most use cases, and a larger install `pip3 install 'llmware[full]'` with other commonly-used libraries.  \n  \n**Wednesday, May 22 - v0.2.15**  \n- Improvements in Model class handling of Pytorch and Transformers dependencies (just-in-time loading, if needed)  \n- Expanding API endpoint options and inference server functionality - see new [client access options](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/llmware_inference_api_client.py)  and [server_launch](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/llmware_inference_server.py)  \n\n**Saturday, May 18 - v0.2.14**  \n- New OCR image parsing methods with [example](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/slicing_and_dicing_office_docs.py)  \n- Adding first part of logging improvements (WIP) in Configs and Models.    \n- New embedding model added to catalog - industry-bert-loans.  \n- Updates to model import methods and configurations.  \n\n**Sunday, May 12 - v0.2.13**  \n- New GGUF streaming method with [basic example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/gguf_streaming.py) and [phi3 local chatbot](https://github.com/llmware-ai/llmware/tree/main/examples/UI/gguf_streaming_chatbot.py)  \n- Significant cleanups in ancillary imports and dependencies to reduce install complexity - note: the updated requirements.txt and setup.py files.  \n- Defensive code to provide informative warning of any missing dependencies in specialized parts of the code, e.g., OCR, Web Parser.  \n- Updates of tests, notice and documentation.   \n- OpenAIConfigs created to support Azure OpenAI.   \n  \n**Sunday, May 5 - v0.2.12 Update**  \n- Launched [\"bling-phi-3\"](https://huggingface.co/llmware/bling-phi-3) and [\"bling-phi-3-gguf\"](https://huggingface.co/llmware/bling-phi-3-gguf) in ModelCatalog - newest and most accurate BLING/DRAGON model  \n- New long document summarization method using slim-summary-tool [example](https://github.com/llmware-ai/llmware/tree/main/examples/Prompts/document_summarizer.py)  \n- New Office (Powerpoint, Word, Excel) sample files [example](https://github.com/llmware-ai/llmware/tree/main/examples/Parsing/parsing_microsoft_ir_docs.py)  \n- Added support for Python 3.12  \n- Deprecated faiss and replaced with 'no-install' chromadb in Fast Start examples  \n- Refactored Datasets, Graph and Web Services classes  \n- Updated Voice parsing with WhisperCPP into Library  \n  \n**Monday, April 29 - v0.2.11 Update**  \n- Updates to gguf libs for Phi-3 and Llama-3  \n- Added Phi-3 [example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-microsoft-phi-3.py)  and Llama-3 [example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-llama-3.py) and Quantized Versions to Model Catalog  \n- Integrated WhisperCPP Model class and prebuilt shared libraries - [getting-started-example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-whisper-cpp-getting-started.py)  \n- New voice sample files for testing - [example](https://github.com/llmware-ai/llmware/tree/main/examples/Models/using-whisper-cpp-sample-files.py)  \n- Improved CUDA detection on Windows and safety checks for older Mac OS versions  \n\n**Monday, April 22 - v0.2.10 Update**  \n- Updates to Agent class to support Natural Language queries of Custom Tables on Postgres [example](https://github.com/llmware-ai/llmware/tree/main/examples/Use_Cases/agent_with_custom_tables.py)  \n- New Agent API endpoint implemented with LLMWare Inference Server and new Agent capabilities [example](https://github.com/llmware-ai/llmware/tree/main/examples/SLIM-Agents/agent_api_endpoint.py)  \n  \n**Tuesday, April 16 - v0.2.9 Update**  \n- New CustomTable class to rapidly create custom DB tables in conjunction with LLM-based workflows.  \n- Enhanced methods for converting CSV and JSON/JSONL files into DB tables.  \n- See new examples [Creating Custom Table example](https://github.com/llmware-ai/llmware/tree/main/examples/Structured_Tables/create_custom_table-1.py)\n    \n**Tuesday, April 9 - v0.2.8 Update**  \n- Office Parser (Word Docx, Powerpoint PPTX, and Excel XLSX) - multiple improvements - new libs + Python method.  \n- Includes: several fixes, improved text chunking controls, header text extraction and configuration options.  \n- Generally, new office parser options conform with the new PDF parser options.  \n- Please see [Office Parsing Configs example](https://github.com/llmware-ai/llmware/tree/main/examples/Parsing/office_parser_new_configs.py)  \n\n**Wednesday, April 3 - v0.2.7 Update**  \n- PDF Parser - multiple improvements - new libs + Python methods.  \n- Includes: UTF-8 encoding for European languages.  \n- Includes: Better text chunking controls, header text extraction and configuration options.  \n- Please see [PDF Parsing Configs example](https://github.com/llmware-ai/llmware/tree/main/examples/Parsing/pdf_parser_new_configs.py) for more details.  \n- Note:  deprecating support for aarch64-linux (will use 0.2.6 parsers).  Full support going forward for Linux Ubuntu20+ on x86_64 + with CUDA.  \n  \n**Friday, March 22 - v0.2.6 Update**  \n- New SLIM models:  summary, extract, xsum, boolean, tags-3b, and combo sentiment-ner.  \n- New logit and sampling analytics.  \n- New SLIM examples showing how to use the new models.  \n  \n**Thursday, March 14 - v0.2.5 Update**  \n- Improved support for GGUF on CUDA (Windows and Linux), with new prebuilt binaries and exception handling.  \n- Enhanced model configuration options (sampling, temperature, top logit capture).  \n- Added full back-level support for Ubuntu 20+ with parsers and GGUF engine.  \n- Support for new Anthropic Claude 3 models.  \n- New retrieval methods: document_lookup and aggregate_text.  \n- New model:  bling-stablelm-3b-tool - fast, accurate 3b quantized question-answering model - one of our new favorites.  \n\n**Wednesday, February 28 - v0.2.4 Update**  \n- Major upgrade of GGUF Generative Model class - support for Stable-LM-3B, CUDA build options, and better control over sampling strategies.\n- Note: new GGUF llama.cpp built libs packaged with build starting in v0.2.4.  \n- Improved GPU support for HF Embedding Models.   \n  \n**Friday, February 16 - v0.2.3 Update**  \n- Added 10+ embedding models to ModelCatalog - nomic, jina, bge, gte, ember and uae-large.   \n- Updated OpenAI support >=1.0 and new text-3 embedding models.    \n- SLIM model keys and output_values now accessible in ModelCatalog.  \n- Updating encodings to 'utf-8-sig' to better handle txt/csv files with bom.  \n\n**Latest Updates - 19 Jan 2024 - llmware v0.2.0**\n  - Added new database integration options - Postgres and SQlite\n  - Improved status update and parser event logging options for parallelized parsing\n  - Significant enhancements to interactions between Embedding + Text collection databases\n  - Improved error exception handling in loading dynamic modules\n\n**Latest Updates - 15 Jan 2024: llmware v0.1.15**\n  - Enhancements to dual pass retrieval queries\n  - Expanded configuration objects and options for endpoint resources\n    \n**Latest Updates - 30 Dec 2023: llmware v0.1.14**\n  - Added support for Open Chat inference servers (compatible with OpenAI API)\n  - Improved capabilities for multiple embedding models and vector DB configurations\n  - Added docker-compose install scripts for PGVector and Redis vector databases\n  - Added 'bling-tiny-llama' to model catalog\n         \n**Latest Updates - 22 Dec 2023: llmware v0.1.13**\n  - Added 3 new vector databases - Postgres (PG Vector), Redis, and Qdrant\n  - Improved support for integrating sentence transformers directly in the model catalog\n  - Improvements in the model catalog attributes\n  - Multiple new Examples in Models & Embeddings, including GGUF, Vector database, and model catalog\n\n- **17 Dec 2023: llmware v0.1.12**\n  - dragon-deci-7b added to catalog - RAG-finetuned model on high-performance new 7B model base from Deci\n  - New GGUFGenerativeModel class for easy integration of GGUF Models\n  - Adding prebuilt llama_cpp / ctransformer shared libraries for Mac M1, Mac x86, Linux x86 and Windows\n  - 3 DRAGON models packaged as Q4_K_M GGUF models for CPU laptop use (dragon-mistral-7b, dragon-llama-7b, dragon-yi-6b)\n  - 4 leading open source chat models added to default catalog with Q4_K_M\n  \n- **8 Dec 2023: llmware v0.1.11**\n  - New fast start examples for high volume Document Ingestion and Embeddings with Milvus.\n  - New LLMWare 'Pop up' Inference Server model class and example script.\n  - New Invoice Processing example for RAG.\n  - Improved Windows stack management to support parsing larger documents.\n  - Enhancing debugging log output mode options for PDF and Office parsers.\n\n- **30 Nov 2023: llmware v0.1.10**\n  - Windows added as a supported operating system.\n  - Further enhancements to native code for stack management. \n  - Minor defect fixes.\n\n- **24 Nov 2023: llmware v0.1.9**\n  - Markdown (.md) files are now parsed and treated as text files.\n  - PDF and Office parser stack optimizations which should avoid the need to set ulimit -s.\n  - New llmware_models_fast_start.py example that allows discovery and selection of all llmware HuggingFace models.\n  - Native dependencies (shared libraries and dependencies) now included in repo to faciliate local development.\n  - Updates to the Status class to support PDF and Office document parsing status updates.\n  - Minor defect fixes including image block handling in library exports.\n\n- **17 Nov 2023: llmware v0.1.8**\n  - Enhanced generation performance by allowing each model to specific the trailing space parameter.\n  - Improved handling for eos_token_id for llama2 and mistral.\n  - Improved support for Hugging Face dynamic loading\n  - New examples with the new llmware DRAGON models.\n    \n- **14 Nov 2023: llmware v0.1.7**\n  - Moved to Python Wheel package format for PyPi distribution to provide seamless installation of native dependencies on all supported platforms.  \n  - ModelCatalog enhancements:\n    - OpenAI update to include newly announced \u2018turbo\u2019 4 and 3.5 models.\n    - Cohere embedding v3 update to include new Cohere embedding models.\n    - BLING models as out-of-the-box registered options in the catalog. They can be instantiated like any other model, even without the \u201chf=True\u201d flag.\n    - Ability to register new model names, within existing model classes, with the register method in ModelCatalog.\n  - Prompt enhancements:\n    - \u201cevidence_metadata\u201d added to prompt_main output dictionaries allowing prompt_main responses to be plug into the evidence and fact-checking steps without modification.\n    - API key can now be passed directly in a prompt.load_model(model_name, api_key = \u201c[my-api-key]\u201d)\n  - LLMWareInference Server - Initial delivery:\n    - New Class for LLMWareModel which is a wrapper on a custom HF-style API-based model.    \n    - LLMWareInferenceServer is a new class that can be instantiated on a remote (GPU) server to create a testing API-server that can be integrated into any Prompt workflow.    \n \n- **03 Nov 2023: llmware v0.1.6**\n  - Updated packaging to require mongo-c-driver 1.24.4 to temporarily workaround segmentation fault with mongo-c-driver 1.25.\n  - Updates in python code needed in anticipation of future Windows support.  \n\n- **27 Oct 2023: llmware v0.1.5**\n  - Four new example scripts focused on RAG workflows with small, fine-tuned instruct models that run on a laptop (`llmware` [BLING](https://huggingface.co/llmware) models).\n  - Expanded options for setting temperature inside a prompt class.\n  - Improvement in post processing of Hugging Face model generation.\n  - Streamlined loading of Hugging Face generative models into prompts.\n  - Initial delivery of a central status class: read/write of embedding status with a consistent interface for callers.\n  - Enhanced in-memory dictionary search support for multi-key queries.\n  - Removed trailing space in human-bot wrapping to improve generation quality in some fine-tuned models.\n  - Minor defect fixes, updated test scripts, and version update for Werkzeug to address [dependency security alert](https://github.com/llmware-ai/llmware/security/dependabot/2).\n- **20 Oct 2023: llmware v0.1.4**\n  - GPU support for Hugging Face models.\n  - Defect fixes and additional test scripts.\n- **13 Oct 2023: llmware v0.1.3**\n  - MongoDB Atlas Vector Search support.\n  - Support for authentication using a MongoDB connection string.\n  - Document summarization methods.\n  - Improvements in capturing the model context window automatically and passing changes in the expected output length.  \n  - Dataset card and description with lookup by name.\n  - Processing time added to model inference usage dictionary.\n  - Additional test scripts, examples, and defect fixes.\n- **06 Oct 2023: llmware v0.1.1**\n  - Added test scripts to the github repository for regression testing.\n  - Minor defect fixes and version update of Pillow to address [dependency security alert](https://github.com/llmware-ai/llmware/security/dependabot/1).\n- **02 Oct 2023: llmware v0.1.0**  \ud83d\udd25 Initial release of llmware to open source!! \ud83d\udd25\n\n\n</details>\n<p align=\"centre\">\n  <a href=\"#top\">\u2b06\ufe0f Back to Top</a>\n</p>\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "An enterprise-grade LLM-based development framework, tools, and fine-tuned models",
    "version": "0.3.9",
    "project_urls": {
        "Homepage": "https://github.com/llmware-ai",
        "Repository": "https://github.com/llmware-ai/llmware"
    },
    "split_keywords": [
        "ai",
        " llm",
        " rag",
        " data",
        " development"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d9f361e3a75d79b29f24fe0200311b5431c0f4d17e77b75a50c5554b3128afd5",
                "md5": "c97a028e36bffddc5f8cb53602df4064",
                "sha256": "f4435d0bab1119471cd1935891d2fa3f8b5ff8b4bc8c6fcab37ec253c46aea3b"
            },
            "downloads": -1,
            "filename": "llmware-0.3.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c97a028e36bffddc5f8cb53602df4064",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 47500310,
            "upload_time": "2024-11-08T15:56:26",
            "upload_time_iso_8601": "2024-11-08T15:56:26.005244Z",
            "url": "https://files.pythonhosted.org/packages/d9/f3/61e3a75d79b29f24fe0200311b5431c0f4d17e77b75a50c5554b3128afd5/llmware-0.3.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-08 15:56:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "llmware-ai",
    "github_project": "llmware",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llmware"
}
        
Elapsed time: 0.55548s