| Sumario: | In recent years, the emergence of Large Language Models (LLMs) has transformed the landscape of natural language processing, offering unprecedented capabilities in understanding and generating human language. These advances present a unique opportunity to address critical challenges in the pharmaceutical domain, where timely access to accurate, evidence-based drug information is essential for both healthcare professionals and patients. However, despite their impressive performance, LLMs are limited by their reliance on static training data, which can lead to outdated or unsupported responses, commonly referred to as “hallucinations”, when queried about rapidly evolving medical knowledge. To overcome these limitations, this thesis explores the integration of Retrieval-augmented generation (RAG) techniques with LLMs to develop a robust, trustworthy chatbot for pharmacological information access. The proposed system combines a pre-trained LLM with a RAG pipeline that dynamically retrieves and incorporates up-to-date information from external sources, specifically pharmaceutical leaflets, technical sheets and health alerts. The methodology involves several key steps: (1) automated extraction and preprocessing of pharmaceutical documents from official databases, (2) semantic chunking of these documents to preserve contextual integrity, (3) generation of dense vector embeddings using state-of-the-art models, and (4) storage of these embeddings in a scalable vector database to enable efficient retrieval. The chatbot interface is designed to allow healthcare professionals to submit natural language queries regarding medications, adverse effects, and drug interactions. Upon receiving a query, the system retrieves the most relevant document sections and presents a synthesized, evidencebased response, complete with explicit citations to the original sources. To evaluate the effectiveness of the RAG-enhanced chatbot, a series of metrics were applied, focusing on the accuracy and relevance of the retrieved information, as well as the reduction of unsupported or hallucinated content compared to baseline LLM responses. Results demonstrate that the integration of RAG significantly improves the reliability and transparency of pharmacological advice, ensuring that responses are grounded in current, verified data. The system also incorporates user feedback mechanisms, enabling continuous improvement and adaptation to real-world needs. In conclusion, this thesis presents a novel approach to optimizing pharmacological prescription by leveraging the complementary strengths of LLMs and RAG architectures. The developed chatbot not only enhances the accessibility and accuracy of drug information but also contributes to safer prescribing practices and the democratization of high-quality pharmaceutical knowledge. By providing transparent, source-cited recommendations, the system fosters greater trust among users and has the potential to reduce medication errors, improve patient outcomes, and support equitable healthcare delivery. This work highlights the transformative potential of AI-driven tools in the medical field and sets the stage for future research in trustworthy, explainable decision support systems.
|