artefactual.preprocessing.ChatCompletion#
- class artefactual.preprocessing.ChatCompletion(**data)[source]#
Bases:
LogprobsMixin,ResponseModelclient.chat.completions.create(…) — one choice per sampled sequence.
Extraction comes from LogprobsMixin: top_logprobs(), sampled_logprobs() and the classmethod parse, which accepts this format, bare or in a batch line, only.
Methods
adapterThe validator for the formats cls stands for: every registered one on the mixin, cls alone on a format.
constructcopyReturns a copy of the model.
dictfrom_ormjsonmodel_constructCreates a new instance of the Model class with validated data.
model_copy!!! abstract "Usage Documentation"
model_dump!!! abstract "Usage Documentation"
model_dump_json!!! abstract "Usage Documentation"
model_json_schemaGenerates a JSON schema for a model class.
model_parametrized_nameCompute the class name for parametrizations of generic classes.
model_post_initOverride this method to perform additional initialization after __init__ and model_construct.
model_rebuildTry to rebuild the pydantic-core schema for the model.
model_validateValidate a pydantic model instance.
model_validate_json!!! abstract "Usage Documentation"
model_validate_stringsValidate the given object with string data against the Pydantic model.
parseValidate a payload against the completion formats, telling the two failures apart.
parse_fileparse_objparse_rawsampled_logprobsThe logprob of each sampled token, ignoring the alternatives.
schemaschema_jsonOne token list per choice; a choice without logprobs, or whose content is null, is [].
top_logprobsEach token's top-k logprobs, one dict per sampled sequence.
update_forward_refsvalidate-
choices:
list[ChatChoice]#
- model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'from_attributes': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
choices: