Monday, February 19, 2024

What is RAG? - Retrieval-Augmented Generation Explained

A RAG-based language model (RAG) is a machine learning technique used in natural language understanding tasks. RAG is an AI framework that improves the efficacy of large language models (LLMs) by using custom data. RAG combines information retrieval with generative AI to provide answers instead of document matches.

Unlike traditional lightweight language models, which use single representations for entire entities or phrases, RAGs can represent entities and phrases separately and in different ways.

The primary advantage of using RAG-based language models is their ability to handle long-term dependencies and hierarchical relationships between entities and phrases in natural language. This makes them more effective in tasks such as dialogue systems, question answering, and text summarization.

RAG allows the LLM to present accurate information with source attribution. The output can include citations or references to sources. Users can also look up source documents themselves if they require further clarification or more detail. This can increase trust and confidence in your generative AI solution.

RAG uses an external datastore to build a richer prompt for LLMs. This prompt includes a combination of context, history, and recent or relevant knowledge. RAG retrieves relevant data and documents for a question or task and provides them as context for the LLM.

RAG is the cheapest option to improve the accuracy of a GenAI application. This is because you can quickly update the instructions provided to the LLM with a few code changes.

Sunday, February 18, 2024

How To Return Remote Desktop View To Full Screen

At times while switching between users or computers, Remote desktop screen tend to set to one user profile desktop resolutions. This might be problem for new users who logged in after that.

To over come this issue and to fit to your screen resolutions, here are the simple steps to do on Windows machine.

  1. Just make sure you can see the hidden files on your Windows PC, I guess you know how to do that
  2. Close any Remote Desktop connection that is running.
  3. Go to your Documents (Start - Documents)
  4. Find this file, Default RDP (this file will be hidden format)
  5. Delete that file, and then start remote desktop connection now.
Screenshot 2023-09-14 224147

Hope this helps for people who will get annoyed with changing remote desktops screen resolutions with multiple user logins!!

Wednesday, February 14, 2024

Dapper vs Entity Framework Core vs ADO.NET

The comparison between Dapper, Entity Framework Core, and ADO.NET in the context of .NET database access reveals the following key points:

  1. ADO.NET:

    • It is a low-level technology, providing fine-grained control over database operations.
    • Widely used in .NET applications for a long time but requires writing a significant amount of code for database interaction.
    • Supports direct SQL queries for enhanced control over performance.
  2. Entity Framework Core:

    • High-level ORM tool built on ADO.NET, easing database interaction by abstracting operations.
    • Supports multiple database providers and offers features like automatic schema migration, query translation, and change tracking.
    • Supports LINQ for query writing in C# instead of SQL, enhancing ease of use.
  3. Dapper:

    • Micro ORM built for speed and efficiency, providing a lightweight and fast way to work with databases.
    • Built on top of ADO.NET, it offers a simple API for database operations, ideal for scenarios where performance is critical.
    • Allows flexibility for writing SQL queries and mapping results to any class or structure.

Key Comparisons:

  • Performance: Dapper is generally faster than ADO.NET and significantly quicker than Entity Framework Core due to its optimized design.
  • Ease of Use: EF Core provides a high-level API that abstracts database operations, making it easier to work with. Dapper requires writing SQL queries but is generally straightforward.
  • Features: EF Core offers a wide range of features, while Dapper provides speed and flexibility but lacks some high-level features.
  • Flexibility: Dapper is the most flexible, enabling direct SQL query writing and result mapping. EF Core and ADO.NET have limitations in terms of flexibility.

Choosing the right tool depends on project requirements:

  • Use Dapper for lightweight and fast database operations.
  • Employ EF Core for a high-level API and extensive features.
  • Opt for ADO.NET if fine-grained control over database operations is essential.

In conclusion, the choice of tool should align with the specific project needs, considering the trade-offs between performance, ease of use, features, and flexibility. Each tool offers pros and cons, and the decision should be based on the particular requirements of the application.

Monday, February 12, 2024

Learn Python for free!!!

is one of the easiest and most widely used programming languages. If you want to master Python, use these 5 FREE resources

1. Learn Basic concepts of Python
https://cs50.harvard.edu/python/2022/

2.  Learn Python basics for Data Analysis
https://t.co/0wPzZtaU25

3. Data Science with Python
https://t.co/dSRiUCKArm

4. Learn Django, a popular Python framework.
https://youtube.com/watch?v=rHux0gMZ3Eg

5. Learn Python and build 5 games with Free Code Camp's 6.5 hour tutorial.
https://youtube.com/watch?v=XGf2GcyHPhc

Happy Learning!!

Friday, February 09, 2024

[Solved] No module named MySQLdb

The error message "No module named 'MySQLdb'" typically indicates that Python cannot locate the MySQLdb module, which is a Python interface for accessing MySQL databases. This could be due to various reasons such as the module not being installed or the path to the installation directory not being correctly set. To fix this issue, you can either install the module using pip (the Python package installer) or set the path to the installation directory manually. 

To set the path to the MySQLdb installation directory in Python, you can follow these steps:

1. First, ensure that the MySQLdb module is installed in your Python environment. If not, you can install it using pip by running the following command in your terminal or command prompt:

pip install mysqlclient

2. Once the module is installed, you can check the installation path and set the path in Python using the following steps:

   - Open a Python environment or script.
   - At the top of your Python script or in the Python environment, you can set the path to the MySQLdb installation directory using the following code:

import sys
sys.path.append('/path/to/MySQLdb')

Replace "/path/to/MySQLdb" with the actual path to the MySQLdb installation directory on your system.

By setting the path in this way, you are enabling Python to locate the MySQLdb module when it is imported in your code. 

Hope this helps!!