Skip to content

OperationHeaders

Namespace: Vercel.AI.Operations

public static class OperationHeaders

Header and retry helpers shared by the operation types.

Inheritance: object

View source

MediaTypeFromContentType(IReadOnlyDictionary<string, string>?, string)

Section titled “MediaTypeFromContentType(IReadOnlyDictionary<string, string>?, string)”
public static string? MediaTypeFromContentType(IReadOnlyDictionary<string, string>? headers, string requiredPrefix)

Reads a header, ignoring case and parameters after ;.

Parameters

Name Type Description
headers IReadOnlyDictionary<string, string>
requiredPrefix string

Returns: string

View source

WithUserAgent(IReadOnlyDictionary<string, string>?, string)

Section titled “WithUserAgent(IReadOnlyDictionary<string, string>?, string)”
public static Dictionary<string, string> WithUserAgent(IReadOnlyDictionary<string, string>? headers, string suffix)

Lowercases header names and appends the AI SDK user-agent.

Parameters

Name Type Description
headers IReadOnlyDictionary<string, string>
suffix string

Returns: Dictionary<string, string>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product