Components

The hub everything meets at.

The SmartHub is the center of a Wisej.AI screen. It is an extender provider you drop onto a container, and from there it connects three things: the endpoint that talks to a model, the adapters attached to your controls, and the tools — your own methods — that the AI is allowed to call.

A hub takes exactly one endpoint and any number of adapters and tools. It also exposes the high-level operations a screen reaches for directly: asking a question, generating embeddings, and ingesting or querying documents.

Holds the endpoint

Set Endpoint once and every adapter on the hub uses it. Change it to switch model or provider for the whole screen.

Extends your controls

GetAdapter(control) retrieves the adapter attached to a control, and GetAI(control) exposes its per-control AI properties.

Registers your tools

UseTool and UseTools add methods the model can call. Anything marked [SmartTool.Tool] is picked up automatically.

An extender, like the ones you know

If you have used a ToolTip or ErrorProvider, you already know the pattern: the hub extends the controls in its container with AI properties, without wrapping or replacing them. Your designer file stays a designer file; your controls stay the controls your code already references.

That is the quiet idea behind all of Wisej.AI — intelligence is added around the UI you have, not instead of it. Remove the hub and the screen still compiles, lays out and runs exactly as before.

Tools: AI on your terms

Tools are ordinary methods with an attribute. The [Description] tells the model when the tool applies; the signature tells it what arguments to produce. The model can request a call — your code decides what the call does, what it validates and what it refuses.

  • Register explicitly with UseTool / UseTools, fluently chainable.
  • Or let the hub discover every [SmartTool.Tool] method on a target object.
  • Plain .NET parameters and return values — no JSON schema to maintain.

Everything SmartTools can do →

Direct operations

Beyond wiring controls, the hub is the object you call for one-off work. Ask a question — optionally with an image and a system prompt. Generate an Embedding from text. Ingest a document into a collection, then run a similarity query to retrieve the passages that matter. The same hub powers both the attached adapters and these direct calls.

  • AskAsync(question, image, systemPrompt) for a single answer.
  • EmbedAsync(text) to turn text into a vector.
  • IngestDocumentAsync(...) to index a file for retrieval.
  • SimilarityQueryAsync(...) to find the closest passages.
  • Fluent registration: UseTool(...) returns the hub for chaining.

See how ingestion and retrieval work →

csharp
// One hub wires the whole screen together
var hub = new SmartHub(this) {           // 'this' is the container
    Endpoint = new OpenAIEndpoint { Model = "gpt-4o" }
};

// Register a tool the model may call
hub.UseTool(GetCurrentTime);

// Ask a question directly
Message answer = await hub.AskAsync("Summarize today's orders.");

[SmartTool.Tool]
[Description("Returns the current server time.")]
public DateTime GetCurrentTime() => DateTime.Now;

Next

The hub is the wiring. The adapters are the payoff.