Skip to content

Latest commit

 

History

History
103 lines (71 loc) · 6.08 KB

README.md

File metadata and controls

103 lines (71 loc) · 6.08 KB
smol blueprint logo

AI blueprint

A blueprint for AI development, focusing on applied examples of RAG, information extraction, and more in the age of LLMs and agents. It is a practical approach that strives to show the application of some of the more theoretical learnings from the smol-course and apply them to an end2end real-world example.

🚀 Web apps and microservices included!

Each notebook will show how to deploy your AI as a webapp on Hugging Face Spaces with Gradio, which you can directly use as microservices through the Gradio Python Client. All the code and demos can be used in a private or public setting. Deployed on the Hub!

The problem statement

We are a company want to build AI tools but we are not sure where to start, let alone how to get things done. We only know that we have a lot of valuable data and that AI could help us get more value out of it. We have uploaded them to ai-blueprint/fineweb-bbc-news on the Hugging Face Hub and want to use it to start building our AI stack.

Hugging Manager: "Establish a baseline and iterate from there!"

Retrieval Augmented Generation (RAG)

RAG (Retrieval Augmented Generation) is a technique that helps AI give better answers by first finding and using relevant information from your documents. Think of it like giving an AI assistant access to your company's knowledge base before asking it questions - this helps it provide more accurate and factual responses based on your actual data.

RAG

Some use cases

  • Ask questions like "What was our Q4 revenue?" and get answers backed by financial reports
  • Search with natural queries like "Show me customer complaints about shipping delays"
  • Get AI responses that cite specific policies from your employee handbook
  • Ensure accuracy by having AI reference your product documentation when answering technical questions
  • Automatically incorporate new sales data and market reports into AI responses
  • Build customer service bots that know your exact return policies and procedures

How to do RAG?

All notebooks for RAG can be found in the RAG directory and all artifacts can be found in the RAG collection on the Hub.

Status Notebook Artifact Title
Retrieve Data - API Retrieve documents from a vector database
Augment API Augment retrieval results by reranking
Generate API Generate responses using a SmolLM
🚧 Pipeline API Combine all the components in a RAG pipeline
🚧 Agentic RAG API - Data Building agents to coordinate components
🚧 Fine-tuning Models (retrieval and reranking) Fine-tuning retrieval and reranking models

Information Extraction and labelling

Information Extraction (IE) is the process of extracting structured information from unstructured text. It involves identifying and extracting specific pieces of information, such as names, dates, numbers, and other data points, and organizing them into a structured format. Labeling is the process of annotating the extracted information with metadata, such as entity type, category, or sentiments.

Some use cases

  • Extract customer names, addresses, and purchase amounts from invoices
  • Automatically tag emails with categories like "spam" or "important"
  • Extract dates, times, and locations from meeting notes
  • Identify and extract entities like people, organizations, and locations from text
  • Determine relationships between entities like person-organization connections
  • Extract numerical values and units from scientific papers
  • Extract product names, prices, and descriptions from online reviews

How to do IE?

Status Notebook Artifact Title
🚧 Labeling for classification API - Data Labeling text for text classification and entity extraction
🚧 Labeling for entity extraction API - Data Labeling text for text classification and entity extraction
🚧 Structured Generation API Structured generation using an LLM
🚧 Information Extraction API - Data Extract structured information from unstructured text
🚧 Agentic Extraction and Labeling API Building agents to coordinate components

Installation and configuration

Python environment

We will use uv to manage the project. First create a virtual environment:

uv venv --python 3.11
source .venv/bin/activate

Then you can install all the required dependencies:

uv sync --all-groups

Or you can sync between different dependency groups:

uv sync scraping
uv sync rag
uv sync information-extraction

Hugging Face Account

You will need a Hugging Face account to use the Hub API. You can create one here. After this you can follow the huggingface-cli instructions and log in to configure your Hugging Face token.

huggingface-cli login