Dsxir.Adapter.Chat (dsxir v0.5.0)

Copy Markdown

Chat adapter: prompts the LM with [[ ## field ## ]] markers and parses the response by splitting on those markers, JSON-decoding typed fields, and validating each output through its Zoi schema.

Returns {:ok, map} on success or {:error, %Dsxir.Errors.Adapter.* {}} on malformed output. No fallback to other adapters happens here.

Summary

Functions

Validate field names passed to :listen against a signature. Each must be a declared, string-typed output field — token-streaming a typed (JSON) field is meaningless since its value can't be parsed mid-stream. Raises Dsxir.Errors.Invalid.Configuration (:unknown_listened_field or :non_string_listened_field) otherwise.

Functions

validate_listeners!(signature, fields)

@spec validate_listeners!(Dsxir.Signature.Runtime.signature(), [atom()]) :: :ok

Validate field names passed to :listen against a signature. Each must be a declared, string-typed output field — token-streaming a typed (JSON) field is meaningless since its value can't be parsed mid-stream. Raises Dsxir.Errors.Invalid.Configuration (:unknown_listened_field or :non_string_listened_field) otherwise.