Tuesday, March 05, 2024

How to check if string exists in JQuery

In jQuery, you can use the indexOf method to check if a string contains another string. Here's an example:

var mainString = "Hello, world";
var subString = "world";

if (mainString.indexOf(subString) !== -1) {
    // subString is found in mainString
    console.log("Substring found");
} else {
    // subString is not found in mainString
    console.log("Substring not found");
}
  

In this example, the indexOf method returns the index of the first occurrence of the subString within the mainString. If the subString is not found, indexOf returns -1. You can use this to check if a string contains another string in jQuery.

Monday, March 04, 2024

What are Langchain Agents?

The LangChain framework is designed for building applications that utilize large language models (LLMs) to excel in natural language processing, text generation, and more. LangChain agents are specialized components within the framework designed to perform tasks such as answering questions, generating text, translating languages, and summarizing text. They harness the capabilities of LLMs to process natural language input and generate corresponding output.

High level Overview:
1. LangChain Agents: These are specialized components within the LangChain framework that interact with the real world and are designed to perform specific tasks such as answering questions, generating text, translating languages, and summarizing text.

2. Functioning of LangChain Agents: The LangChain agents use large language models (LLMs) to process natural language input and generate corresponding output, leveraging extensive training on vast datasets for various tasks such as comprehending queries, text generation, and language translation.

3. Architecture: The fundamental architecture of a LangChain agent involves input reception, processing with LLM, plan execution, and output delivery. It includes the agent itself, external tools, and toolkits assembled for specific functions.

4. Getting Started: Agents use a combination of an LLM or an LLM Chain as well as a Toolkit to perform a predefined series of steps to accomplish a goal. Tools like Wikipedia, DuckDuckGo, and Arxiv are utilized, and the necessary libraries and tools are imported and set up for the agent.

5. Advantages: LangChain agents are user-friendly, versatile, and offer enhanced capabilities by leveraging the power of language models. They hold potential for creating realistic chatbots, serving as educational tools, and aiding businesses in marketing.

6. Future Usage: LangChain agents could be employed in creating realistic chatbots, educational tools, and marketing assistance, indicating the potential for a more interactive and intelligent digital landscape.

Overall, LangChain agents offer user-friendly and versatile features, leveraging advanced language models to provide various applications across diverse scenarios and requirements. 

Sunday, March 03, 2024

How to find a view in database where its used in SQL Server

To find where a specific view is used in a SQL Server database, you can query the system catalog views. Here's a query to achieve this:

SELECT 
    referencing_schema_name, 
    referencing_entity_name
FROM 
    sys.dm_sql_referencing_entities('YourSchema.YourView', 'OBJECT');
  

Replace YourSchema with the schema of your view and YourView with the name of the view you want to find. This query will return the schema and name of the objects that reference the specified view.

Execute this query in your SQL Server management tool to find where a specific view is used in your database.

Hope this help!!

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!!