Request Pipeline
AI Providers exposes both a blocking request path and a coroutine-based runtime path. Both use the same provider asset abstraction and the same service-level timeout and retry options.
Blocking editor path
public static bool TrySendPrompt(
LlmProviderDefinitionBase provider,
LlmChatRequest chat,
out string responseText,
out string error,
RequestOptions options)
This path is synchronous and editor-oriented. The service builds the request, sends it through UnityWebRequest, reads the raw response, and then asks the provider to extract provider-specific text.
Coroutine runtime path
StartCoroutine(AiProvidersService.SendPromptCoroutine(
provider,
chat,
result =>
{
if (result.Success) Debug.Log(result.ResponseText);
else Debug.LogError(result.Error);
},
new AiProvidersService.RequestOptions
{
timeoutSeconds = 30,
retryCount = 1,
retryDelaySeconds = 0.5f
}));
Request options
RequestOptions currently exposes timeout seconds, retry count, and retry delay seconds. The defaults are conservative: 120 seconds, zero retries, zero delay.
Response normalization
The service owns common response normalization fallbacks for generic "content" or "text" shapes after provider-specific extraction runs. That makes the transport layer slightly more forgiving while keeping provider ownership of real parsing logic.
Reality check
The blocking path still busy-waits and is best treated as editor-oriented tooling rather than ideal runtime behavior.