█

AI/TLDR

मुझे पिलाएं कॉफ़ी
मुझे एक कॉफ़ी पिलाएँ

DeepSeek Recipe

DeepSeek की अपनी Rust और Python लाइब्रेरी, जो DeepSeek V4 और V4.1 prompts को एन्कोड करने और model output को पार्स करने के लिए है

Tokenizersओपन सोर्स
ताज़ा
0.1.0
अपडेट किया गया
10 सित॰ 2026
भाषा
Rust
लाइसेंस
MIT
कवरेज
1 story

नया क्या है

0.1.010 सित॰ 2026

DeepSeek published deepseek-recipe, the official library for converting Messages, Chat Completions and Responses requests into DeepSeek V4 and V4.1 prompts and parsing model output back. The Rust crate landed on crates.io as 0.1.0 and the Python bindings on PyPI, both MIT-licensed.

ताज़ा खबरें

संक्षेप में

DeepSeek Recipe क्या है?

DeepSeek Recipe DeepSeek की अपनी Rust और Python लाइब्रेरी, जो DeepSeek V4 और V4.1 prompts को एन्कोड करने और model output को पार्स करने के लिए है. यह Models & Inference टूल्स की Tokenizers श्रेणी में आता है; ओपन सोर्स है, Rust में लिखा गया है और MIT लाइसेंस के तहत है।

अपडेट किया गया Markdown वर्शन ↗

सारांश

DeepSeek Recipe, DeepSeek मॉडल्स के लिए prompt-format layer है, जिसे DeepSeek ने खुद Rust crates और Python bindings के रूप में प्रकाशित किया है। यह उस सवाल का जवाब देती है जो open weights सर्व करने वाली हर टीम को किसी न किसी तरह हल करना पड़ता है: एक chat request आने पर model में कौन सा सटीक text, या सटीक token ids, जाना चाहिए, और raw output को वापस किस तरह response में बदला जाए? किसी model card में इस format का सिर्फ़ विवरण देकर हर provider पर उसे दोबारा लागू करने का काम छोड़ने के बजाय, DeepSeek खुद implementation भेज रहा है।

इस डिज़ाइन में सब कुछ एक साझा `Conversation` type के ज़रिए चलता है। Messages, Chat Completions या Responses format में आने वाले requests को एक `Conversation` में बदला जाता है, फिर वह `Conversation` DeepSeek V4 या V4.1 के लिए prompt या token-id sequence में render किया जाता है, और model का output उस response format में वापस parse किया जाता है जो caller ने माँगा था। चूँकि हर format इसी बीच वाले type में बदलता है और वापस आता है, नया format जोड़ने में हर जोड़ी के लिए एक नहीं, बल्कि सिर्फ़ एक converter लगता है। Streaming और complete, दोनों responses supported हैं, साथ में text, images, reasoning content और client tool calls भी।

यह repository सिर्फ़ library नहीं है। `deepseek-recipe-core`, `deepseek-recipe-encoding`, `deepseek-recipe-image` और `deepseek-recipe-python` crates के साथ इसमें एक browser demo भी है, जिससे prompt को एन्कोड किया जा सकता है, उसके special tokens देखे जा सकते हैं और पूरे model output को डिकोड किया जा सकता है। साथ ही Rust (Axum) और Python (FastAPI) में चलाने योग्य example API servers भी दिए गए हैं। Code और public documentation MIT-licensed हैं, और tokenizer files के लिए अलग notices दी गई हैं।

कुछ क्षमताएँ अभी स्पष्ट रूप से लागू नहीं हुई हैं: token probability आउटपुट, document, audio और video इनपुट, फ़ाइल रिट्रीवल, सर्वर-साइड टूल एक्ज़ीक्यूशन, JSON Schema और regex आउटपुट कंस्ट्रेंट्स, एक request में एक से अधिक completion, `apply_patch` से आगे के custom Responses tools, और एन्क्रिप्टेड thinking content। README में ये सभी सूचीबद्ध हैं, इसलिए किसी feature को मौजूद मानने से पहले वह सूची पढ़ लेना उपयोगी है।

यह क्या करता है

  • Messages, Chat Completions और Responses requests को एक ही `Conversation` type में बदलता है, और model output को मेल खाने वाले response format में वापस बदलता है
  • DeepSeek V4 और V4.1 conversations को या तो render किए गए prompt में, या raw token ids में एन्कोड करता है
  • Thinking modes, reasoning effort levels, temperature, top_p और token limits को एन्कोड किए गए prompt तक पहुँचाता है
  • base64 के रूप में या URLs से दी गई images को संभालता है, और एक अलग image crate में OpenCV के ज़रिए V4.1 का preprocessing step लागू करता है
  • Streamed output को टुकड़ों में पार्स करता है, ताकि reasoning content और client tool calls पहले से डिकोड होकर आएँ
  • Prompts को एन्कोड करने, special tokens देखने और पूरे model output को डिकोड करने के लिए web demo शामिल है
  • Rust (Axum) और Python (FastAPI), दोनों में example API servers शामिल हैं
  • MIT-licensed code और documentation, और tokenizer notices अलग से दिए गए हैं

शुरू करें

DeepSeek Recipe को Python या Rust, दोनों में से किसी से भी इस्तेमाल किया जा सकता है। नीचे दिए गए commands project के README से लिए गए इंस्टॉल निर्देश हैं।

Python bindings इंस्टॉल करें

Python 3.10 या उससे नया होना ज़रूरी है।

bashbash
python3 -m pip install deepseek-recipe

या Rust crates जोड़ें

Core crate request और response का conversion संभालता है; encoding crate conversations को prompts और token ids में render करता है।

bashbash
cargo add deepseek-recipe@0.1 deepseek-recipe-encoding@0.1

Request को बदलें और उसे एन्कोड करें

Python में request को `ChatCompletionRequest` में पार्स किया जाता है, फिर साझा `Conversation` type में बदला जाता है, और `DeepseekV41Encoding` के साथ उसे model की अपेक्षित prompt में render किया जाता है।

pythonpython
from deepseek_recipe import ChatCompletionRequest, DeepseekV41Encoding

Browser demo में prompts जाँचें

Repository में एक encoding और decoding demo है। इसे repo root से चलाएँ, टर्मिनल में दिखाए गए address को खोलें, और वहाँ prompt को एन्कोड करें, उसके special tokens देखें, और पूरे model output को डिकोड करें।

bashbash
cargo run -p encoding-decoding-demo --locked

किसी example server से शुरू करें

`server-rs` (Axum) और `server-py` (FastAPI) library पर बने पूरे example API servers हैं, यानी समर्थित request formats में से किसी एक पर काम करने वाला endpoint पाने का सबसे छोटा रास्ता।

कमांड और कोड प्रोजेक्ट के अपने दस्तावेज़ों से लिए गए हैं — हमेशा जांचें आधिकारिक repo ताज़ा जानकारी के लिए।

कब इस्तेमाल करें

  • अपने हार्डवेयर पर DeepSeek V4 या V4.1 open weights सर्व करना, उसी prompt format के साथ जिस पर model को ट्रेन किया गया था
  • एक API gateway बनाना जो Messages, Chat Completions या Responses requests स्वीकार करे और DeepSeek models की ओर भेजे
  • मूल्यांकन स्कोर उम्मीद से कम दिखें तो मौजूदा chat template की तुलना reference implementation से करना
  • बिना parser लिखे, streamed DeepSeek output को structured reasoning content और tool calls में डिकोड करना
  • DeepSeek V4.1 के लिए image inputs को उसी preprocessing के साथ संभालना, जिसकी model अपेक्षा करता है

How DeepSeek Recipe compares

DeepSeek Recipe alongside other open-source tokenizers tools AI/TLDR tracks, ranked by GitHub stars.

टूलस्टारयह क्या करता है
Hugging Face Tokenizers★ 11.4kTransformers इकोसिस्टम के पीछे की Rust tokenizer लाइब्रेरी, vocabulary ट्रेन करने और text encode करने के लिए
GigaToken★ 4.2kRust में बना tokenizer, जो टेक्स्ट को गीगाबाइट प्रति सेकंड की रफ़्तार से एनकोड करता है और Hugging Face या tiktoken कोड में सीधे फ़िट हो जाता है
DeepSeek Recipe★ 3kDeepSeek की अपनी Rust और Python लाइब्रेरी, जो DeepSeek V4 और V4.1 prompts को एन्कोड करने और model output को पार्स करने के लिए है