Structured outputs with Deepseek R1

submited by
Style Pass
2025-01-21 01:30:04

Deepseek has recently released Deepseek R1, a reasoning model that can match the performance of OpenAI's o1 model at some tasks, at 1/50th of the cost (as of January 2025).

Our prompting framework, BAML, lets you do function-calling / tool-use with DeepseekR1 even when it is not officially supported.

First we write some BAML code to classify messages. Here we write a function that takes a message and returns a category, that will be executed by an LLM. BAML will parse the result for you into the right enum type.

BAML lets you write tools like normal Unions of types. Here's another example where we have two tools, one that searches products, and one that schedules appointments.

Leave a Comment