OpenAICodecs

com.softinio.verdict4s.openai.OpenAICodecs
object OpenAICodecs

OpenAI Decisions' wire format for the vendor-neutral protocol types.

Written against the DecisionRequest and DecisionResponse schemas of OpenAI's published OpenAPI spec. The translation from Jev's vocabulary:

Shared model OpenAI Decisions
state input, as a string
question map questions array, each carrying its key as name
Noul predicate, answered with probability
Choice options choices: [{value, description}]
Score levels levels: [{label}], lowest first
probability maps arrays of {value, probability}
Score legend the label on each score probability

The request encoding is a method rather than an Encoder, unlike in com.softinio.verdict4s.jev.JevCodecs, because it needs the request-level safety_identifier, which OpenAIVendor carries.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

One question, named by its key so the answer can be matched back to it.

One question, named by its key so the answer can be matched back to it.

Noul criteria have no counterpart and are left out here; OpenAIVendor.validate rejects a request that carries them rather than let them vanish.

Attributes

def encodeRequest(request: EvaluationRequest, safetyIdentifier: Option[String]): Json

The request body. Questions go in the sorted order of their keys, which is the order Ask generated them in unless withKeys chose keys that sort differently, or the ask has more than a hundred questions.

The request body. Questions go in the sorted order of their keys, which is the order Ask generated them in unless withKeys chose keys that sort differently, or the ask has more than a hundred questions.

Attributes

Concrete fields

One answer and the key it belongs to.

One answer and the key it belongs to.

The spec allows a null name for an unnamed question. verdict4s names every question, so a missing name means the response does not belong to the request, and is reported rather than guessed at.

Attributes

Givens

Givens

A response body. Answers are matched to questions by name.

A response body. Answers are matched to questions by name.

Attributes