HostAIProviders class
The AI models that the IDE’s options list, one HostAIProvider each. Reached through HostAI.Providers.
The collection holds the models whose Enabled box is ticked in the AI group of IDE Options, in the order of the list. A change to the models restarts the compiler, which loads the add-in again, so the collection an add-in reads does not change while it runs.
Private Sub ListModels()
Dim i As Long
For i = 0 To Host.AI.Providers.Count - 1
With Host.AI.Providers(i)
Host.DebugConsole.PrintText i & ": " & .FriendlyName & IIf(.IsDefault, " (default)", "")
End With
Next
End Sub
Properties
Count
How many models the collection holds. Long, read-only. 0 when the options list no model, or none is enabled.
DefaultProvider
The model whose Default button is selected. As HostAIProvider, read-only. Reading it when the collection is empty raises error -2147467259, Unspecified error, so test Count first.
Item
One model. As HostAIProvider, read-only. Item is the default member: Host.AI.Providers(0) is Host.AI.Providers.Item(0).
Syntax: providers.Item( IndexOrName )
- IndexOrName
- required The model’s place in the collection, counted from 0. Variant. An index outside the collection raises error -2147467259.
Warning BETA 1052
A String for IndexOrName returns the first model, whatever the string: its Friendly Name, its model’s name, or a name that no model has. Find a model by name with a loop that compares HostAIProvider.FriendlyName, as in the example above.
See Also
- HostAI.Providers property
- HostAIProvider class