Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Structured Outputs with DSPy

Автор: Connor Shorten

Загружено: 2024-04-01

Просмотров: 10366

Описание:

The code for this notebook can be found here! - https://github.com/weaviate/recipes/b...

Unfortunately, Large Language Models will not consistently follow the instructions that you give them. This is a massive problem when you are building AI systems that require a particular type of output from the previous step to feed into the next one!

For example, imagine you are building a blog post writing system that first takes a question and retrieved context to output a list of topics. These topics have to be formatted in a particular way, such as a comma-separated list or a JSON of Topic objects, such that the system can continue writing the blog post!

I am SUPER excited to share the 4th video in my DSPy series, diving into 3 solutions to structuring outputs in DSPy programs: (1) TypedPredictors, (2) DSPy Assertions, and (3) Custom Guardrails with the DSPy programming model!

TypedPredictors follow the line of thinking around JSON mode and using Pydantic BaseModels to interface types and custom objects into a JSON template for LLMs. The output can then be validated to provide a more structured retry prompt to correct the output structure!

DSPy Assertions are one of the core building blocks of DSPy, offering an interface to input a boolean-valued function and a retry prompt which is templated alongside the past output to retry the call to the LLM!

Custom Guardrails with the DSPy Programming Model are one of the things I love the most about DSPy — we have unlimited flexibility to control these systems however we want. The video will also show you how to write custom guardrails and retry Signatures and discussion around using TypedPredictors for your Custom Guardrails and potentially feeding your Custom Guardrails into a DSPy Assertion.

I had so much fun exploring this topic! Further seeing how well OpenAI’s GPT-4 and GPT-3.5-Turbo, Cohere’s Command R, and Mistral 7B hosted with Ollama perform with each Structured Output strategy! I also found monitoring structured output retries to be another fantastic application of Arize Phoenix! I hope you find the video useful!

If interested, all the code examples for this DSPy series can be found here! - https://github.com/weaviate/recipes/t...

OpenAI Function Calling: https://openai.com/blog/function-call...
Gorilla LLM Function Calling Leaderboard: https://gorilla.cs.berkeley.edu/leade...
Instructor Examples: https://github.com/jxnl/instructor/tr...

*ERRATA* (Massive thank you to Thomas Ahle for sending some notes and clarifications of content covered in the video)
1. `dspy.TypedPredictor` can be used directly instead of `dspy.functional.TypedPredictor`
2. When creating a pydantic type, `list[Topic]` can be used directly in the Signature without needing the `Topics` wrapper.
3. The default `max_retry` for TypedPredictor is 3, and can be set when creating the TypedPredictor.
4. Setting `TypedPredictor(explain_errors=True)` can help with retry errors by providing clearer descriptions of what needs to change.

Chapters
0:00 Welcome! Let’s Structure LLM Outputs!
3:12 Background (Instructor, Function Calling, JSON mode)
9:08 TypedPredictors Demo
16:00 Logging with Arize Phoenix
18:15 DSPy Assertions
22:15 Custom Guardrails

Structured Outputs with DSPy

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Объяснение DSPy!

Объяснение DSPy!

Domain-Driven Design | Просто о сложном

Domain-Driven Design | Просто о сложном

MAGIC of DSPY 3 (Stanford) - Lean 4

MAGIC of DSPY 3 (Stanford) - Lean 4

Структурированный вывод OpenAI (очистить грязные данные)

Структурированный вывод OpenAI (очистить грязные данные)

Начинаем работу с RAG в DSPy!

Начинаем работу с RAG в DSPy!

Почему LLM застряли в прошлом и как RAG это исправляет

Почему LLM застряли в прошлом и как RAG это исправляет

Визуализация внимания, сердце трансформера | Глава 6, Глубокое обучение

Визуализация внимания, сердце трансформера | Глава 6, Глубокое обучение

GraphRAG: графы знаний, полученные с помощью LLM, для RAG

GraphRAG: графы знаний, полученные с помощью LLM, для RAG

Чего ждать от рефлексии в C++26

Чего ждать от рефлексии в C++26

Stop Prompt Engineering! Program Your LLMs with DSPy

Stop Prompt Engineering! Program Your LLMs with DSPy

Why I Use Golang In 2024

Why I Use Golang In 2024

Adding Depth to DSPy Programs

Adding Depth to DSPy Programs

Почему тебе нужен свой домашний сервер? Показываю реальный опыт HOMELAB

Почему тебе нужен свой домашний сервер? Показываю реальный опыт HOMELAB

Let the LLM Write the Prompts: An Intro to DSPy in Compound AI Pipelines

Let the LLM Write the Prompts: An Intro to DSPy in Compound AI Pipelines

Omar Khattab, DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines

Omar Khattab, DSPy: Compiling Declarative Language Model Calls into Self-Improving Pipelines

Китайский интернет — будущее России? Жизнь за цифровым забором

Китайский интернет — будущее России? Жизнь за цифровым забором

«Хорошо, но мне нужна Llama 3 для моего конкретного случая использования» — вот как

«Хорошо, но мне нужна Llama 3 для моего конкретного случая использования» — вот как

Learn to Program Not Write Prompts with DSPy

Learn to Program Not Write Prompts with DSPy

Bay.Area.AI:  DSPy: Prompt Optimization for LM Programs, Michael Ryan

Bay.Area.AI: DSPy: Prompt Optimization for LM Programs, Michael Ryan

Забудь VS Code — Вот Почему Все Переходят на Cursor AI

Забудь VS Code — Вот Почему Все Переходят на Cursor AI

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]