resolve method

  1. @override
Action? resolve(
  1. ActionType actionType,
  2. String name
)

Called to resolve an action by name.

actionType is the typed action kind being resolved (for example ActionType.model or ActionType.tool). Compare it against the ActionType constants rather than raw strings, since the underlying wire value can differ from the constant name (for example ActionType.tool serializes to tool.v2).

Implementation

@override
Action? resolve(ActionType actionType, String name) {
  if (actionType == .embedder) {
    return createEmbedder(name);
  }
  if (actionType == .model) {
    if (name.contains('-tts')) {
      return createModel(name, GeminiTtsOptions.$schema);
    }
    return createModel(name, GeminiOptions.$schema);
  }
  return null;
}