Blog Post

Educator Developer Blog
6 MIN READ

Learn Python + AI from our video series!

Pamela_Fox's avatar
Pamela_Fox
Icon for Microsoft rankMicrosoft
Apr 04, 2025

Available in both English and Spanish, with slides and code

We just wrapped up our first Python + AI series, a six-part series showing how to use generative AI models from Python, with versions in both English and Spanish. We covered multiple kinds of models, like LLMs, embedding models, and multimodal models. We introduced popular approaches like RAG, function calling, and structured outputs. Finally, we discussed AI risk mitigation layers and showed how to evaluate AI quality and safety.

To make it easy for everyone to follow along, we made sure all of our code examples work with GitHub Models, a service which provides free models for every GitHub account holder for experimentation and education.

Even if you missed the live series, you can still go through all the material from the links below! If you're an instructor yourself, feel free to use the slides and code examples in your own classes.

English series

Python + AI: Large Language Models

YouTube video
📺 YouTube recording

In this first session, we introduce Large Language Models (LLMs), the models that power ChatGPT and GitHub Copilot. We use Python to interact with LLMs using popular packages like the OpenAI SDK and Langchain. We experiment with prompt engineering and few-shot examples to improve our outputs. Finally, we show how to build a full stack app powered by LLMs, and explain the importance of concurrency and streaming for user-facing AI apps. 

Python + AI: Vector embeddings

YouTube video
📺 YouTube recording

In our second session of the Python + AI series, we dive into a different kind of model: the vector embedding model. A vector embedding is a way to encode a text or image as an array of floating point numbers. Vector embeddings make it possible to perform similarity search on many kinds of content. In this session, we explore different vector embedding models, like the OpenAI text-embedding-3 series, with both visualizations and Python code. We also compare distance metrics, and use both quantization and truncation dimension to reduce vector size.

Python + AI: Retrieval Augmented Generation

YouTube video
📺 YouTube recording

In our third Python + AI session, we explore one of the most popular techniques used with LLMs: Retrieval Augmented Generation. RAG is an approach that sends context to the LLM so that it can provide well-grounded answers for a particular domain. The RAG approach can be used with many kinds of data sources like CSVs, webpages, documents, databases. In this session, we walk through RAG flows in Python, starting with a simple flow and culminating in a full-stack RAG application based on Azure AI Search. 

Python + AI: Vision models

YouTube video
📺 YouTube recording

Our fourth stream in the Python + AI series is all about vision models! Vision models are LLMs that can accept both text and images, like GPT 4o and GPT 4o-mini. You can use those models for image captioning, data extraction, question-answering, classification, and more. In this session, we use Python to send images to vision models, build a basic chat app with image upload, search with multimodal embedding models, and even use vision models inside a RAG application. 

Python + AI: Function calling & structured outputs

YouTube video
📺 YouTube recording

In our fifth stream of the Python + AI series, we explore the two main ways to get LLMs to output structured responses that adhere to a schema: function calling and structured outputs. We start with function calling, which is the most well supported way to get structured responses, and discuss its drawbacks. Then we focus on the new structured outputs mode available in OpenAI models, which can be used with Pydantic models and even used in combination with function calling. Our examples demonstrate the many ways you can use structured responses, like entity extraction, classification, and agentic workflows. 

Python + AI: Quality & Safety

YouTube video
📺 YouTube recording

In our final session of the Python + AI series, we tackle a crucial topic: how to use AI safely, and how to evaluate the quality of AI outputs. There are multiple risk mitigation layers when working with LLMs: the model itself, a safety system on top, the prompting and context, and the application user experience. Our focus is on Azure tools that make it easier to put safe AI systems into production. We show how to configure the Azure AI Content Safety system when working with Azure AI models, and how to handle those errors in Python code. Then we use the Azure AI Evaluation SDK to evaluate the safety and quality of the output from our LLM. 

Spanish series

Python + IA: Modelos de Lenguaje Grande

YouTube video
📺 Grabación de YouTube

En esta primera sesión, hablamos sobre los Modelos de Lenguaje Grande (LLMs), los modelos que impulsan ChatGPT y GitHub Copilot. Usamos Python para interactuar con LLMs utilizando paquetes populares como el SDK de OpenAI y Langchain. Experimentamos con ingeniería de prompts y ejemplos de few-shot para mejorar nuestros resultados. Mostramos cómo construir una aplicación full stack impulsada por LLMs, y explicamos la importancia de la concurrencia y el streaming para aplicaciones de IA orientadas al usuario. 

Python + IA: Vector embeddings

YouTube video
📺 Grabación de YouTube

En nuestra segunda sesión de la serie Python + IA, profundizamos en un tipo diferente de modelo: vector embeddings. Un vector embedding es una forma de codificar texto o imágenes como un array de números decimales. Los vector embeddings hacen posible realizar búsquedas por similitud en varios tipos de contenido. En esta sesión, exploramos diferentes modelos de embeddings, como la serie text-embedding-3 de OpenAI, usando tanto visualizaciones como código Python. También comparamos métricas de distancia y usamos cuantización para reducir el tamaño de los vectores.

Python + IA: Recuperación-Aumentada Generación

YouTube video
📺 Grabación de YouTube

En nuestra tercera sesión de Python + IA, exploramos una de las técnicas más populares usadas con LLMs: la Generación Aumentada por Recuperación (RAG). RAG es una tecnica que envía contexto al LLM para que pueda proporcionar respuestas bien fundamentadas para un dominio específico. RAG puede usarse con varios tipos de fuentes de datos como CSVs, páginas web, documentos y bases de datos. En esta sesión, revisamos flujos RAG en Python, comenzando con un flujo simple y culminando en una aplicación full-stack RAG basada en Azure AI Search.

Python + IA: Modelos de Visión

YouTube video
📺 Grabación de YouTube

¡Nuestra cuarta sesión de la serie Python + IA trata sobre modelos de vision! Los modelos de visión como GPT 4o y 4o-mini son LLMs que pueden aceptar tanto texto como imágenes. Puedes usar estos modelos para generar descripciones de imágenes, extraer datos, responder preguntas, clasificar, y mucho más. Usamos Python para enviar imágenes a modelos de visión, construir una aplicación básica de chat con imágenes, e incluso usarlos dentro de una aplicación RAG. 

Python + IA: Llamadas a funciones y salidas estructuradas

YouTube video
📺 Grabación de YouTube

En nuestra quinta sesión de la serie Python + IA, exploramos las dos formas principales de hacer que los LLMs generen respuestas estructuradas según un esquema: llamadas a funciones y salidas estructuradas. Comenzamos con las llamadas a funciones, que es la forma más utilizada para obtener respuestas estructuradas, y hablamos de sus limitaciones. Luego nos enfocamos en el nuevo modo de salidas estructuradas disponible en los modelos de OpenAI, que puede usarse con modelos Pydantic e incluso combinarse con llamadas a funciones. Nuestros ejemplos demuestran las múltiples formas en que puedes usar respuestas estructuradas, como extracción de entidades, clasificación y flujos de trabajo con agentes. 

Python + IA: Calidad y seguridad

YouTube video
📺 Grabación de YouTube

En nuestra sesión final de la serie Python + IA, discutimos un tema crucial: cómo usar la IA de manera segura y cómo evaluar la calidad de las salidas de IA. Hay múltiples capas de mitigación cuando se trabaja con LLMs: el modelo en sí, un sistema de seguridad superpuesto, el prompt y contexto, y la experiencia de usuario de la aplicación. Nuestro enfoque es en las herramientas de Azure que facilitan poner sistemas de IA seguros en producción. Mostramos cómo configurar el sistema Azure AI Content Safety cuando se trabaja con modelos de Azure AI, y cómo manejar esos errores en código Python. Luego usamos el SDK de Evaluación de Azure AI para evaluar la seguridad y calidad de la salida de nuestro LLM.

Updated Apr 04, 2025
Version 2.0
No CommentsBe the first to comment