AAcceptMatrix
Product

Product features · HTTP media preferences

01

Choose between JSON and plain text using already parsed Accept ranges.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

HTTP media preferences

● ● ●AcceptMatrix●
A concrete starting point · HTTP media preferences ×
def choose_media(ranges):
    offered = ["application/json", "text/plain"]
    if not ranges:
        return offered[0]
    choices = []
    for i, media in enumerate(offered):
        family = media.split("/")[0] + "/*"
        matches = [(2 if p == media else 1 if p == family else 0, q)
                   for p, q in ranges if p in (media, family, "*/*")]
        quality = max(matches, default=(-1, 0))[1]
        if quality > 0:
            choices.append((quality, -i, media))
    return max(choices)[2] if choices else None
✳Choose between JSON and plain text using already parsed Accept ranges.
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗