Release 1.0.0 Notes
The package provides built-in support for using Zaria.AI in AspNetCore web applications. Added helper funcitons to IApplicationBuilder and IServiceCollection. With these, Zaria.AI can be used in WebApi applications
in the same manner as console. To leverage Zaria.AI add the following calls during application statup.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddZaria();
//other boilerplate web api stuff would go here
app.UseZaria();
app.Run();
The UseZaria method can optionally accept a string representing the root path that will trigger Zaria functionality (by default
this is /zaria). So zaria would be triggered for
http://some host/zaria/echo "hello world"
which would show in the address bar as:
http://some host/zaria/echo%20"hello%20world"
If app.UseZaria("sampler")
is used then the correct url to trigger it would be:
http://some host/sampler/echo "hello world"
AddZaria can optionally accept a delegate that allows you to configure the processor as needed. The following sample
illustrtes loading remote patterns into the processor.
// Add services to the container.
builder.Services.AddZaria(processor =>
{
processor.ScanReferencedAssembly<MyAssemblyIdentifier>();
processor.LoadRemotePatternRepository("""
{
"Patterns": [
{
"Pattern": "you dey craze1",
"HandlerURI": "http://localhost:5227/zaria/echo 888",
"Method": "get"
},
{
"Pattern": "you dey mad2",
"HandlerURI": "http://localhost:5227/zaria/echo 999",
"Method": "get"
}
]
}
""");
});