in src/WebJobs.Extensions.OpenAI/Embeddings/EmbeddingsHelper.cs [53:78]
static async Task<TextReader> GetTextReader(InputType inputType, string input)
{
if (inputType == InputType.RawText)
{
return new StringReader(input);
}
else if (inputType == InputType.FilePath)
{
return new StreamReader(input);
}
else if (inputType == InputType.Url)
{
if (!Uri.TryCreate(input, UriKind.Absolute, out Uri? uriResult) ||
uriResult.Scheme != Uri.UriSchemeHttps)
{
throw new ArgumentException($"Invalid Url: {input}. Ensure it is a valid https Url.");
}
Stream stream = await httpClient.GetStreamAsync(input);
return new StreamReader(stream);
}
else
{
throw new NotSupportedException($"InputType = '{inputType}' is not supported.");
}
}