Skip to content

Model and tools

Provider-neutral messages, models, tool definitions, and structured output.

Updated View as Markdown

cortavyn-model-api defines portable messages, requests, responses, streaming events, tool calls, and structured output. Provider modules translate these contracts to each remote protocol; they never execute your tools.

Use ChatModel for completions, StreamingChatModel when incremental events matter, and StructuredChatModel to request a Java record from a model. Tool definitions describe what a model may call, while application-owned executors perform the work.

record Weather(String city, int temperature) { }

Weather answer = model.withStructuredOutput(Weather.class)
        .complete(request)
        .toCompletableFuture()
        .join()
        .value();

See Providers for adapter selection and Chat for tools in an agent loop.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close