Skip to main content

Posts

How To Chat With Multiple CSV Files Together - Azure OpenAI + LangChain

When dealing with multiple CSV files having different columns, it’s essential to have an efficient method for querying and extracting relevant information. Azure OpenAI and LangChain provide a robust combination for handling such scenarios.  In this article, we’ll explore how to load multiple CSV files, process them, and ask questions across all of them. Let’s get started by installing the required packages. Install Required Packages Here are the ones which you need to install: ! pip install openai ! pip install langchain ! pip install pandas ! pip install langchain_experimental ! pip install langchain_openai ! pip install tabulate Import Required Packages Here are the packages which we need to import to get started: from langchain_openai import AzureOpenAI from langchain_experimental.agents import create_csv_agent Read Configuration First of all, we need to set few variables with information from Azure portal and Azure OpenAI Studio : api_type = "azure" api_base = ...

Functions And Plugins In Semantic Kernel

It's been a while since Semantic Kernel is around and in the last few months, a lot of many things have changed, specifically from the implementation point of view. Hence, I thought of summarize the key functions to help you understand better, which are also listed in Evan's blog.. As of today, there are 3 different ways to add plugins into the Semantic Kernel. Here are those: From a directory: Need to provide parent_directory and plugin_name  Using KernelPlugin instance  Using KernelFunction: Need to create a custom class or a dictionary where methods are decorated with kernel_function Similarly, there are few different ways to add functions in Semantic Kernel: KernelFunction.from_prompt a.k.a KernelFunctionFromPrompt(function_name, plugin_name, description, prompt, template_format, prompt_template, prompt_template_config, prompt_execution_settings)  KernelFunctionFromPrompt.from_yaml(yaml_str, plugin_name (optional)) KernelFunctionFromPrompt.from_directory(path, plugin_...

Generate The Streamed Response Using Semantic Kernel

Semantic Kernel , a powerful tool for integrating large language models into your applications, now supports streaming responses. In this blog post, we’ll explore how to leverage this feature to obtain streamed results from LLMs like AzureOpenAI and OpenAI. Why Streamed Responses Matter When working with language models, especially in conversational scenarios, streaming responses offer several advantages: Real-time Interaction: Streaming allows you to receive partial responses as they become available, enabling more interactive and dynamic conversations. Reduced Latency: Instead of waiting for the entire response, you can start processing and displaying content incrementally, reducing overall latency. Efficient Resource Usage: Streaming conserves memory and resources by handling data in smaller chunks. How to Use Streaming Responses I've published a complete video on how to generate this using Python and that can be found on my YouTube channel named Shweta Lodha . Here, I'm jus...

Learn to Call Your Custom Function Using Semantic Kernel

In this tutorial, we will dive into the fascinating world of Semantic Kernel and explore how to seamlessly integrate our custom functions into AI applications. Whether you’re a developer, data scientist, or just curious about the intersection of language models and native code, this tutorial is for you! 📌 Key Points Covered: Why Create Functions for Your AI?  Large language models excel at generating text, but there are tasks they can’t handle alone. I'll discuss scenarios where native functions shine, such as retrieving data from external sources, performing complex math, and interacting with the real world. Creating Your Native Functions: Set up a new folder for your plugins Dive into the creation of your own plugin to demonstrate the required operations Implement functions as required Running Your Native Functions: I'll also highlight, how  Semantic Kernel utilizes  KernelFunctions to invoke our custom functions. 🎥  Watch the Full Tutorial: Shweta Lodha 

CustomGPT.ai: Unleashing the Power of Customized AI Assistants

Today everyone is living in an era of AI, whether it is a professional, student, home maker or a businessperson. Everyone is looking for a personal chatbot kind of solution which can fulfill their everyday need.  Just think of some scenarios like, Imagine an online store where an AI Assistant knows exactly what customers need, even before they do. Imagine an AI Assistant that assists with updating website content, ensuring a great user experience. These are just few examples. But the thing, which is common among all these is, everyone needs a trusted AI Assistant. Keeping all this in mind, CustomGPT.ai created an AI Assistant, which has following capabilities: Provides no code solution Provides API for customization Provides accurate responses No hallucination at all Takes care of data privacy and regulatory concerns If you're also excited to meet such an amazing assistant, then what are you waiting for?  Special offer for my followers  🤩 Get 1-month of free subscription...

How To Handle Large Response From An API In Python

Handling large responses from APIs in Python can be challenging, especially when dealing with substantial amounts of data. Here are some strategies to efficiently manage such scenarios: Pagination If the API supports it, use pagination to retrieve data in smaller chunks. Fetch a limited number of records per request, and then iterate through subsequent pages. This approach prevents overwhelming your system with a massive response all at once. import requests def fetch_data_from_api ( url , page_size = 50 ):     all_data = []     page = 1     while True :         response = requests . get ( url , params ={ " page " : page , " per_page " : page_size })         if not response . ok :             break         data = response . json ()         all_data . extend ( data )         page += 1     return all_...

Tips To Improve LLM-Based Applications

Large Language Models (LLMs) are powerful AI systems that can understand and generate natural language. They have many applications in various domains, such as natural language processing, machine translation, and healthcare. However, building LLM-based applications is not a trivial task. It requires careful consideration of several factors, such as the choice of the LLM, the data quality, the evaluation metrics, and the ethical implications.  In this blog post, I will share some tips to solve most common problems. How to extract correct content from LLM Problem says that, although the answer is present in the content, but model fails to extract that.  Here are the quick tips to resolve this problem: Prompt compression Remove irrelevant data Rectify typos and grammatical errors Remove duplicate data Use data cleaning libraries Problem of missing top ranked documents Problem states that correct document was not rankled while ranking the documents. Here are the fe...