Attribute Extraction from Images using DSPy

Attribute Extraction from Images using DSPy

Introduction

DSPy recently added support for VLMs in beta. A quick thread on attributes extraction from images using DSPy. For this example, we will see how to extract useful attributes from screenshots of websites

Signature

Define the signature. Notice the dspy.Image input field.

Article content

Program

Next define a simple program using the ChainOfThought optimizer and the Signature from the previous step

Article content

Final Code

Finally, write a function to read the image and extract the attributes by calling the program from the previous step.

Article content

Observability

That's it! If you need observability for your development, just add langtrace.init() to get deeper insights from the traces.

Article content

Source Code

You can find the full source code for this example here.

Langtrace x DSPy

Langtrace natively supports the tracing and monitoring of key metrics from DSPy optimizers and pipelines. This is helps you with understanding how a chosen module or an optimizer from DSPy works under the hood and gives you key visibility into better optimizing the performance of your application.

For more information, check out our previous blog post on this integration here. Here are some additional threads that people have found helpful:

Useful Resources

John Hayes

Observability | DevOps | Data

5mo

Thanks Karthik Kalyanaraman - that is really cool!

To view or add a comment, sign in

More articles by Karthik Kalyanaraman

  • Evaluating a RAG Agent using Langtrace

    Evaluating a RAG Agent using Langtrace

    Introduction In this post, we’ll walk through how to build a simple Retrieval-Augmented Generation (RAG) agent using…

    5 Comments
  • Evaluate CrewAI Agents using Langtrace

    Evaluate CrewAI Agents using Langtrace

    With the latest update, you can now evaluate both entire agent sessions and individual operations across your entire…

  • Automatic Prompt Generation using DSPy

    Automatic Prompt Generation using DSPy

    Introduction In this post, I will show you a simple implementation of "automatic prompt generation" for solving math…

    1 Comment
  • OpenAI launches Evals, Tracing & Fine tuning

    OpenAI launches Evals, Tracing & Fine tuning

    Introduction 📢 OpenAI makes an official entry into application specific Evals and LLM Ops tooling. OpenAI announced…

  • Building Compound AI systems

    Building Compound AI systems

    Introduction In this article, I will explain how I think about building and optimizing compound AI pipelines with…

    1 Comment
  • Why you need OpenTelemetry based Observability for your AI apps

    Why you need OpenTelemetry based Observability for your AI apps

    Introduction With the advent of LLMs, modern software development is going through an important shift - from mostly…

  • Evaluating the AI Oracle approach

    Evaluating the AI Oracle approach

    Recently, I came across this tweet about the AI Oracle approach for improving the accuracy and quality of responses for…

  • The year of Podcasts and Audio as UX vs the rest

    The year of Podcasts and Audio as UX vs the rest

    In 2019, I think the biggest threat to social media is going to be digital audio streaming (Podcasts and digital music…

    2 Comments
  • LinkedIn’s nifty new feature — Career Advice

    LinkedIn’s nifty new feature — Career Advice

    Recently, I was dabbling with LinkedIn’s features when I came across this new spot on my profile’s “Your Dashboard”…

    5 Comments

Insights from the community

Others also viewed

Explore topics