Newshot

Liquid AI's d1.2 and d1.2-ultra are now available on AI Gateway

Summary

Liquid AI’s d1.2 and d1.2-ultra are now available on AI Gateway with audio input and bounding box support. These decision models return structured answers instead of generating text. Ask Boolean questions for yes/no probabilities, Choice questions to select a category, or Score questions to rate an input against a rubric. Multiple questions can share the same input in one request. d1.2 is the faster, lower-cost model. d1.2-ultra is Liquid AI’s most accurate decision model. Use liquid/d1.2 or liquid/d1.2-ultra as the model name. Before running the examples, set AI_GATEWAY_API_KEY to an AI Gateway API key . Classify a voicemail with AI SDK 7 Pass audio as a file part in state . This example reads voicemail.flac and returns the probability that the caller is requesting a refund. It requires ai 7.0.136 or later. For image classification, pass image bytes with the matching media type, such as image/png . Locate an object with the Decisions API Box questions return top and bottom as fraction…

Original text(via Vercel Blog)

Liquid AI’s d1.2 and d1.2-ultra are now available on AI Gateway with audio input and bounding box support.

These decision models return structured answers instead of generating text. Ask Boolean questions for yes/no probabilities, Choice questions to select a category, or Score questions to rate an input against a rubric. Multiple questions can share the same input in one request.

d1.2 is the faster, lower-cost model. d1.2-ultra is Liquid AI’s most accurate decision model.

Use liquid/d1.2 or liquid/d1.2-ultra as the model name. Before running the examples, set AI_GATEWAY_API_KEY to an AI Gateway API key.

Copy link to headingClassify a voicemail with AI SDK 7

Pass audio as a file part in state. This example reads voicemail.flac and returns the probability that the caller is requesting a refund. It requires ai 7.0.136 or later.


        import { readFile } from 'node:fs/promises';import { experimental_decide as decide } from 'ai';
const { answers } = await decide({  model: 'liquid/d1.2-ultra',  state: [    { type: 'file', mediaType: 'audio/flac', data: await readFile('voicemail.flac') },  ],  questions: {    refund: { type: 'boolean', instructions: 'Is the caller asking for a refund?' },  },});
console.log(answers.refund.probability);
      

For image classification, pass image bytes with the matching media type, such as image/png.

Copy link to headingLocate an object with the Decisions API

Box questions return top and bottom as fractions of the image height, and left and right as fractions of its width.

This Python example uses the Decisions API to locate a signature in form.png and print its bounding box:


        import base64import jsonimport osfrom pathlib import Pathfrom urllib.request import Request, urlopen
image = base64.b64encode(Path("label.png").read_bytes()).decode("ascii")body = {    "model": "liquid/d1.2-ultra",    "input": [{"role": "user", "content": [        {"type": "input_image", "image_url": f"data:image/png;base64,{image}"},    ]}],    "questions": [{"type": "box", "name": "label", "instructions": "Locate the red rectangle."}],}request = Request(    "https://ai-gateway.vercel.sh/v1/decisions",    data=json.dumps(body).encode(),    headers={        "Authorization": f"Bearer {os.environ['AI_GATEWAY_API_KEY']}",        "Content-Type": "application/json",    },)with urlopen(request, timeout=30) as response:    answer = json.load(response)["answers"][0]print(answer.get("box"))
      

Decision requests appear in AI Gateway logs and count toward budgets.

Learn more in the decision model documentation, or browse all decision models.

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by Vercel Blog
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗