Skip to content

SubQ

SubquadraticProvider in the Vercel.AI.Subquadratic namespace creates the SubQ models that this port implements. The API reference lists every option: SubquadraticProvider.

Browse the upstream catalog of SubQ models and their pricing on the Vercel AI Gateway models page.

Kind Factory method Model ids in this port’s tests and docs
Language LanguageModel subq-savant-1.4, subq-savant-latest
Decision DecisionModel subq-snap-1.2, subq-snap-latest

A model id in the table is one that the tests or docs use. It is not the complete list of ids the provider accepts. Pass any id that the provider documents. An id that links to the Vercel AI Gateway catalog has a Gateway slug listed there.

Language model:

var model = SubquadraticProvider.Create().LanguageModel("subq-savant-1.4");
var result = await Ai.GenerateTextAsync(
new GenerateTextOptions
{
Model = model,
Prompt =
"In three bullets, explain indemnification, limitation of liability, and insurance requirements.",
}
);
Console.WriteLine(result.Text);

snippet source | anchor

Decision model:

var model = SubquadraticProvider.Create().DecisionModel("subq-snap-1.2");
var result = await Decide.DecideAsync(
new DecideRequest
{
Model = model,
State = "I was charged twice for my subscription. Please refund the duplicate.",
Questions = new Dictionary<string, DecisionQuestion>
{
["category"] = new(
"choice",
"Which team should handle this request?",
new DecisionChoiceCriteria(
new Dictionary<string, DecisionInput?>
{
["billing"] = "Charges, invoices, and refunds",
["technical"] = "Bugs and outages",
}
)
),
},
}
);
foreach (var answer in result.Answers)
{
Console.WriteLine($"{answer.Key}: {answer.Value.Choice}");
}

snippet source | anchor

See the Providers guide for authentication and provider options.

Use SubquadraticModelCapabilitiesLookup.Get(modelId) from Vercel.AI.Subquadratic to look up a model’s declared capabilities and provider options, grouped by endpoint. It makes no API request and needs no configuration. It returns null for a model id the catalog does not list.

using Vercel.AI.Subquadratic;
var model = SubquadraticModelCapabilitiesLookup.Get("subq-savant-1.4");
foreach (var (endpoint, metadata) in model?.Endpoints ?? [])
{
Console.WriteLine($"{endpoint}: {metadata.Operation}");
}

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product