Skip to main content

Posts

Authenticate your Azure OpenAI Based App Using Microsoft Entra ID

If you’re using Azure OpenAI then you must be aware that the most common and easiest way to authenticate our application is using app-key. The key-based authentication approach is very popular because it is very straightforward. Let's have a quick look at the below code snippet: from openai import AzureOpenAI client = AzureOpenAI ( api_key = 'KEY_GOES_HERE' , api_version = "2024-02-01" , azure_endpoint = 'ENDPOINT_GOES_HERE' ) response = client . completions . create ( model = 'MODEL_GOES_HERE' , prompt = 'Tell me a joke' , max_tokens = 80 ) print ( "\n ##########" ) print ( response . choices [ 0 ] . text ) The above code snippet constructs the AzureOpenAI client object using api-key,api-version, and endpoint. Then, this object makes a call to the completion endpoint with the required parameters. Of course, app key works very well for the experimentation purpose and is not very well suited for ente

AI Prompt To Create A Poll: Revolutionizing Engagement

In the digital age, engagement is key. Whether you’re a business owner, a content creator, or a thought leader, understanding your audience is crucial. One of the most effective ways to do this is through polls. But how can you create a poll that not only engages your audience but also provides valuable insights? Enter AI . The Power of AI Artificial Intelligence (AI) has been a game-changer in many industries, and it’s now making its mark in the realm of audience engagement. With AI , you can generate prompts to create polls that are tailored to your audience and the topic at hand. This not only increases engagement but also makes the responses more insightful. How Does It Work? The AI takes into account the current hot topics in your industry and formulates a poll question around them. It also provides a concise introduction highlighting the topic’s relevance and its potential implications for the industry. The AI encourages engagement by posing insightful questions related to the tr

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_name (

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 of Custom