Class BowireAiScaffold

Namespace
Kuestenlogik.Bowire.Ai
Assembly
Kuestenlogik.Bowire.Ai.dll

The AI half of scaffolding (#177): a sentence becomes a ScaffoldSpec. The model only ever writes the spec — the files come from the checked-in templates — so a small local model is enough, and a different model changes at most the field list, never the shape of the code.

public static class BowireAiScaffold
Inheritance
BowireAiScaffold
Inherited Members

Remarks

Local first, cloud as fallback, parser last. The configured provider is asked when it is local. When it is a cloud provider, a local Ollama or LM Studio that answers the probe is asked first and the cloud provider only when the local one fails. Bowire:Ai:Scaffold:PreferLocal = false asks the configured provider only. When no model gives a usable spec, ScaffoldIntentParser does.

Fields

ModelTimeout

How long one model may take for one spec.

public static readonly TimeSpan ModelTimeout

Field Value

TimeSpan

Methods

MapBowireAiScaffoldEndpoints(IEndpointRouteBuilder, string)

POST {basePath}/api/ai/scaffold — { intent, protocol } in, a ScaffoldProposal out. Answers even without any model: then the parser wrote the spec, and source says so.

public static IEndpointRouteBuilder MapBowireAiScaffoldEndpoints(this IEndpointRouteBuilder endpoints, string basePath = "/bowire")

Parameters

endpoints IEndpointRouteBuilder
basePath string

Returns

IEndpointRouteBuilder

ModelsAsync(BowireAiOptions, IChatClient?, IEnumerable<IBowireAiProviderFactory>, bool, CancellationToken)

The models to ask, local first: the configured provider when it is local; otherwise a local server that answers the probe, then the configured cloud provider.

public static Task<IReadOnlyList<ScaffoldModel>> ModelsAsync(BowireAiOptions configured, IChatClient? configuredClient, IEnumerable<IBowireAiProviderFactory> factories, bool preferLocal, CancellationToken ct)

Parameters

configured BowireAiOptions
configuredClient IChatClient
factories IEnumerable<IBowireAiProviderFactory>
preferLocal bool
ct CancellationToken

Returns

Task<IReadOnlyList<ScaffoldModel>>

ProposeAsync(IReadOnlyList<ScaffoldModel>, string, string?, CancellationToken)

Ask models in order, then fall back to the parser. Never throws for a model's failure — that becomes a note.

public static Task<ScaffoldProposal> ProposeAsync(IReadOnlyList<ScaffoldModel> models, string intent, string? protocol, CancellationToken ct)

Parameters

models IReadOnlyList<ScaffoldModel>
intent string
protocol string
ct CancellationToken

Returns

Task<ScaffoldProposal>