DefaultSupportedTypes
: abstract InferenceType
[Get] |
Signature
abstract InferenceType DefaultSupportedTypes |
SupportedInferenceTypes
: InferenceType
[Get] |
Signature
InferenceType SupportedInferenceTypes |
PrepareRequestImagesAsync
(
req
, supportsVision
, inlineRemote
, resolveRedirects
, maxBytes
, ct
)
|
Prepares a ChatRequest by processing images (inline or redirect resolution).
Consolidates duplicate image prep loop that appears in OpenAI, Llama, HuggingFace providers.
Signature
async Task< ChatRequest > PrepareRequestImagesAsync(ChatRequest req, bool supportsVision, bool inlineRemote, bool resolveRedirects, int maxBytes, CancellationToken ct) Parameters req: ChatRequestsupportsVision: boolinlineRemote: boolresolveRedirects: boolmaxBytes: intct: CancellationTokenReturns async Task< ChatRequest > |
ValidateConfiguration
(
apiKey
, endpoint
, model
)
|
Validates provider configuration parameters and throws descriptive exceptions if invalid.
Consolidates duplicate validation logic from all providers.
Signature
void ValidateConfiguration(string apiKey, string endpoint=null, string model=null) Parameters apiKey: stringÂ
API key to validate (required).
endpoint: stringÂ
Endpoint URL to validate (optional).
model: stringÂ
Model ID to validate (optional).
Returns voidThrows InvalidOperationExceptionÂ
Thrown when required parameters are missing.
|
EscapeJson
(
s
)
|
Escapes string for safe JSON encoding.
Consolidates duplicate Esc() methods from multiple providers.
Signature
static string EscapeJson(string s) Parameters s: stringÂ
String to escape.
Returns stringÂ
JSON-safe escaped string.
|
ImageInputToDataUri
(
img
, defaultMime
)
|
Converts an ImageInput to a data URI string for use in API payloads.
If the image has bytes, encodes them as base64 with the appropriate MIME type. If the image has a URL, returns it as-is. Consolidates duplicate conversion logic from OpenAI, Llama, HuggingFace providers.
Signature
static string ImageInputToDataUri(ImageInput img, string defaultMime="image/png") Parameters defaultMime: stringÂ
Default MIME type to use if not specified (default: "image/png").
Returns stringÂ
Data URI string or URL.
|
NormalizeEndpoint
(
endpoint
, defaultEndpoint
)
|
Normalizes endpoint URLs by ensuring proper /v1 suffix for OpenAI-compatible APIs.
Consolidates endpoint normalization logic.
Signature
static string NormalizeEndpoint(string endpoint, string defaultEndpoint) Parameters endpoint: stringÂ
Endpoint URL to normalize.
defaultEndpoint: stringÂ
Default endpoint if input is empty.
Returns stringÂ
Normalized endpoint URL.
|
items
: ObjectDetectionPrediction[] |
Signature
ObjectDetectionPrediction [] items |
predictions
: ObjectDetectionPrediction[] |
Signature
ObjectDetectionPrediction [] predictions |