General
Integrate Tavily Search with Langchain
· β˜• 3 min read · πŸ€– Naresh Mehta

Something amazingly simple turned out to be amazingly weird! I was trying to create a react agent that uses tavily search to fetch relevant articles and then uses openai (on localai server) to generate a response based on the articles. I was following the Langchain docs and the tavily search docs to create the agent.

The code is available on github. If I use the TavilyClient directly as a tool in my agent, it works fine. But if I use the TavilySearch tool, it truncates the query in a weird way and sends the result back. The LLM (gpt-oss) then goes into an infinite loop trying to get the correct information from the tool. The tool in turn gives back invalid responses which do not match the query and the whole cycle is repeated again.


Integrate LangSmith with Langchain
· β˜• 3 min read · πŸ€– Naresh Mehta

LangSmith is a platform that allows you to track and analyze the performance of your LLMs. It provides a lot of features like tracing, debugging, etc. LangSmith is available as a python package and can be installed using pip and also as a docker image. But the best way to start using LangSmith is pretty simple.

If you have followed my previous article on Use LocalAI server with Langchain, you should have a localAI server running and a langchain setup to interact with it. You can download the example code that I have pasted in the previous article and run it to interact with the localAI server.


Use LocalAI server with Langchain
· β˜• 7 min read · πŸ€– Naresh Mehta

Now you might have used gemini, chatgpt, deepseek, claude, etc. for your daily activities or asking a question here and there. And most of these services ask for a subscription to use their services. And if you are not tech sauvy, you might not be aware that it is very easy to run local AI servers on your local machine. No need to have a subscription or pay for cloud services. The best part is that your normal PC/Mac will work just fine. Of course depending on your HW, there will be limits on the type of models that can be used. But running an SLM (Small Language Model) or a smaller LLM (Large Language Model) is a piece of cake.


How to get Started with AI?
· β˜• 6 min read · πŸ€– Naresh Mehta

AI has expanded into multiple territories. The pace of expansion has been exponential after 2022 when the first “free” LLMs were exposed to the general public for use. Suddenly overnight we have a variety of demography using AI for a variety of purposes. The chat interface offered by companies such as OpenAI, Google, ChatGPT, etc. provides for the most basic usage. People from all walks of life, all age groups and all professions use the chat interface to use the power of AI. Natural Language Processing (NLP) is a game changer in that context. I work in a multi-cultural environment with customers spread across the globe speaking different languages. Just about 5 years ago, a customer email in a local language had to be translated manually. And the quality of translation left a lot to be desired. Fast forward to today and language barriers seem almost non-existent! Most of the linked-in job postings now talk about practical AI usage experience rather than proficiency in certain language as a key skill. Language though comes as an added skillset. With the development of headsets that do on the fly translation, I guess it would be pushed further down in priority, all thanks to NLP and LLMs.


LLM Parameters
· β˜• 8 min read · πŸ€– Naresh Mehta

When we start learning about Large Language Models (LLMs), it is but natural to become quite interested in how the various parameters, training data size, context size, tokens, etc. affect the performance of the model. And how the existing models out there in the wild; both open and closed source; use the different parameters, what are their strengths and weaknesses, etc. It is also important to know and compare the training data sizes used in such models so one can understand how much resources would a relative model need in order to be trained from scratch.


Build LLMs From Scratch
· β˜• 3 min read · πŸ€– Naresh Mehta

Building Large Language Models (LLMs) from scratch is a complex and challenging task. It requires a deep understanding of the underlying mathematics and a strong foundation in computer science. In this post, we will explore the process of building a LLM from scratch and provide a step-by-step guide to help anyone get started.

LLMs are incredibly versatile, aiding in tasks such as checking grammar, composing emails, summarizing lengthy documents, and much more. They are β€œlarge”—very largeβ€”encompassing millions to billions of parameters. LLMs are a unique subset of AI. There is a very nice book Build LLMs from Scratch by Sebastian Raschka which shows a practical approach to building your own LLM.


Book Review - Maharanas: A Thousand Year War For Dharma by Omendra Ratnu
· β˜• 3 min read · πŸ€– Naresh Mehta

Theology and history goes hand in hand and should be read by any seeker of knowledge. History is the keystone to understanding the present and the future. Learning about history has a great impact on development of critical thinking skills, fostering of empathy and cultural awareness as well as shaping of individual and group identity. Connecting past events to current circumstances gives us a unique perspective of understanding human behavior, societal changes and complexities of the world we live in. Many of the so called “unsolvable” problems of the world haven’t been approached with critical thinking either because of lack of historical context or because of ignorance of the past.


What is AI?
· β˜• 4 min read · πŸ€– Naresh Mehta

Artificial Intelligence (AI) is a field of computer science that deals with the development of intelligent machines that can perform tasks that typically require human intelligence, such as visual perception, speech recognition, decision-making, and language translation. AI systems are designed to learn from data, identify patterns, and make predictions or decisions based on that data. AI has the potential to transform many aspects of our lives, from healthcare and transportation to education and entertainment. It has the potential to solve some of the world’s most pressing problems, such as climate change, poverty, and disease. However, it also raises ethical and philosophical questions, such as the impact of AI on jobs, privacy, and autonomy.