package deepseek

  1. Overview
  2. Docs
On This Page
  1. Streaming decode
Deepseek v4 LLM

Install

dune-project
 Dependency

Authors

Maintainers

Sources

deepseek-0.1.0.tbz
md5=816187f01c004f7b1b554512a45ce9df
sha512=4dd13eea0977d1064bd580c366673e819f8f06874fd6e3b83bf9a585c283ffa9ff9fee0ff671127a5f60320a22bf1c84f526855916564da6de72e1c335c86e63

doc/deepseek.dsml/Dsml/Stream/index.html

Module Dsml.StreamSource

Streaming decode

Decode a completion as it is generated, token by token, emitting reasoning and content text as it arrives and tool calls once each block completes. This is the primitive an interactive agent feeds with model output.

Sourcetype event =
  1. | Reasoning of string
    (*

    a chunk of <think> reasoning

    *)
  2. | Content of string
    (*

    a chunk of reply text

    *)
  3. | Tool_call of tool_call
    (*

    a completed tool call

    *)
  4. | Done
    (*

    end of turn (EOS reached)

    *)

A piece of decoded output.

Sourcetype t

An incremental decoder.

Sourceval create : thinking_mode -> t

create mode is a fresh decoder.

Sourceval feed : t -> string -> event list

feed d chunk decodes the next chunk of generated text, in order. Partial markers spanning chunk boundaries are held back until complete.

Sourceval finish : t -> event list

finish d flushes buffered text at end of stream and emits Done.