Skip to content

rakmakan/rag_implementation_phi_data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

COSENTYX RAG System

A Retrieval-Augmented Generation (RAG) system specialized for COSENTYX medication information using Groq LLM and Qdrant vector database.

System Architecture

rag_system/
├── config/
│   ├── crawler.yaml      # Crawler configuration
│   └── llm.yaml          # LLM model settings
├── data/
│   └── headings.json     # Topic headings for context
├── src/
│   ├── crawler/          # Web crawler implementation
│   ├── utils/           # Utility functions
│   └── vector_db/       # Qdrant database setup
└── scripts/
    ├── run_api.py       # RAG chat interface
    └── run_crawler.py   # Document ingestion

Features

  • Topic-aware responses using predefined medical topics
  • Document crawling and processing for PDF and web content
  • Vector similarity search using Qdrant
  • Interactive chat interface using phi-playground
  • Structured response format with confidence scoring

Setup

  1. Install dependencies:
poetry install
  1. Set up environment variables in .env:
GROQ_API_KEY=your_groq_api_key
QDRANT_API_KEY=your_qdrant_api_key
QDRANT_URL=your_qdrant_url
  1. Configure settings in config/:
  • crawler.yaml: Set collection name and crawl depth
  • llm.yaml: Configure LLM model and parameters

Usage

  1. Crawl and index documents:
python scripts/run_crawler.py
  1. Start the RAG chat interface:
python scripts/run_api.py
  1. Access the chat interface at: http://localhost:7777

Response Format

The system provides structured responses:

Topic Check: [Topic relevance]
Answer: [Detailed response]
Sources: [Reference sources]
Confidence: [0.0-1.0 score]

Configuration

crawler.yaml

max_depth: 3
collection_name: "cons_dummy2"

llm.yaml

model_id: "deepseek-r1-distill-llama-70b"
temperature: 0.1
max_tokens: 2048

Dependencies

  • phi-agent: For LLM integration and playground
  • Groq: LLM provider
  • Qdrant: Vector database
  • SentenceTransformers: Text embeddings

Notes

  • The system is specifically designed for COSENTYX medication information
  • Only responds to topics present in headings.json
  • Uses structured topic checking for relevant responses

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors