Code Documentation¶
unitxt package¶
Subpackages¶
- unitxt.assistant package
- unitxt.service package
- unitxt.test_utils package
- unitxt.ui package
Submodules¶
- unitxt.api module
- unitxt.artifact module
AbstractCatalog
Artifact
Artifact.from_dict()
Artifact.get_artifact_type()
Artifact.get_pretty_print_name()
Artifact.is_artifact_dict()
Artifact.is_artifact_file()
Artifact.is_possible_identifier()
Artifact.is_registered_class()
Artifact.is_registered_class_name()
Artifact.is_registered_type()
Artifact.load()
Artifact.prepare()
Artifact.prepare_args()
Artifact.process_data_after_load()
Artifact.process_data_before_dump()
Artifact.register_class()
Artifact.save()
Artifact.serialize()
Artifact.to_json()
Artifact.verify()
Artifact.verify_artifact_dict()
Artifact.verify_data_classification_policy()
Artifact.verify_instance()
ArtifactLink
ArtifactList
Catalogs
MissingArtifactTypeError
UnitxtArtifactNotFoundError
UnrecognizedArtifactTypeError
dict_diff_string()
fetch_artifact()
get_artifacts_data_classification()
get_catalog_name_and_args()
get_closest_artifact_type()
get_raw()
is_name_legal_for_catalog()
maybe_recover_artifact()
maybe_recover_artifacts_structure()
register_all_artifacts()
reset_artifacts_json_cache()
verbosed_fetch_artifact()
verify_legal_catalog_name()
- unitxt.augmentors module
- unitxt.benchmark module
- unitxt.blocks module
- unitxt.card module
- unitxt.catalog module
- unitxt.collections module
- unitxt.collections_operators module
- unitxt.dataclass module
AbstractField
AbstractFieldError
Dataclass
DataclassMeta
Field
FinalField
FinalFieldError
InternalField
MissingDefaultError
NonPositionalField
OptionalField
RequiredField
RequiredFieldError
TypeMismatchError
Undefined
UnexpectedArgumentError
abstract_fields()
asdict()
class_fields()
external_fields_names()
fields()
fields_names()
final_fields()
get_field_default()
get_fields()
is_abstract_field()
is_class_method()
is_dataclass()
is_final_field()
is_possible_field()
required_fields()
- unitxt.dataset module
- unitxt.dataset_utils module
- unitxt.deprecation_utils module
- unitxt.dialog_operators module
- unitxt.dict_utils module
- unitxt.error_utils module
- unitxt.eval_utils module
- unitxt.file_utils module
- unitxt.formats module
- unitxt.fusion module
- unitxt.generator_utils module
- unitxt.hf_utils module
- unitxt.image_operators module
- unitxt.inference module
AsyncTokenBucket
AzureOpenAIInferenceEngine
CredentialsOpenAi
CrossProviderInferenceEngine
GenericInferenceEngine
HFAutoModelInferenceEngine
HFGenerationParamsMixin
HFInferenceEngineBase
HFLlavaInferenceEngine
HFOptionSelectingInferenceEngine
HFPeftInferenceEngine
HFPipelineBasedInferenceEngine
IbmGenAiInferenceEngine
IbmGenAiInferenceEngineParamsMixin
InferenceEngine
LMMSEvalBaseInferenceEngine
LMMSEvalInferenceEngine
LMMSEvalLoglikelihoodInferenceEngine
LazyLoadMixin
ListWithMetadata
LiteLLMInferenceEngine
LogProbInferenceEngine
MockInferenceEngine
MockModeMixin
OllamaInferenceEngine
OpenAiInferenceEngine
OpenAiInferenceEngineParamsMixin
OptionSelectingByLogProbsInferenceEngine
RITSInferenceEngine
StandardAPIParamsMixin
TextGenerationInferenceOutput
TogetherAiInferenceEngine
TogetherAiInferenceEngineParamsMixin
TorchDeviceMixin
VLLMInferenceEngine
VLLMParamsMixin
VLLMRemoteInferenceEngine
WMLChatParamsMixin
WMLGenerationParamsMixin
WMLInferenceEngineBase
WMLInferenceEngineChat
WMLInferenceEngineGeneration
batched()
get_images_without_text()
get_model_and_label_id()
get_text_without_images()
mock_logprobs_default_value_factory()
run_with_imap()
- unitxt.instructions module
- unitxt.llm_as_judge module
- unitxt.llm_as_judge_chat_templates module
- unitxt.llm_as_judge_constants module
Criteria
CriteriaOption
CriteriaWithOptions
DirectCriteriaCatalogEnum
DirectCriteriaCatalogEnum.ANSWER_RELEVANCE
DirectCriteriaCatalogEnum.ANSWER_RELEVANCE_ASSISTANT_MESSAGE
DirectCriteriaCatalogEnum.COHERENCE
DirectCriteriaCatalogEnum.CONCISENESS
DirectCriteriaCatalogEnum.CONSISTENCY
DirectCriteriaCatalogEnum.CONTEXT_RELEVANCE_CONTEXT
DirectCriteriaCatalogEnum.CONVERSATIONAL
DirectCriteriaCatalogEnum.CORRECTNESS_BASED_ON_GROUND_TRUTH
DirectCriteriaCatalogEnum.EFFECTIVENESS
DirectCriteriaCatalogEnum.EMPATHY
DirectCriteriaCatalogEnum.ENGAGEMENT
DirectCriteriaCatalogEnum.EXAMPLES_AND_DETAILS
DirectCriteriaCatalogEnum.FLUENCY
DirectCriteriaCatalogEnum.GENERAL_HARM_ASSISTANT_MESSAGE
DirectCriteriaCatalogEnum.GENERAL_HARM_USER_MESSAGE
DirectCriteriaCatalogEnum.GRAMMAR_AND_PUNCTUATION
DirectCriteriaCatalogEnum.GROUNDEDNESS_ASSISTANT_MESSAGE
DirectCriteriaCatalogEnum.HARMFULNESS
DirectCriteriaCatalogEnum.INFORMATION_FROM_REFERENCE
DirectCriteriaCatalogEnum.INFORMATION_OUTSIDE_REFERENCE
DirectCriteriaCatalogEnum.INSENSITIVITY
DirectCriteriaCatalogEnum.IRRELEVANT_INFORMATION
DirectCriteriaCatalogEnum.JAILBREAK_USER_MESSAGE
DirectCriteriaCatalogEnum.MANIPULATIVE
DirectCriteriaCatalogEnum.NATURALNESS
DirectCriteriaCatalogEnum.OBJECTIVITY
DirectCriteriaCatalogEnum.PROFANITY_ASSISTANT_MESSAGE
DirectCriteriaCatalogEnum.PROFANITY_USER_MESSAGE
DirectCriteriaCatalogEnum.PROFESSIONAL_TONE
DirectCriteriaCatalogEnum.QUALITY
DirectCriteriaCatalogEnum.REFERENCE_DOCUMENT_FAITHFULNESS
DirectCriteriaCatalogEnum.RELEVANCE
DirectCriteriaCatalogEnum.SOCIAL_BIAS_ASSISTANT_MESSAGE
DirectCriteriaCatalogEnum.SOCIAL_BIAS_USER_MESSAGE
DirectCriteriaCatalogEnum.STRUCTURE
DirectCriteriaCatalogEnum.SUMMARIZATION_PREFERENCE
DirectCriteriaCatalogEnum.TEMPERATURE
DirectCriteriaCatalogEnum.TRUTHFULNESS
DirectCriteriaCatalogEnum.UNETHICAL_BEHAVIOR_ASSISTANT_MESSAGE
DirectCriteriaCatalogEnum.UNETHICAL_BEHAVIOR_USER_MESSAGE
DirectCriteriaCatalogEnum.VIOLENCE_ASSISTANT_MESSAGE
DirectCriteriaCatalogEnum.VIOLENCE_USER_MESSAGE
EvaluatorMetadata
EvaluatorNameEnum
EvaluatorTypeEnum
ModelProviderEnum
OptionSelectionStrategyEnum
PairwiseCriteriaCatalogEnum
PairwiseCriteriaCatalogEnum.EMAIL_INCLUSIVITY
PairwiseCriteriaCatalogEnum.FACTUALLY_CONSISTENT
PairwiseCriteriaCatalogEnum.FUNNY_JOKE
PairwiseCriteriaCatalogEnum.INCLUSIVITY
PairwiseCriteriaCatalogEnum.REFERENCE_DOCUMENT_FAITHFULNESS
PairwiseCriteriaCatalogEnum.SUMMARIZATION_PREFERENCE
PairwiseCriteriaCatalogEnum.TEMPERATURE
- unitxt.llm_as_judge_from_template module
LLMAsJudge
LLMAsJudgeBase
LLMAsJudgeBase.main_score
LLMAsJudgeBase.task
LLMAsJudgeBase.template
LLMAsJudgeBase.format
LLMAsJudgeBase.system_prompt
LLMAsJudgeBase.inference_model
LLMAsJudgeBase.reduction_map
LLMAsJudgeBase.batch_size
LLMAsJudgeBase.get_metric_results_from_prediction_outputs()
LLMAsJudgeBase.infer_instances()
LLMAsJudgeBase.prediction_type
LLMAsJudgeBase.prepare_instances()
TaskBasedLLMasJudge
get_task_data_dict()
- unitxt.llm_as_judge_operators module
- unitxt.llm_as_judge_utils module
- unitxt.loaders module
- unitxt.logging_utils module
- unitxt.metric module
- unitxt.metric_utils module
DeleteTargetPrefix
EvaluationResults
FromPredictionsAndOriginalData
GlobalScores
GroupsScores
InstanceInput
InstanceScores
JoinSubsetsAndGroups
MetricRecipe
MetricRequest
MetricResponse
PostProcessRecipe
SplitSubsetsAndGroups
SubsetsScores
get_remote_metrics_endpoint()
get_remote_metrics_names()
group_str()
group_str_to_key_value()
nan_mean()
stream_name_to_origin_subset_group()
- unitxt.metrics module
ANLS
Accuracy
AccuracyFast
AggregationReduction
BertScore
BinaryAccuracy
BinaryMaxAccuracy
BinaryMaxF1
BulkInstanceMetric
CharEditDistance
CharEditDistanceAccuracy
ConfidenceIntervalMixin
CustomF1
CustomF1Fuzzy
Detector
DictReduction
EvaluationInput
ExactMatchMM
F1
F1Binary
F1BinaryPosOnly
F1Fast
F1Macro
F1MacroMultiLabel
F1Micro
F1MicroMultiLabel
F1MultiLabel
F1Strings
F1Weighted
FaithfulnessHHEM
FinQAEval
FixedGroupAbsvalNormCohensHParaphraseAccuracy
FixedGroupAbsvalNormCohensHParaphraseStringContainment
FixedGroupAbsvalNormHedgesGParaphraseAccuracy
FixedGroupAbsvalNormHedgesGParaphraseStringContainment
FixedGroupMeanAccuracy
FixedGroupMeanBaselineAccuracy
FixedGroupMeanBaselineStringContainment
FixedGroupMeanParaphraseAccuracy
FixedGroupMeanParaphraseStringContainment
FixedGroupMeanStringContainment
FixedGroupNormCohensHParaphraseAccuracy
FixedGroupNormCohensHParaphraseStringContainment
FixedGroupNormHedgesGParaphraseAccuracy
FixedGroupNormHedgesGParaphraseStringContainment
FixedGroupPDRParaphraseAccuracy
FixedGroupPDRParaphraseStringContainment
FuzzyNer
GlobalMetric
GraniteGuardianAgenticRisk
GraniteGuardianAssistantRisk
GraniteGuardianBase
GraniteGuardianCustomRisk
GraniteGuardianRagRisk
GraniteGuardianUserRisk
GroupMeanAccuracy
GroupMeanStringContainment
GroupMeanTokenOverlap
HuggingfaceBulkMetric
HuggingfaceInstanceMetric
HuggingfaceMetric
InstanceMetric
IsCodeMixed
JaccardIndex
KPA
KendallTauMetric
KeyValueExtraction
LlamaIndexCorrectness
LlamaIndexFaithfulness
LlamaIndexLLMMetric
MAP
MRR
MapReduceMetric
MatthewsCorrelation
MaxAccuracy
MaxReduction
MeanReduction
Meteor
MeteorFast
Metric
MetricPipeline
MetricWithConfidenceInterval
MetricsEnsemble
MetricsList
NDCG
NER
NLTKMixin
NormalizedSacrebleu
Perplexity
PrecisionBinary
PrecisionMacroMultiLabel
PrecisionMicroMultiLabel
PredictionLength
RandomForestMetricsEnsemble
RecallBinary
RecallMacroMultiLabel
RecallMicroMultiLabel
ReductionInstanceMetric
RegardMetric
RelaxedCorrectness
RemoteMetric
RerankRecall
RetrievalAtK
RetrievalMetric
Reward
RiskType
RocAuc
Rouge
RougeHF
SQLExecutionAccuracy
SQLNonExecutionAccuracy
SafetyMetric
SentenceBert
Spearmanr
Squad
Statistic
StringContainment
StringContainmentRatio
TokenOverlap
UnsortedListExactMatch
UpdateStream
WebsrcSquadF1
WeightedWinRateCorrelation
Wer
abstract_factory()
abstract_field()
get_index_or_default()
hf_evaluate_load()
interpret_effect_size()
is_original_key()
mean_subgroup_score()
nan_max()
nan_mean()
nan_std()
new_random_generator()
normalize_answer()
normalized_cohens_h()
normalized_hedges_g()
parse_string_types_instead_of_actual_objects()
performance_drop_rate()
pytrec_eval_at_k()
validate_subgroup_types()
- unitxt.normalizers module
- unitxt.operator module
InstanceOperator
InstanceOperatorValidator
InstanceOperatorWithMultiStreamAccess
MissingRequirementsError
MultiStreamOperator
Operator
OperatorError
PackageRequirementsMixin
PagedStreamOperator
SequentialMixin
SequentialOperator
SequentialOperatorInitializer
SideEffectOperator
SingleStreamOperator
SingleStreamReducer
SourceOperator
SourceSequentialOperator
StreamInitializerOperator
StreamOperator
StreamingOperator
instance_generator()
instance_result()
stream_single()
- unitxt.operators module
- Operators: Building Blocks of Unitxt Processing Pipelines
AddConstant
AddID
Apply
ApplyMetric
ApplyOperatorsField
ApplyStreamOperatorsField
ArtifactFetcherMixin
Balance
Cast
CastFields
CollateInstances
CollateInstancesByField
ComputeExpressionMixin
Copy
Deduplicate
DefaultPlaceHolder
DeterministicBalancer
DivideAllFieldsBy
DownloadError
DownloadOperator
DuplicateInstances
EncodeLabels
ExecuteExpression
ExtractFieldValues
ExtractMostCommonFieldValues
ExtractZipFile
FeatureGroupedShuffle
FieldOperator
Fillna
FilterByCondition
FilterByConditionBasedOnFields
FilterByExpression
FlattenInstances
FromIterables
GetItemByIndex
IndexOf
InstanceFieldOperator
InterleaveListsToDialogOperator
Intersect
IntersectCorrespondingFields
IterableSource
JoinStr
LengthBalancer
ListFieldValues
MapInstanceValues
MapValues
MergeStreams
MinimumOneExamplePerLabelRefiner
Perturb
RecursiveCopy
RemoveFields
RemoveValues
Rename
SelectFields
Set
Shuffle
ShuffleFieldValues
SplitByNestedGroup
SplitByValue
StreamRefiner
TakeByField
UnexpectedHttpCodeError
Unique
WikipediaFetcher
ZipFieldValues
update_scores_of_stream_instances()
- unitxt.parsing_utils module
- unitxt.processors module
AddPrefix
Capitalize
ConvertToBoolean
DictOfListsToPairs
ExtractArenaHardNumericalJudgment
ExtractMtBenchLabelJudgment
ExtractMtBenchRatingJudgment
ExtractSafeUnsafeJudgment
ExtractVerbalJudgementBadGood
ExtractVerbalJudgment
ExtractWithRegex
FirstCharacter
FixWhiteSpace
GetSQL
GetStringAfter
InferDictsToBinaryLogprobs
ListToEmptyEntitiesTuples
LiteralEval
Lower
LowerCaseTillPunc
MatchClosestOption
PostProcess
RegexParser
RemoveArticles
RemovePunctuations
ScaleNumberToZeroOneReturnZeroIfFails
SplitStrip
StanceToProCon
StrToFloatFormat
StringEquals
Substring
TakeFirstNonEmptyLine
TakeFirstWord
TakeLastNonEmptyLine
ToListByComma
ToListByCommaSpace
ToString
ToStringStripped
ToYesOrNone
Upper
YesNoToInt
YesToOneElseZero
process_instance_value()
- unitxt.random_utils module
- unitxt.recipe module
- unitxt.register module
- unitxt.schema module
- unitxt.serializers module
DefaultListSerializer
DefaultSerializer
DialogSerializer
DictAsJsonSerializer
DocumentSerializer
ImageSerializer
ListSerializer
MultiDocumentSerializer
MultiTypeSerializer
NumberQuantizingSerializer
NumberSerializer
SQLDatabaseAsSchemaSerializer
Serializer
SingleTypeSerializer
TableSerializer
VideoSerializer
- unitxt.settings_utils module
- unitxt.span_lableing_operators module
- unitxt.split_utils module
- unitxt.splitters module
- unitxt.sql_utils module
Cache
DatabaseConnector
InMemoryDatabaseConnector
LocalSQLiteConnector
RemoteDatabaseConnector
collect_clause()
execute_query_local()
execute_query_remote()
extract_select_columns()
extract_select_info()
generate_cache_key()
get_cache()
get_db_connector()
is_sqlglot_parsable()
is_sqlparse_parsable()
sql_exact_match()
sqlglot_optimized_equivalence()
sqlglot_parsed_queries_equivalent()
sqlparse_queries_equivalent()
strip_alias()
- unitxt.standard module
- unitxt.stream module
- unitxt.stream_operators module
- unitxt.string_operators module
- unitxt.struct_data_operators module
ConstructTableFromRowsCols
ConvertTableColNamesToSequential
DumpJson
DuplicateTableColumns
DuplicateTableRows
GetNumOfTableCells
InsertEmptyTableRows
JsonStrToDict
ListToKeyValPairs
LoadJson
MapHTMLTableToJSON
MapTableListsToStdTableJSON
MaskColumnsNames
SerializeKeyValPairs
SerializeTable
SerializeTableAsConcatenation
SerializeTableAsDFLoader
SerializeTableAsHTML
SerializeTableAsImage
SerializeTableAsIndexedRowMajor
SerializeTableAsJson
SerializeTableAsMarkdown
SerializeTableRowAsList
SerializeTableRowAsText
SerializeTriples
ShuffleColumnsNames
ShuffleTableColumns
ShuffleTableRows
TransposeTable
TruncateTableCells
TruncateTableRows
shuffle_columns()
shuffle_rows()
truncate_cell()
- unitxt.system_prompts module
- unitxt.task module
- unitxt.templates module
ApplyRandomTemplate
ApplySingleTemplate
ApplyTemplate
DialogFieldsData
DialogPairwiseChoiceTemplate
DialogTemplate
InputFormatTemplate
InputOutputTemplate
InputOutputTemplateWithCustomTarget
JsonOutputFormatTemplate
JsonOutputTemplate
KeyValTemplate
MultiLabelTemplate
MultiReferenceTemplate
MultipleChoiceTemplate
NullTemplate
OutputFormatTemplate
OutputQuantizingTemplate
PairwiseChoiceTemplate
PairwiseComparativeRatingTemplate
SpanLabelingBaseTemplate
SpanLabelingJsonTemplate
SpanLabelingTemplate
Template
TemplateFormatKeyError
TemplatesDict
TemplatesList
YesNoTemplate
escape_chars()
random()
- unitxt.text_utils module
- unitxt.type_utils module
GenericTypedDict
NormalizedType
UnsupportedTypeError
convert_union_type()
eval_forward_ref()
format_type_string()
get_args()
get_origin()
infer_type()
infer_type_string()
is_new_type()
is_type()
is_type_dict()
is_typed_dict()
isoftype()
issubtype()
normalize()
optional_all()
optional_any()
parse_type_dict()
parse_type_string()
register_type()
replace_class_names()
strtype()
to_float_or_default()
to_type_dict()
to_type_string()
verify_required_schema()
- unitxt.types module
- unitxt.utils module
LRUCache
LongString
Singleton
artifacts_json_cache()
deep_copy()
flatten_dict()
import_module_from_file()
is_module_available()
is_package_installed()
json_dump()
load_json()
recursive_copy()
recursive_deep_copy()
recursive_shallow_copy()
remove_numerics_and_quoted_texts()
safe_eval()
save_to_file()
shallow_copy()
- unitxt.validate module
- unitxt.version module