MarkupExtensions

Wisej.AI.MarkupExtensions

Namespace: Wisej.AI

Assembly: Wisej.AI (3.5.0.0)

Provides extension methods for configuring and handling events on SmartEndpoint, SmartHttpEndpoint, SmartHub, and SmartSession objects.

public class MarkupExtensions

The MarkupExtensions class offers a fluent API for setting properties and subscribing to events on various smart endpoint and session types. These extension methods enable concise and readable configuration of endpoints and event handlers.

Methods

ApiKey<T>(endpoint, value)

Sets the API key for the specified HTTP endpoint.

Parameter
Type
Description

T

A type derived from SmartHttpEndpoint.

endpoint

The HTTP endpoint to configure.

value

The API key.

Returns: T. The configured HTTP endpoint instance.

Authentication<T>(endpoint, value)

Sets the authentication string for the specified HTTP endpoint.

Parameter
Type
Description

T

A type derived from SmartHttpEndpoint.

endpoint

The HTTP endpoint to configure.

value

The authentication string.

Returns: T. The configured HTTP endpoint instance.

ContextWindow<T>(endpoint, value)

Sets the context window size for the specified endpoint.

Parameter
Type
Description

T

A type derived from SmartEndpoint.

endpoint

The endpoint to configure.

value

The context window size.

Returns: T. The configured endpoint instance.

EmbeddingModel<T>(endpoint, value)

Sets the embedding model for the specified endpoint.

Parameter
Type
Description

T

A type derived from SmartEndpoint.

endpoint

The endpoint to configure.

value

The embedding model name.

Returns: T. The configured endpoint instance.

Headers<T>(endpoint, value)

Sets the HTTP headers for the specified HTTP endpoint.

Parameter
Type
Description

T

A type derived from SmartHttpEndpoint.

endpoint

The HTTP endpoint to configure.

value

A NameValueCollection containing the headers.

Returns: T. The configured HTTP endpoint instance.

MaxOutputTokens<T>(endpoint, value)

Sets the maximum number of output tokens for the specified endpoint.

Parameter
Type
Description

T

A type derived from SmartEndpoint.

endpoint

The endpoint to configure.

value

The maximum number of output tokens.

Returns: T. The configured endpoint instance.

Model<T>(endpoint, value)

Sets the model name for the specified endpoint.

Parameter
Type
Description

T

A type derived from SmartEndpoint.

endpoint

The endpoint to configure.

value

The model name to assign.

Returns: T. The configured endpoint instance.

Name<T>(endpoint, value)

Sets the name for the specified endpoint.

Parameter
Type
Description

T

A type derived from SmartEndpoint.

endpoint

The endpoint to configure.

value

The name to assign.

Returns: T. The configured endpoint instance.

OnAfterInvokeTool<T>(object, action)

Subscribes to the AfterInvokeTool event on the specified object.

Parameter
Type
Description

T

A type derived from SmartObject.

object

The SmartObject to subscribe to.

action

The action to invoke when the event is raised.

Returns: T. The configured instance.

OnAfterResponseReceived<T>(object, action)

Subscribes to the AfterResponseReceived event on the specified object.

Parameter
Type
Description

T

A type derived from SmartObject.

object

The SmartObject to subscribe to.

action

The action to invoke when the event is raised.

Returns: T. The configured instance.

OnBeforeInvokeTool<T>(object, action)

Subscribes to the BeforeInvokeTool event on the specified object.

Parameter
Type
Description

T

A type derived from SmartObject.

object

The SmartObject to subscribe to.

action

The action to invoke when the event is raised.

Returns: T. The configured instance.

OnBeforeSendRequest<T>(object, action)

Subscribes to the BeforeSendRequest event on the specified object.

Parameter
Type
Description

T

A type derived from SmartObject.

object

The SmartObject to subscribe to.

action

The action to invoke when the event is raised.

Returns: T. The configured instance.

OnConvertParameter<T>(object, action)

Subscribes to the ConvertParameter event on the specified object.

Parameter
Type
Description

T

A type derived from SmartObject.

object

The SmartObject to subscribe to.

action

The action to invoke when the event is raised.

Returns: T. The configured instance.

OnDone<T>(object, action)

Subscribes to the Done event on the specified object.

Parameter
Type
Description

T

A type derived from SmartObject.

object

The SmartObject to subscribe to.

action

The action to invoke when the event is raised.

Returns: T. The configured instance.

OnError<T>(object, action)

Subscribes to the Error event on the specified object.

Parameter
Type
Description

T

A type derived from SmartObject.

object

The SmartObject to subscribe to.

action

The action to invoke when the event is raised.

Returns: T. The configured instance.

OnPrepareMessages<T>(object, action)

Subscribes to the PrepareMessage event on the specified object.

Parameter
Type
Description

T

A type derived from SmartObject.

object

The SmartObject to subscribe to.

action

The action to invoke when the event is raised, receiving the event arguments.

Returns: T. The configured instance.

OnStart<T>(object, action)

Subscribes to the Start event on the specified object.

Parameter
Type
Description

T

A type derived from SmartObject.

object

The SmartObject to subscribe to.

action

The action to invoke when the event is raised.

Returns: T. The configured instance.

RetryDelay<T>(endpoint, value)

Sets the retry delay (in milliseconds) for the specified HTTP endpoint.

Parameter
Type
Description

T

A type derived from SmartHttpEndpoint.

endpoint

The HTTP endpoint to configure.

value

The retry delay in milliseconds.

Returns: T. The configured HTTP endpoint instance.

SystemPrompt<T>(endpoint, value)

Sets the system prompt for the specified endpoint.

Parameter
Type
Description

T

A type derived from SmartEndpoint.

endpoint

The endpoint to configure.

value

The system prompt text.

Returns: T. The configured endpoint instance.

Text<T>(prompt, value)

Sets the Text for the specified SmartPrompt.

Parameter
Type
Description

T

A type derived from SmartPrompt.

prompt

The SmartPrompt to configure.

value

The text string.

Returns: T. The configured SmartPrompt instance.

URL<T>(endpoint, value)

Sets the URL for the specified HTTP endpoint.

Parameter
Type
Description

T

A type derived from SmartHttpEndpoint.

endpoint

The HTTP endpoint to configure.

value

The URL to assign.

Returns: T. The configured HTTP endpoint instance.

UseNativeTools<T>(endpoint, value)

Specifies whether to use native tools for the specified endpoint.

Parameter
Type
Description

T

A type derived from SmartEndpoint.

endpoint

The endpoint to configure.

value

True to use native tools; otherwise, false.

Returns: T. The configured endpoint instance.

Last updated