LlmCall.Dialect.Adapter (llm_call v0.1.0)

Copy Markdown View Source

use for a completion adapter.

Injects the behaviour, the canonical aliases, the codec's own name, and encode_request/2:

use LlmCall.Dialect.Adapter, codec: :openai_chat

@path "/v1/chat/completions"
@headers [{"content-type", "application/json"}]

@path and @headers may appear anywhere in the module body; they are read once the module finishes, so declaration order does not matter.

The codec still supplies info/0, capabilities/2, validate_request/2, and a private body/2 that returns the wire body for a validated request.

Pass encode: false when the protocol needs its own encode_request/2 — for example a per-model path or a non-POST method.